Skip to content

Commit 1038c80

Browse files
committed
check next dev version from node script
1 parent c380339 commit 1038c80

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ install:
5353
- node --version
5454
- node --print process.arch
5555
- npm --version
56+
- npm run check-next-dev-version
5657
# prints all public variables relevant to the build
5758
- print-env Platform
5859
- npm run check-node-version

circle.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -714,19 +714,7 @@ jobs:
714714
steps:
715715
- attach_workspace:
716716
at: ~/
717-
- run:
718-
name: show current NPM package version
719-
command: grep \"version\" package.json
720-
- run:
721-
name: show next NPM package version to build
722-
command: |
723-
set -e
724-
if [ -z "$NEXT_DEV_VERSION" ]; then
725-
echo "env variable NEXT_DEV_VERSION is not set";
726-
else
727-
echo "env variable NEXT_DEV_VERSION is set to '$NEXT_DEV_VERSION'";
728-
fi
729-
echo "Generally next dev version should be different from the current version"
717+
- run: npm run check-next-dev-version
730718
- run:
731719
name: bump NPM version
732720
command: npm --no-git-tag-version --allow-same-version version ${NEXT_DEV_VERSION:-0.0.0-development}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"bump": "node ./scripts/binary.js bump",
1818
"check-deps": "node ./scripts/check-deps.js --verbose",
1919
"check-deps-pre": "node ./scripts/check-deps.js --verbose --prescript",
20+
"check-next-dev-version": "node scripts/check-next-dev-version.js",
2021
"check-node-version": "node scripts/check-node-version.js",
2122
"check-terminal": "node scripts/check-terminal.js",
2223
"clean-deps": "npm run all clean-deps && rm -rf node_modules",

scripts/check-next-dev-version.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* eslint-disable no-console */
2+
if (!process.env.NEXT_DEV_VERSION) {
3+
console.log('NEXT_DEV_VERSION is not set')
4+
process.exit(0)
5+
}
6+
7+
const currentVersion = require('../package.json').version
8+
9+
if (currentVersion === process.env.NEXT_DEV_VERSION) {
10+
console.warn('⚠️ NEXT_DEV_VERSION is set to the same value as current package.json version')
11+
process.exit(0)
12+
}
13+
14+
console.log('NEXT_DEV_VERSION is different from the current package version "%s"', currentVersion)

0 commit comments

Comments
 (0)