Skip to content

Commit b884ec2

Browse files
authored
Merge pull request #211 from drubin/version-check-ci
add version check to ci
2 parents fd722ce + e3f423e commit b884ec2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ node_js:
33
- "8"
44
- "10"
55

6+
before_install:
7+
# Pre check to check that version matches package-lock.json
8+
# needs to happen before npm install
9+
- node version-check.js
10+
611
install:
712
- 'npm install'
813
script:

version-check.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This script is supposed to be run in travis to check package version matches
2+
// because of this it is designed to be run on a "clean" git checkout
3+
// this will fail if run after npm install (since npm install updates package-lock)
4+
const packageVersion = require('./package.json').version
5+
const lockVersion = require('./package-lock.json').version
6+
if (packageVersion != lockVersion) {
7+
console.log(`version in package.json (${packageVersion}) does not match package-lock.json (${lockVersion})`);
8+
process.exit(1);
9+
}

0 commit comments

Comments
 (0)