-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Add node scripts/yarn_deduplicate check (#169165)
- Adds an entrypoint, `node scripts/yarn_deduplicate` for fixing duplicated packages via npm package `yarn-deduplicate` - Fixes existing duplicated packages - Adds a CI check verifying no duplicated packages have been added. There are currently two exclusions - all types packages which causes other checks to break, and axe-core, which does not follow semver. Closes #125712
- Loading branch information
Showing
6 changed files
with
131 additions
and
495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
source .buildkite/scripts/common/util.sh | ||
|
||
echo "--- Check yarn.lock for duplicated modules" | ||
node scripts/yarn_deduplicate | ||
|
||
check_for_changed_files 'node scripts/yarn_deduplicate && yarn kbn bootstrap' false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
require('../src/setup_node_env'); | ||
require('../src/dev/yarn_deduplicate'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { resolve } from 'path'; | ||
import { writeFileSync, readFileSync } from 'fs'; | ||
import { fixDuplicates } from 'yarn-deduplicate'; | ||
import { REPO_ROOT } from '@kbn/repo-info'; | ||
|
||
const yarnLockFile = resolve(REPO_ROOT, 'yarn.lock'); | ||
const yarnLock = readFileSync(yarnLockFile, 'utf-8'); | ||
const output = fixDuplicates(yarnLock, { | ||
useMostCommon: false, | ||
excludeScopes: ['@types'], | ||
excludePackages: ['axe-core', '@babel/types'], | ||
}); | ||
|
||
writeFileSync(yarnLockFile, output); |
Oops, something went wrong.