forked from vue-styleguidist/vue-styleguidist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdangerfile.js
35 lines (27 loc) · 1.29 KB
/
dangerfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// eslint-disable-next-line import/no-unresolved, import/extensions
import { danger, warn } from 'danger'
const packages = [
'package.json',
'packages/vue-styleguidist/package.json',
'packages/vue-docgen-api/package.json',
'packages/vue-cli-plugin-styleguidist/package.json'
]
const changePackages = packages.filter(f => {
danger.git.modified_files.includes(f)
})
const lockfileChanged = danger.git.modified_files.includes('yarn.lock')
if (!lockfileChanged && changePackages.length) {
if (changePackages.length === 1) {
warn(`Changes were made to \`${changePackages[0]}\`, but not to \`yarn.lock\`.
If you’ve changed any dependencies (added, removed or updated any packages), please run \`yarn install\` and commit changes in yarn.lock file.`)
} else {
warn(`Changes were made to all the following files \`${changePackages.join(
'`, `'
)}\`, but not to \`yarn.lock\`.
If you’ve changed any dependencies (added, removed or updated any packages), please run \`yarn install\` and commit changes in yarn.lock file.`)
}
}
if (changePackages.length > 0 && lockfileChanged) {
warn(`Changes were made to \`yarn.lock\`, but to no \`package.json\` file in the package.
Please remove \`yarn.lock\` changes from your pull request. Try to run \`git checkout master -- yarn.lock\` and commit changes.`)
}