Skip to content

Commit

Permalink
add version check to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
drubin committed Mar 8, 2019
1 parent cc5cbf8 commit e3f423e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ node_js:
- "8"
- "10"

before_install:
# Pre check to check that version matches package-lock.json
# needs to happen before npm install
- node version-check.js

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

0 comments on commit e3f423e

Please sign in to comment.