From 8e309e9bca7a04a3a6d7844c72c70720183676ab Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Wed, 6 Nov 2019 12:51:58 -0500 Subject: [PATCH] allow same version when building npm package on Circle (#5601) * allow same version when building npm package on Circle * check next dev version from node script * print current package version for complete info --- appveyor.yml | 1 + circle.yml | 5 +++-- package.json | 1 + scripts/check-next-dev-version.js | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 scripts/check-next-dev-version.js diff --git a/appveyor.yml b/appveyor.yml index 4777e96c88..10dcf01cb3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -53,6 +53,7 @@ install: - node --version - node --print process.arch - npm --version + - npm run check-next-dev-version # prints all public variables relevant to the build - print-env Platform - npm run check-node-version diff --git a/circle.yml b/circle.yml index 23a8dd3b23..d6c70c70b6 100644 --- a/circle.yml +++ b/circle.yml @@ -714,9 +714,10 @@ jobs: steps: - attach_workspace: at: ~/ + - run: npm run check-next-dev-version - run: name: bump NPM version - command: npm --no-git-tag-version version ${NEXT_DEV_VERSION:-0.0.0-development} + command: npm --no-git-tag-version --allow-same-version version ${NEXT_DEV_VERSION:-0.0.0-development} - run: name: build NPM package working_directory: cli @@ -1121,7 +1122,7 @@ mac-workflow: &mac-workflow branches: only: - develop - + - lint: name: Mac lint executor: mac diff --git a/package.json b/package.json index a80a1043d8..f4232e57fb 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "bump": "node ./scripts/binary.js bump", "check-deps": "node ./scripts/check-deps.js --verbose", "check-deps-pre": "node ./scripts/check-deps.js --verbose --prescript", + "check-next-dev-version": "node scripts/check-next-dev-version.js", "check-node-version": "node scripts/check-node-version.js", "check-terminal": "node scripts/check-terminal.js", "clean-deps": "npm run all clean-deps && rm -rf node_modules", diff --git a/scripts/check-next-dev-version.js b/scripts/check-next-dev-version.js new file mode 100644 index 0000000000..189aac93c5 --- /dev/null +++ b/scripts/check-next-dev-version.js @@ -0,0 +1,14 @@ +/* eslint-disable no-console */ +if (!process.env.NEXT_DEV_VERSION) { + console.log('NEXT_DEV_VERSION is not set') + process.exit(0) +} + +const currentVersion = require('../package.json').version + +if (currentVersion === process.env.NEXT_DEV_VERSION) { + console.warn('⚠️ NEXT_DEV_VERSION is set to the same value as current package.json version "%s"', currentVersion) + process.exit(0) +} + +console.log('NEXT_DEV_VERSION is different from the current package version "%s"', currentVersion)