From 346d1a34056e6ec6ee5e4bc7b3bdac36f073b8cb Mon Sep 17 00:00:00 2001 From: Attila Klenik Date: Mon, 29 Sep 2025 15:27:02 +0200 Subject: [PATCH] fix: Remove NPM token check from publishing script (#1712) Signed-off-by: Attila Klenik --- package-lock.json | 28 +++++++++---------- .../caliper-publish/artifacts/npm-publish.sh | 11 ++------ packages/caliper-publish/lib/npmCommand.js | 2 +- packages/caliper-publish/publish.js | 2 +- 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index f562b051e..a6791c10e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,8 +20,8 @@ "license-check-and-add": "2.3.6" }, "engines": { - "node": ">=18.19.0", - "npm": ">=7.24.2" + "node": ">=22", + "npm": ">=11.5.1" } }, "node_modules/@ampproject/remapping": { @@ -14584,8 +14584,8 @@ "nyc": "17.1.0" }, "engines": { - "node": ">=18.19.0", - "npm": ">=6.14.16" + "node": ">=22", + "npm": ">=11.5.1" } }, "packages/caliper-core": { @@ -14624,8 +14624,8 @@ "sinon-chai": "^3.7.0" }, "engines": { - "node": ">=18.19.0", - "npm": ">=6.14.16" + "node": ">=22", + "npm": ">=11.5.1" } }, "packages/caliper-fabric": { @@ -14647,8 +14647,8 @@ "sinon": "^21.0.0" }, "engines": { - "node": ">=18.19.0", - "npm": ">=6.14.16" + "node": ">=22", + "npm": ">=11.5.1" } }, "packages/caliper-publish": { @@ -14666,8 +14666,8 @@ "verdaccio": "3.12.0" }, "engines": { - "node": ">=18.19.0", - "npm": ">=6.14.16" + "node": ">=22", + "npm": ">=11.5.1" } }, "packages/caliper-tests-integration": { @@ -14684,8 +14684,8 @@ "license-check-and-add": "2.3.6" }, "engines": { - "node": ">=18.19.0", - "npm": ">=6.14.16" + "node": ">=22", + "npm": ">=11.5.1" } }, "packages/generator-caliper": { @@ -14707,8 +14707,8 @@ "yeoman-test": "^2.3.0" }, "engines": { - "node": ">=18.19.0", - "npm": ">=6.14.16" + "node": ">=22", + "npm": ">=11.5.1" } }, "packages/generator-caliper/node_modules/array-differ": { diff --git a/packages/caliper-publish/artifacts/npm-publish.sh b/packages/caliper-publish/artifacts/npm-publish.sh index 780d094fb..747949309 100755 --- a/packages/caliper-publish/artifacts/npm-publish.sh +++ b/packages/caliper-publish/artifacts/npm-publish.sh @@ -22,15 +22,8 @@ ARCH=`uname -m` if [[ -z "${NPM_REGISTRY}" ]] then - if [[ -z "${NPM_TOKEN}" ]] - then - echo "NPM_TOKEN must be set when publishing to the public NPM registry." - exit 1 - else - # Set the NPM access token we will use to publish. - npm config set registry https://registry.npmjs.org/ - npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} - fi + # Set the public NPM registry as default + npm config set registry https://registry.npmjs.org/ fi npm publish --access public ${NPM_REGISTRY} ${DRY_RUN} --tag ${TAG} diff --git a/packages/caliper-publish/lib/npmCommand.js b/packages/caliper-publish/lib/npmCommand.js index 383d6b786..9d5f16cdc 100755 --- a/packages/caliper-publish/lib/npmCommand.js +++ b/packages/caliper-publish/lib/npmCommand.js @@ -25,7 +25,7 @@ module.exports.builder = yargs => { demand: false, default: '', type: 'string', - describe: 'The NPM registry address to use for publishing the packages. Defaults to the public NPM registry which requires NPM_TOKEN to be set.' + describe: 'The NPM registry address to use for publishing the packages. Defaults to the public NPM registry which requires trusted publishing to be configured.' }, 'dry-run': { alias: 'd', diff --git a/packages/caliper-publish/publish.js b/packages/caliper-publish/publish.js index 5f98c3d3e..cc07749a6 100755 --- a/packages/caliper-publish/publish.js +++ b/packages/caliper-publish/publish.js @@ -27,9 +27,9 @@ let results = yargs .demandCommand(1, 1, 'Please specify a command to continue') .wrap(null) .strict() + .version(version) // enabling the version command must come before its alias setting, otherwise -v will not work .alias('version', 'v') .alias('help', 'h') - .version(version) .describe('version', 'Show version information') .describe('help', 'Show usage information') .argv;