Skip to content

add version check to ci #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}