Skip to content

Commit 96242d8

Browse files
committed
Warn if changes to package.json and not yarn.lock
Taken from jestjs/jest#2508 This would have applied to #101
1 parent 8ca6537 commit 96242d8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

dangerfile.js

+9
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@ if (!hasChangelog && !isTrivial) {
1414
warn("Please add your GitHub name to the changelog entry, so we can attribute you.")
1515
}
1616
}
17+
18+
// Warns if there are changes to package.json without changes to yarn.lock.
19+
const packageChanged = includes(danger.git.modified_files, "package.json");
20+
const lockfileChanged = includes(danger.git.modified_files, "yarn.lock");
21+
if (packageChanged && !lockfileChanged) {
22+
const message = "Changes were made to package.json, but not to yarn.lock";
23+
const idea = "Perhaps you need to run `yarn install`?";
24+
warn(`${message} - <i>${idea}</i>`);
25+
}

0 commit comments

Comments
 (0)