Skip to content

Commit

Permalink
Chore: Warn on PR with lock file changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sapegin committed Nov 24, 2017
1 parent 04989d3 commit 49da1c4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ import { danger, warn } from 'danger';

const packageChanged = danger.git.modified_files.includes('package.json');
const lockfileChanged = danger.git.modified_files.includes('package-lock.json');

if (packageChanged && !lockfileChanged) {
warn(`Changes were made to package.json, but not to package-lock.json.
warn(`Changes were made to \`package.json\`, but not to \`package-lock.json\`.
Perhaps you need to run \`npm install\` and commit changes in package-lock.json. Make sure you’re using npm 5+.`);
}

if (!packageChanged && lockfileChanged) {
warn(`Changes were made to \`package-lock.json\`, but not to \`package.json\`.
Perhaps you need to run \`npm install\` and commit changes in package-lock.json.. Make sure you’re using npm 5+.`);
Please remove \`package-lock.json\` changes from your pull request. Try to run \`git checkout master -- package-lock.json\` and commit changes.`);
}

0 comments on commit 49da1c4

Please sign in to comment.