Commit 9e26728c authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '51226-check-yarn-lock' into 'master'

Add danger check for duplicate yarn dependencies

Closes #51226

See merge request gitlab-org/gitlab-ce!21591
parents 7a143215 8950e90a
......@@ -8,5 +8,6 @@ danger.import_dangerfile(path: 'danger/database')
danger.import_dangerfile(path: 'danger/documentation')
danger.import_dangerfile(path: 'danger/frozen_string')
danger.import_dangerfile(path: 'danger/commit_messages')
danger.import_dangerfile(path: 'danger/duplicate_yarn_dependencies')
danger.import_dangerfile(path: 'danger/prettier')
danger.import_dangerfile(path: 'danger/eslint')
# frozen_string_literal: true
return unless helper.all_changed_files.include? 'yarn.lock'
duplicate = `node_modules/.bin/yarn-deduplicate --list --strategy fewer yarn.lock`
.split(/$/)
.map(&:strip)
.reject(&:empty?)
return if duplicate.empty?
warn 'This merge request has introduced duplicated yarn dependencies.'
markdown(<<~MARKDOWN)
## Duplicate yarn dependencies
The following dependencies should be de-duplicated:
* #{duplicate.map { |path| "`#{path}`" }.join("\n* ")}
Please run the following command and commit the changes to `yarn.lock`:
```
node_modules/.bin/yarn-deduplicate --strategy fewer yarn.lock \\
&& yarn install
```
MARKDOWN
......@@ -158,7 +158,8 @@
"nodemon": "^1.18.4",
"prettier": "1.15.2",
"vue-jest": "^3.0.1",
"webpack-dev-server": "^3.1.10"
"webpack-dev-server": "^3.1.10",
"yarn-deduplicate": "^1.0.5"
},
"engines": {
"yarn": "^1.10.0"
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment