diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0e73e48..46a664d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -236,6 +236,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18.x + registry-url: "https://registry.npmjs.org/" - name: Fetch library artifacts uses: actions/download-artifact@v3 @@ -272,24 +273,18 @@ jobs: LIB_INDY_VDR_PATH: ../../../ run: yarn test - - name: Set NPM config - if: | - github.event_name == 'release' || - (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-wrappers == 'true') - run: | - echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc - echo "registry=https://registry.npmjs.org/" >> .npmrc - echo "always-auth=true" >> .npmrc - - # TODO: this will currently publish the version as defined in the package.json. If the version already - # exists on NPM it will skip the publishing. This means if a new version is released, but the version hasn't been - # updated in the package.json files yet, it won't publish to NPM (which is kinda nice). We should however add a check - # to see if the JS version matches the release version (do we want to keep the js and rust version in sync?) - name: Publish if: | github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-wrappers == 'true') - run: npx lerna publish from-package --no-push --no-private --yes --no-git-tag-version + run: | + if [[ $(cat lerna.json | grep version | head -1 | grep dev) ]]; then + npx lerna publish from-package --no-push --no-private --yes --no-git-tag-version --dist-tag=alpha + else + npx lerna publish from-package --no-push --no-private --yes --no-git-tag-version + fi + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} build-ios: name: Build library (iOS) diff --git a/wrappers/javascript/.eslintrc.js b/wrappers/javascript/.eslintrc.js index cede0fd0..e1672916 100644 --- a/wrappers/javascript/.eslintrc.js +++ b/wrappers/javascript/.eslintrc.js @@ -71,7 +71,7 @@ module.exports = { }, overrides: [ { - files: ['arch.js', 'platform.js'], + files: ['**/scripts/*.js'], env: { node: true, }, @@ -79,6 +79,7 @@ module.exports = { '@typescript-eslint/no-unsafe-assignment': 'off', 'no-console': 'off', '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/restrict-template-expressions': 'off', }, }, { diff --git a/wrappers/javascript/indy-vdr-nodejs/package.json b/wrappers/javascript/indy-vdr-nodejs/package.json index fbc0e00c..73afc524 100644 --- a/wrappers/javascript/indy-vdr-nodejs/package.json +++ b/wrappers/javascript/indy-vdr-nodejs/package.json @@ -1,6 +1,6 @@ { "name": "@hyperledger/indy-vdr-nodejs", - "version": "0.2.0-dev.2", + "version": "0.2.0-dev.3", "license": "Apache-2.0", "description": "Nodejs wrapper for Indy Vdr", "source": "src/index", @@ -24,7 +24,7 @@ "clean": "rimraf -rf ./build", "compile": "tsc -p tsconfig.build.json", "test": "jest", - "install": "node-pre-gyp install --target_arch=$(node scripts/arch.js) --target_platform=$(node scripts/platform.js)" + "install": "node scripts/install.js" }, "devDependencies": { "@babel/core": "^7.12.9", @@ -40,7 +40,7 @@ "typescript": "~4.9.4" }, "dependencies": { - "@hyperledger/indy-vdr-shared": "0.2.0-dev.2", + "@hyperledger/indy-vdr-shared": "0.2.0-dev.3", "@mapbox/node-pre-gyp": "^1.0.10", "@2060.io/ffi-napi": "4.0.8", "@2060.io/ref-napi": "3.0.6", diff --git a/wrappers/javascript/indy-vdr-nodejs/scripts/arch.js b/wrappers/javascript/indy-vdr-nodejs/scripts/arch.js deleted file mode 100644 index ab046ce3..00000000 --- a/wrappers/javascript/indy-vdr-nodejs/scripts/arch.js +++ /dev/null @@ -1,23 +0,0 @@ -const os = require('os') - -// Find appropriate target architecture for retrieving the anoncreds library -const arch = os.arch() -const platform = os.platform() - -// Architecture mapping -// This is used because node-pre-gyp uses `os.arch()` for -// architecture detection, but our library uses a different -// naming convention -const archTable = { - x64: 'x86_64', - arm64: 'aarch64', -} - -const targetArchitecture = platform == 'darwin' ? 'universal' : archTable[arch] - -if (targetArchitecture) { - // We console.log here because when we use the `yarn install` script - // er evaluate this script and use the output as an argument to - // node-pre-gyp as `--arch=$(node -e arch.js)` - console.log(targetArchitecture) -} diff --git a/wrappers/javascript/indy-vdr-nodejs/scripts/install.js b/wrappers/javascript/indy-vdr-nodejs/scripts/install.js new file mode 100644 index 00000000..468e8f15 --- /dev/null +++ b/wrappers/javascript/indy-vdr-nodejs/scripts/install.js @@ -0,0 +1,14 @@ +const { execSync } = require('node:child_process') +const { arch, platform } = require('os') + +const archTable = { + x64: 'x86_64', + arm64: 'aarch64', +} + +const targetPlatform = platform() === 'win32' ? 'windows' : platform() +const targetArchitecture = archTable[arch()] + +const command = `node-pre-gyp install --target_arch=${targetArchitecture} --target_platform=${targetPlatform}` + +execSync(command) diff --git a/wrappers/javascript/indy-vdr-nodejs/scripts/platform.js b/wrappers/javascript/indy-vdr-nodejs/scripts/platform.js deleted file mode 100644 index e521f2e0..00000000 --- a/wrappers/javascript/indy-vdr-nodejs/scripts/platform.js +++ /dev/null @@ -1,9 +0,0 @@ -const os = require('os') - -// Find appropriate target architecture for retrieving the anoncreds library -const platform = os.platform() - -// We swap win32 with windows as that is the key that we use -const targetPlatform = platform == 'win32' ? 'windows' : platform - -console.log(targetPlatform) diff --git a/wrappers/javascript/indy-vdr-react-native/package.json b/wrappers/javascript/indy-vdr-react-native/package.json index 2aa037ba..4400aabc 100644 --- a/wrappers/javascript/indy-vdr-react-native/package.json +++ b/wrappers/javascript/indy-vdr-react-native/package.json @@ -1,6 +1,6 @@ { "name": "@hyperledger/indy-vdr-react-native", - "version": "0.2.0-dev.2", + "version": "0.2.0-dev.3", "license": "Apache-2.0", "description": "React Native wrapper for Indy Vdr", "source": "src/index", @@ -40,7 +40,7 @@ "install": "node-pre-gyp install" }, "dependencies": { - "@hyperledger/indy-vdr-shared": "0.2.0-dev.2", + "@hyperledger/indy-vdr-shared": "0.2.0-dev.3", "@mapbox/node-pre-gyp": "^1.0.10" }, "devDependencies": { diff --git a/wrappers/javascript/indy-vdr-shared/package.json b/wrappers/javascript/indy-vdr-shared/package.json index 5c8ea519..17b4758b 100644 --- a/wrappers/javascript/indy-vdr-shared/package.json +++ b/wrappers/javascript/indy-vdr-shared/package.json @@ -1,6 +1,6 @@ { "name": "@hyperledger/indy-vdr-shared", - "version": "0.2.0-dev.2", + "version": "0.2.0-dev.3", "license": "Apache-2.0", "description": "Shared library for using Indy VDR with NodeJS and React Native", "main": "build/index", diff --git a/wrappers/javascript/lerna.json b/wrappers/javascript/lerna.json index 378961ce..85ae8f2f 100644 --- a/wrappers/javascript/lerna.json +++ b/wrappers/javascript/lerna.json @@ -1,11 +1,11 @@ { + "$schema": "node_modules/lerna/schemas/lerna-schema.json", "packages": ["indy-vdr-*"], - "version": "0.2.0-dev.2", + "version": "0.2.0-dev.3", "npmClient": "yarn", "command": { "version": { "allowBranch": "main" } - }, - "$schema": "node_modules/lerna/schemas/lerna-schema.json" + } }