yarn-berry-deduplicate 2.0.0 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS.md +30 -0
- package/CHANGELOG.md +211 -22
- package/CODE_OF_CONDUCT.md +35 -18
- package/LICENSE.md +160 -0
- package/README.md +113 -66
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +95 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +162 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -24
- package/.eslintrc.js +0 -17
- package/.prettierrc.js +0 -10
- package/AUTHORS +0 -22
- package/LICENSE.txt +0 -202
- package/cli.js +0 -87
- package/index.js +0 -225
package/README.md
CHANGED
|
@@ -1,29 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
# Yarn deduplicate
|
|
1
|
+
# yarn-deduplicate
|
|
4
2
|
|
|
5
3
|
Cleans up `yarn.lock` by removing duplicates.
|
|
6
4
|
|
|
5
|
+
Builds:
|
|
6
|
+
[](https://github.com/scinos/yarn-deduplicate/actions/workflows/node.js.yml)
|
|
7
|
+
|
|
8
|
+
This package only works with Yarn v1. Yarn v2 supports package deduplication
|
|
9
|
+
[natively](https://github.com/yarnpkg/berry/pull/1558)!
|
|
10
|
+
|
|
7
11
|
A duplicate package is when two dependencies are resolved to a different version, even when a single
|
|
8
|
-
version matches the range specified in the dependencies. See the
|
|
9
|
-
strategies](#deduplication-strategies) section for a few examples.
|
|
12
|
+
version matches the range specified in the dependencies. See the
|
|
13
|
+
[Deduplication strategies](#deduplication-strategies) section for a few examples.
|
|
10
14
|
|
|
11
15
|
## Installation
|
|
12
16
|
|
|
13
17
|
Install the package globally:
|
|
14
18
|
|
|
15
|
-
```
|
|
19
|
+
```sh
|
|
16
20
|
npm install -g yarn-deduplicate
|
|
17
21
|
```
|
|
18
22
|
|
|
19
23
|
or
|
|
20
24
|
|
|
21
|
-
```
|
|
25
|
+
```sh
|
|
22
26
|
yarn global add yarn-deduplicate
|
|
23
27
|
```
|
|
24
28
|
|
|
25
|
-
This package also works wth
|
|
26
|
-
so you
|
|
29
|
+
This package also works wth
|
|
30
|
+
[npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b), so you
|
|
31
|
+
don't need to install it. For example, to recreate the most common scenario below with `npx`, run:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npx yarn-deduplicate yarn.lock
|
|
35
|
+
```
|
|
27
36
|
|
|
28
37
|
---
|
|
29
38
|
|
|
@@ -31,7 +40,7 @@ so you don't need to install it.
|
|
|
31
40
|
|
|
32
41
|
The most common scenario is to run
|
|
33
42
|
|
|
34
|
-
```
|
|
43
|
+
```sh
|
|
35
44
|
yarn-deduplicate yarn.lock
|
|
36
45
|
```
|
|
37
46
|
|
|
@@ -41,7 +50,7 @@ If you do not specify the yarn.lock path, it defaults to `yarn.lock`.
|
|
|
41
50
|
|
|
42
51
|
Check all available options with:
|
|
43
52
|
|
|
44
|
-
```
|
|
53
|
+
```sh
|
|
45
54
|
yarn-deduplicate --help
|
|
46
55
|
```
|
|
47
56
|
|
|
@@ -77,7 +86,7 @@ https://classic.yarnpkg.com/en/docs/cli/dedupe/, it says
|
|
|
77
86
|
|
|
78
87
|
> The dedupe command isn’t necessary. `yarn install` will already dedupe.
|
|
79
88
|
|
|
80
|
-
This is, however, not exactly true. There are cases where yarn will
|
|
89
|
+
This is, however, not exactly true. There are cases where yarn will _not_ deduplicate existing
|
|
81
90
|
packages. For example, this scenario:
|
|
82
91
|
|
|
83
92
|
- Install `libA`. It depends on `libB ^1.1.0`. At this point, the latest version of `libB` is
|
|
@@ -89,48 +98,49 @@ packages. For example, this scenario:
|
|
|
89
98
|
In the above scenario, you'll end up with `libB@1.1.2` and `libB@1.1.3` in your repo.
|
|
90
99
|
|
|
91
100
|
Find more examples in:
|
|
101
|
+
|
|
92
102
|
- [yarn-deduplicate — The Hero We Need](https://medium.com/@bnaya/yarn-deduplicate-the-hero-we-need-f4497a362128)
|
|
93
103
|
- [De-duplicating yarn.lock](https://medium.com/@scinos/de-duplicating-yarn-lock-ae30be4aa41a)
|
|
94
104
|
- https://github.com/yarnpkg/yarn/issues/3778
|
|
95
105
|
|
|
96
106
|
### Deduplication strategies
|
|
97
107
|
|
|
98
|
-
|
|
99
|
-
It will try to use the highest installed version. For example, with the following `yarn.lock`:
|
|
108
|
+
`--strategy <strategy>`
|
|
100
109
|
|
|
101
|
-
|
|
110
|
+
`highest` will try to use the highest installed version. For example, with the following
|
|
111
|
+
`yarn.lock`:
|
|
112
|
+
|
|
113
|
+
```text
|
|
102
114
|
library@^1.1.0:
|
|
103
|
-
|
|
115
|
+
version "1.2.0"
|
|
104
116
|
|
|
105
117
|
library@^1.2.0:
|
|
106
|
-
|
|
118
|
+
version "1.2.0"
|
|
107
119
|
|
|
108
120
|
library@^1.3.0:
|
|
109
|
-
|
|
121
|
+
version "1.3.0"
|
|
110
122
|
```
|
|
111
123
|
|
|
112
124
|
It will deduplicate `library@^1.1.0` and `library@^1.2.0` to `1.3.0`
|
|
113
125
|
|
|
114
|
-
`fewer`
|
|
115
|
-
|
|
116
|
-
that satisfies most of the ranges first. For example, with the following `yarn.lock`:
|
|
126
|
+
`fewer` will try to minimize the number of installed versions by trying to deduplicate to the
|
|
127
|
+
version that satisfies most of the ranges first. For example, with the following `yarn.lock`:
|
|
117
128
|
|
|
118
|
-
```
|
|
129
|
+
```text
|
|
119
130
|
library@*:
|
|
120
|
-
|
|
131
|
+
version "2.0.0"
|
|
121
132
|
|
|
122
133
|
library@>=1.1.0:
|
|
123
|
-
|
|
134
|
+
version "3.0.0"
|
|
124
135
|
|
|
125
136
|
library@^1.2.0:
|
|
126
|
-
|
|
137
|
+
version "1.2.0"
|
|
127
138
|
```
|
|
128
139
|
|
|
129
140
|
It will deduplicate `library@*` and `library@>=1.1.0` to `1.2.0`.
|
|
130
141
|
|
|
131
|
-
Note that this
|
|
132
|
-
|
|
133
|
-
strategy.
|
|
142
|
+
Note that this may cause some packages to be **downgraded**. Be sure to check the changelogs between
|
|
143
|
+
all versions and understand the consequences of that downgrade. If unsure, don't use this strategy.
|
|
134
144
|
|
|
135
145
|
It is not recommended to use different strategies for different packages. There is no guarantee that
|
|
136
146
|
the strategy will be honored in subsequent runs of `yarn-deduplicate` unless the same set of flags
|
|
@@ -141,14 +151,78 @@ is specified again.
|
|
|
141
151
|
`--packages <package1> <package2> <packageN>`
|
|
142
152
|
|
|
143
153
|
Receives a list of packages to deduplicate. It will ignore any other duplicated package not in the
|
|
144
|
-
list. This option is recommended when the number of duplicated packages in `yarn.lock` is too big
|
|
145
|
-
|
|
146
|
-
|
|
154
|
+
list. This option is recommended when the number of duplicated packages in `yarn.lock` is too big to
|
|
155
|
+
be easily reviewed by a human. This will allow for a more controlled and progressive deduplication
|
|
156
|
+
of `yarn.lock`.
|
|
157
|
+
|
|
158
|
+
`--scopes <scope1> <scope2> <scopeN>`
|
|
159
|
+
|
|
160
|
+
Receives a list of scopes to deduplicate. It will ignore any other duplicated package not in the
|
|
161
|
+
list. This option is recommended when deduplicating a large number of inter-dependent packages from
|
|
162
|
+
a single scope, such as @babel. This will allow for a more controlled and progressive deduplication
|
|
163
|
+
of `yarn.lock` without specifying each package individually.
|
|
164
|
+
|
|
165
|
+
### Excluding packages
|
|
166
|
+
|
|
167
|
+
`--exclude <package1> <package2> <packageN`
|
|
168
|
+
|
|
169
|
+
`--exclude-scopes <scope1> <scope2> <scopeN>`
|
|
170
|
+
|
|
171
|
+
With these commands you can exclude certain packages/scopes from the deduplication process. This is
|
|
172
|
+
specially useful if you want to apply a different strategy for a scope, for example.
|
|
173
|
+
|
|
174
|
+
### Pre-release versions
|
|
175
|
+
|
|
176
|
+
By default, `yarn-deduplicate` will only match pre-release versions if they share they share the
|
|
177
|
+
same `major`, `minor` and `patch` versions (example: `^1.2.3-alpha.1` and `1.2.3-alpha.2` can be
|
|
178
|
+
deduplicated, but `^1.2.3` and `1.2.4-alpha.1` can't). This matches the behaviour of
|
|
179
|
+
[semver](https://docs.npmjs.com/misc/semver#prerelease-tags).
|
|
180
|
+
|
|
181
|
+
To change this behaviour you can use the flag `--includePrerelease`. This will treat all pre-release
|
|
182
|
+
versionas as if they were normal versions (`^1.2.3` and `1.2.4-alpha.1` can be deduplicated).
|
|
183
|
+
|
|
184
|
+
### Usage in CI
|
|
185
|
+
|
|
186
|
+
This tool can be used as part of a CI workflow. Adding the flag `--fail` will force the process to
|
|
187
|
+
exit with status 1 if there are duplicated packages. Example:
|
|
188
|
+
|
|
189
|
+
```sh
|
|
190
|
+
# Print the list of duplicated packages and exit with status 1
|
|
191
|
+
yarn-deduplicate --list --fail
|
|
192
|
+
|
|
193
|
+
# Deduplicate yarn.lock and exit with status 1 if changes were required
|
|
194
|
+
yarn-deduplicate --fail
|
|
195
|
+
```
|
|
147
196
|
|
|
148
197
|
---
|
|
149
198
|
|
|
150
199
|
## Migration guide
|
|
151
200
|
|
|
201
|
+
### From 2.x to 3.x
|
|
202
|
+
|
|
203
|
+
In this version we have adopted variadic arguments from commander.js. These are the equivalent
|
|
204
|
+
commands:
|
|
205
|
+
|
|
206
|
+
```sh
|
|
207
|
+
#Old
|
|
208
|
+
yarn-deduplicate --packages libA,libB
|
|
209
|
+
yarn-deduplicate --scopes @scopeA,@scopeB
|
|
210
|
+
yarn-deduplicate --exclude libA,libB
|
|
211
|
+
|
|
212
|
+
#New
|
|
213
|
+
yarn-deduplicate --packages libA libB
|
|
214
|
+
yarn-deduplicate --scopes @scopeA @scopeB
|
|
215
|
+
yarn-deduplicate --exclude libA libB
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
A consequence of this change is that if you were using one or more of the affected options (
|
|
219
|
+
`--packages`, `--scopes` or `--exclude`) **and** a custom path for `yarn.lock`, you need to use `--`
|
|
220
|
+
to "stop" package/scope/exclude parsing:
|
|
221
|
+
|
|
222
|
+
```sh
|
|
223
|
+
yarn-deduplicate --packages libA libB -- path/to/yarn.lock
|
|
224
|
+
```
|
|
225
|
+
|
|
152
226
|
### From 0.x to 1.x
|
|
153
227
|
|
|
154
228
|
In this version we have renamed the project and refactored the CLI. These are the equivalent
|
|
@@ -156,7 +230,7 @@ commands:
|
|
|
156
230
|
|
|
157
231
|
#### Installation
|
|
158
232
|
|
|
159
|
-
```
|
|
233
|
+
```sh
|
|
160
234
|
# Old
|
|
161
235
|
npm install -g yarn-tools
|
|
162
236
|
|
|
@@ -166,7 +240,7 @@ npm install -g yarn-deduplicate
|
|
|
166
240
|
|
|
167
241
|
#### List duplicates
|
|
168
242
|
|
|
169
|
-
```
|
|
243
|
+
```sh
|
|
170
244
|
# Old
|
|
171
245
|
yarn-tools list-duplicates path/to/yarn.lock
|
|
172
246
|
|
|
@@ -175,7 +249,8 @@ yarn-deduplicate --list path/to/yarn.lock
|
|
|
175
249
|
```
|
|
176
250
|
|
|
177
251
|
### Deduplicate yarn.lock
|
|
178
|
-
|
|
252
|
+
|
|
253
|
+
```sh
|
|
179
254
|
# Old
|
|
180
255
|
yarn-tools fix-duplicates path/to/yarn.lock > tmp
|
|
181
256
|
mv tmp path/to/yarn.lock
|
|
@@ -184,9 +259,9 @@ mv tmp path/to/yarn.lock
|
|
|
184
259
|
yarn-deduplicate path/to/yarn.lock
|
|
185
260
|
```
|
|
186
261
|
|
|
187
|
-
|
|
188
262
|
### Limit packages to deduplicate yarn.lock
|
|
189
|
-
|
|
263
|
+
|
|
264
|
+
```sh
|
|
190
265
|
# Old
|
|
191
266
|
yarn-tools fix-duplicates path/to/yarn.lock package1 package2
|
|
192
267
|
|
|
@@ -195,35 +270,7 @@ yarn-tools fix-duplicates path/to/yarn.lock package1 package2
|
|
|
195
270
|
yarn-deduplicate --packages package1,package2 path/to/yarn.lock
|
|
196
271
|
```
|
|
197
272
|
|
|
198
|
-
|
|
199
|
-
## Contributors
|
|
200
|
-
|
|
201
|
-
Pull requests, issues and comments welcome. For pull requests:
|
|
202
|
-
|
|
203
|
-
* Add tests for new features and bug fixes
|
|
204
|
-
* Follow the existing style
|
|
205
|
-
* Separate unrelated changes into multiple pull requests
|
|
206
|
-
|
|
207
|
-
See the existing issues for things to start contributing.
|
|
208
|
-
|
|
209
|
-
For bigger changes, make sure you start a discussion first by creating
|
|
210
|
-
an issue and explaining the intended change.
|
|
211
|
-
|
|
212
|
-
Atlassian requires contributors to sign a Contributor License Agreement,
|
|
213
|
-
known as a CLA. This serves as a record stating that the contributor is
|
|
214
|
-
entitled to contribute the code/documentation/translation to the project
|
|
215
|
-
and is willing to have it used in distributions and derivative works
|
|
216
|
-
(or is willing to transfer ownership).
|
|
217
|
-
|
|
218
|
-
Prior to accepting your contributions we ask that you please follow the appropriate
|
|
219
|
-
link below to digitally sign the CLA. The Corporate CLA is for those who are
|
|
220
|
-
contributing as a member of an organization and the individual CLA is for
|
|
221
|
-
those contributing as an individual.
|
|
222
|
-
|
|
223
|
-
* [CLA for corporate contributors](https://na2.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=e1c17c66-ca4d-4aab-a953-2c231af4a20b)
|
|
224
|
-
* [CLA for individuals](https://na2.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=3f94fbdc-2fbe-46ac-b14c-5d152700ae5d)
|
|
225
|
-
|
|
226
273
|
## License
|
|
227
274
|
|
|
228
|
-
Copyright (c)
|
|
229
|
-
|
|
275
|
+
Copyright (c) 2022 Sergio Cinos and others. Apache 2.0 licensed, see [LICENSE.txt](LICENSE.txt)
|
|
276
|
+
file.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const commander_1 = require("commander");
|
|
6
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
|
+
const index_js_1 = require("./index.js");
|
|
8
|
+
const version = require('../package.json').version;
|
|
9
|
+
const FAIL_MESSAGE = '\nFound duplicated entries. Run yarn-deduplicate to deduplicate them.';
|
|
10
|
+
commander_1.program
|
|
11
|
+
.version(version)
|
|
12
|
+
.usage('[options] [yarn.lock path (default: yarn.lock)]')
|
|
13
|
+
.option('-s, --strategy <strategy>', 'deduplication strategy. Valid values: fewer, highest, both. Default is "both"', 'both')
|
|
14
|
+
.option('-l, --list', 'do not change yarn.lock, just output the diagnosis')
|
|
15
|
+
.option('-f, --fail', 'if there are duplicates in yarn.lock, terminate the script with exit status 1')
|
|
16
|
+
.option('--scopes <scopes...>', 'a list of scopes to deduplicate. Defaults to all packages.')
|
|
17
|
+
.option('--packages <packages...>', 'a list of packages to deduplicate. Defaults to all packages.')
|
|
18
|
+
.option('--exclude <exclude...>', 'a list of packages not to deduplicate.')
|
|
19
|
+
.option('--exclude-scopes <excluded scopes...>', 'a list of scopes not to deduplicate.')
|
|
20
|
+
.option('--print', 'instead of saving the deduplicated yarn.lock, print the result in stdout')
|
|
21
|
+
.option('--includePrerelease', 'Include prereleases in version comparisons, e.g. ^1.0.0 will be satisfied by 1.0.1-alpha');
|
|
22
|
+
commander_1.program.parse(process.argv);
|
|
23
|
+
const { strategy, scopes, packages, exclude, excludeScopes, list, fail, includePrerelease, print, noStats, } = commander_1.program.opts();
|
|
24
|
+
const file = commander_1.program.args.length ? commander_1.program.args[0] : 'yarn.lock';
|
|
25
|
+
if (scopes && packages) {
|
|
26
|
+
console.error('Please specify either scopes or packages, not both.');
|
|
27
|
+
commander_1.program.help();
|
|
28
|
+
}
|
|
29
|
+
if (strategy !== 'highest' && strategy !== 'fewer' && strategy !== 'both') {
|
|
30
|
+
console.error(`Invalid strategy ${strategy}`);
|
|
31
|
+
commander_1.program.help();
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const yarnLock = fs_1.default.readFileSync(file, 'utf8');
|
|
35
|
+
const useMostCommon = strategy === 'fewer';
|
|
36
|
+
if (list) {
|
|
37
|
+
if (strategy !== 'highest' && strategy !== 'fewer') {
|
|
38
|
+
console.error(`Invalid strategy ${strategy}`);
|
|
39
|
+
commander_1.program.help();
|
|
40
|
+
}
|
|
41
|
+
const duplicates = (0, index_js_1.listDuplicates)(yarnLock, {
|
|
42
|
+
useMostCommon,
|
|
43
|
+
includeScopes: scopes,
|
|
44
|
+
includePackages: packages,
|
|
45
|
+
excludePackages: exclude,
|
|
46
|
+
excludeScopes: excludeScopes,
|
|
47
|
+
includePrerelease: includePrerelease,
|
|
48
|
+
});
|
|
49
|
+
duplicates.forEach((logLine) => console.log(logLine));
|
|
50
|
+
if (fail && duplicates.length > 0) {
|
|
51
|
+
console.error(FAIL_MESSAGE);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
let dedupedYarnLock = (0, index_js_1.fixDuplicates)(yarnLock, {
|
|
57
|
+
useMostCommon,
|
|
58
|
+
includeScopes: scopes,
|
|
59
|
+
includePackages: packages,
|
|
60
|
+
excludePackages: exclude,
|
|
61
|
+
excludeScopes: excludeScopes,
|
|
62
|
+
includePrerelease: includePrerelease,
|
|
63
|
+
});
|
|
64
|
+
if (strategy === 'both') {
|
|
65
|
+
dedupedYarnLock = (0, index_js_1.fixDuplicates)(yarnLock, {
|
|
66
|
+
useMostCommon: false,
|
|
67
|
+
includeScopes: scopes,
|
|
68
|
+
includePackages: packages,
|
|
69
|
+
excludePackages: exclude,
|
|
70
|
+
excludeScopes: excludeScopes,
|
|
71
|
+
includePrerelease: includePrerelease,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (print) {
|
|
75
|
+
console.log(dedupedYarnLock);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const eolMatch = yarnLock.match(/(\r?\n)/);
|
|
79
|
+
if (eolMatch && eolMatch[0] === '\r\n') {
|
|
80
|
+
dedupedYarnLock = dedupedYarnLock.replace(/\n/g, '\r\n');
|
|
81
|
+
}
|
|
82
|
+
fs_1.default.writeFileSync(file, dedupedYarnLock);
|
|
83
|
+
}
|
|
84
|
+
if (fail && yarnLock !== dedupedYarnLock) {
|
|
85
|
+
console.error(FAIL_MESSAGE);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
process.exit(0);
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
console.error(e);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;AAEA,yCAAoC;AACpC,oDAAoB;AAEpB,yCAA2D;AAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC;AAEnD,MAAM,YAAY,GAAG,uEAAuE,CAAC;AAE7F,mBAAO;KACF,OAAO,CAAC,OAAO,CAAC;KAChB,KAAK,CAAC,iDAAiD,CAAC;KACxD,MAAM,CACH,2BAA2B,EAC3B,+EAA+E,EAC/E,MAAM,CACT;KACA,MAAM,CAAC,YAAY,EAAE,oDAAoD,CAAC;KAC1E,MAAM,CACH,YAAY,EACZ,+EAA+E,CAClF;KACA,MAAM,CAAC,sBAAsB,EAAE,4DAA4D,CAAC;KAC5F,MAAM,CACH,0BAA0B,EAC1B,8DAA8D,CACjE;KACA,MAAM,CAAC,wBAAwB,EAAE,wCAAwC,CAAC;KAC1E,MAAM,CAAC,uCAAuC,EAAE,sCAAsC,CAAC;KACvF,MAAM,CAAC,SAAS,EAAE,0EAA0E,CAAC;KAC7F,MAAM,CACH,qBAA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C,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACnB;KACJ;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACnB;AAAC,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACnB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Descriptor } from '@yarnpkg/core';
|
|
2
|
+
type YarnEntry = {
|
|
3
|
+
version: string;
|
|
4
|
+
resolution: string;
|
|
5
|
+
dependencies?: Record<string, string>;
|
|
6
|
+
checksum?: string;
|
|
7
|
+
languageName?: 'node';
|
|
8
|
+
linkType?: 'hard' | 'soft';
|
|
9
|
+
};
|
|
10
|
+
type Packages = Record<string, Package[]>;
|
|
11
|
+
type Package = {
|
|
12
|
+
installedVersion: string;
|
|
13
|
+
packageKey: string;
|
|
14
|
+
packageName: string;
|
|
15
|
+
pkg: YarnEntry;
|
|
16
|
+
ignored: boolean;
|
|
17
|
+
descriptorString: string;
|
|
18
|
+
descriptor: Descriptor;
|
|
19
|
+
satisfiedBy: Set<string>;
|
|
20
|
+
candidateVersions?: string[];
|
|
21
|
+
requestedProtocol: string;
|
|
22
|
+
requestedVersion: string;
|
|
23
|
+
bestVersion?: string;
|
|
24
|
+
versions: Versions;
|
|
25
|
+
};
|
|
26
|
+
type Version = {
|
|
27
|
+
pkg: YarnEntry;
|
|
28
|
+
satisfies: Set<Package>;
|
|
29
|
+
};
|
|
30
|
+
type Versions = Map<string, Version>;
|
|
31
|
+
type Options = {
|
|
32
|
+
includeScopes?: string[];
|
|
33
|
+
includePackages?: string[];
|
|
34
|
+
excludePackages?: string[];
|
|
35
|
+
excludeScopes?: string[];
|
|
36
|
+
useMostCommon?: boolean;
|
|
37
|
+
includePrerelease?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export declare const getBest: (packages: Packages, options?: Options) => Package[];
|
|
40
|
+
export declare const getDuplicates: (packages: Packages, options?: Options) => Package[];
|
|
41
|
+
export declare const listDuplicates: (yarnLock: string, options?: Options) => string[];
|
|
42
|
+
export declare const fixDuplicates: (yarnLock: string, options?: Options) => string;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAe,MAAM,eAAe,CAAC;AAIxD,KAAK,SAAS,GAAG;IACb,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC7B,CAAA;AAID,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AAE1C,KAAK,OAAO,GAAG;IACX,gBAAgB,EAAC,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,SAAS,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAA;CACrB,CAAA;AAED,KAAK,OAAO,GAAG;IACX,GAAG,EAAE,SAAS,CAAC;IACf,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CAC1B,CAAA;AAED,KAAK,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErC,KAAK,OAAO,GAAG;IACX,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAA;AAyID,eAAO,MAAM,OAAO,aACN,QAAQ,YACT,OAAO,KACjB,OAAO,EAUT,CAAC;AAEF,eAAO,MAAM,aAAa,aACZ,QAAQ,YACT,OAAO,KACjB,OAAO,EAGT,CAAC;AAEF,eAAO,MAAM,cAAc,aAAa,MAAM,YAAW,OAAO,KAAQ,MAAM,EAS7E,CAAC;AAOF,eAAO,MAAM,aAAa,aAAe,MAAM,YAAW,OAAO,WAyBhE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fixDuplicates = exports.listDuplicates = exports.getDuplicates = exports.getBest = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@yarnpkg/core");
|
|
6
|
+
const yarnParsers = tslib_1.__importStar(require("@yarnpkg/parsers"));
|
|
7
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
8
|
+
const parseYarnLock = (file) => yarnParsers.parseSyml(file);
|
|
9
|
+
const extractPackages = (yarnEntries, { includeScopes = [], includePackages = [], excludePackages = [], excludeScopes = [], } = {}) => {
|
|
10
|
+
const packages = {};
|
|
11
|
+
const re = /^(?:([^:]*):)?([^@]*?)$/;
|
|
12
|
+
for (const [entryName, entry] of Object.entries(yarnEntries)) {
|
|
13
|
+
if (entryName === '__metadata')
|
|
14
|
+
continue;
|
|
15
|
+
for (const descriptorString of entryName.split(', ')) {
|
|
16
|
+
const descriptor = core_1.structUtils.parseDescriptor(descriptorString);
|
|
17
|
+
const [, requestedProtocol, requestedVersion] = descriptor.range.match(re) || [];
|
|
18
|
+
const packageName = core_1.structUtils.stringifyIdent(descriptor);
|
|
19
|
+
let ignored = requestedProtocol !== 'npm' || entry.linkType !== 'hard';
|
|
20
|
+
// If there is a list of scopes, only process those.
|
|
21
|
+
if (includeScopes.length > 0 &&
|
|
22
|
+
!includeScopes.find((scope) => packageName.startsWith(`${scope}/`))) {
|
|
23
|
+
ignored = true;
|
|
24
|
+
}
|
|
25
|
+
else if (excludeScopes.length > 0 &&
|
|
26
|
+
excludeScopes.find((scope) => packageName.startsWith(`${scope}/`))) {
|
|
27
|
+
ignored = true;
|
|
28
|
+
}
|
|
29
|
+
// If there is a list of package names, only process those.
|
|
30
|
+
else if (includePackages.length > 0 && !includePackages.includes(packageName)) {
|
|
31
|
+
ignored = true;
|
|
32
|
+
}
|
|
33
|
+
else if (excludePackages.length > 0 && excludePackages.includes(packageName)) {
|
|
34
|
+
ignored = true;
|
|
35
|
+
}
|
|
36
|
+
const packageKey = ignored ? entryName : packageName + '@' + requestedProtocol;
|
|
37
|
+
packages[packageKey] = packages[packageKey] || [];
|
|
38
|
+
packages[packageKey].push({
|
|
39
|
+
packageKey,
|
|
40
|
+
packageName,
|
|
41
|
+
pkg: entry,
|
|
42
|
+
descriptorString,
|
|
43
|
+
descriptor,
|
|
44
|
+
ignored,
|
|
45
|
+
requestedProtocol,
|
|
46
|
+
requestedVersion,
|
|
47
|
+
installedVersion: entry.version,
|
|
48
|
+
satisfiedBy: new Set(),
|
|
49
|
+
versions: new Map()
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
;
|
|
54
|
+
return packages;
|
|
55
|
+
};
|
|
56
|
+
const computePackageInstances = (packages, packageKey, { useMostCommon = false, includePrerelease = false, } = {}) => {
|
|
57
|
+
// Instances of this package in the tree
|
|
58
|
+
const packageInstances = packages[packageKey];
|
|
59
|
+
// Extract the list of unique versions for this package
|
|
60
|
+
const versions = new Map();
|
|
61
|
+
for (const packageInstance of packageInstances) {
|
|
62
|
+
if (packageInstance.ignored)
|
|
63
|
+
continue;
|
|
64
|
+
if (versions.has(packageInstance.installedVersion))
|
|
65
|
+
continue;
|
|
66
|
+
versions.set(packageInstance.installedVersion, {
|
|
67
|
+
pkg: packageInstance.pkg,
|
|
68
|
+
satisfies: new Set(),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
// Link each package instance with all the versions it could satisfy.
|
|
72
|
+
for (const [version, { satisfies }] of versions) {
|
|
73
|
+
packageInstances.forEach((packageInstance) => {
|
|
74
|
+
// We can assume that the installed version always satisfied the requested version.
|
|
75
|
+
packageInstance.satisfiedBy.add(packageInstance.installedVersion);
|
|
76
|
+
// In some cases the requested version is invalid form a semver point of view (for
|
|
77
|
+
// example `sinon@next`). Just ignore those cases, they won't get deduped.
|
|
78
|
+
if (semver_1.default.validRange(packageInstance.requestedVersion, { includePrerelease }) &&
|
|
79
|
+
semver_1.default.satisfies(version, packageInstance.requestedVersion, { includePrerelease })) {
|
|
80
|
+
satisfies.add(packageInstance);
|
|
81
|
+
packageInstance.satisfiedBy.add(version);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
;
|
|
86
|
+
// Sort the list of satisfied versions
|
|
87
|
+
packageInstances.forEach((packageInstance) => {
|
|
88
|
+
if (packageInstance.ignored) {
|
|
89
|
+
packageInstance.bestVersion = packageInstance.installedVersion;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// Save all versions for future reference
|
|
93
|
+
packageInstance.versions = versions;
|
|
94
|
+
// Compute the versions that actually satisfy this instance
|
|
95
|
+
packageInstance.candidateVersions = Array.from(packageInstance.satisfiedBy);
|
|
96
|
+
packageInstance.candidateVersions.sort((versionA, versionB) => {
|
|
97
|
+
if (useMostCommon) {
|
|
98
|
+
// Sort verions based on how many packages it satisfies. In case of a tie, put the
|
|
99
|
+
// highest version first.
|
|
100
|
+
const satisfiesA = versions.get(versionA).satisfies;
|
|
101
|
+
const satisfiesB = versions.get(versionB).satisfies;
|
|
102
|
+
if (satisfiesB.size > satisfiesA.size)
|
|
103
|
+
return 1;
|
|
104
|
+
if (satisfiesB.size < satisfiesA.size)
|
|
105
|
+
return -1;
|
|
106
|
+
}
|
|
107
|
+
return semver_1.default.rcompare(versionA, versionB);
|
|
108
|
+
});
|
|
109
|
+
// The best package is always the first one in the list thanks to the sorting above.
|
|
110
|
+
packageInstance.bestVersion = packageInstance.candidateVersions[0];
|
|
111
|
+
});
|
|
112
|
+
return packageInstances;
|
|
113
|
+
};
|
|
114
|
+
const getBest = (packages, options = {}) => {
|
|
115
|
+
return Object.keys(packages)
|
|
116
|
+
.reduce((acc, name) => acc.concat(computePackageInstances(packages, name, options)), []);
|
|
117
|
+
};
|
|
118
|
+
exports.getBest = getBest;
|
|
119
|
+
const getDuplicates = (packages, options = {}) => {
|
|
120
|
+
return (0, exports.getBest)(packages, options)
|
|
121
|
+
.filter(({ bestVersion, installedVersion }) => bestVersion !== installedVersion);
|
|
122
|
+
};
|
|
123
|
+
exports.getDuplicates = getDuplicates;
|
|
124
|
+
const listDuplicates = (yarnLock, options = {}) => {
|
|
125
|
+
const yarnEntries = parseYarnLock(yarnLock);
|
|
126
|
+
const packages = extractPackages(yarnEntries);
|
|
127
|
+
const duplicates = (0, exports.getDuplicates)(packages, options);
|
|
128
|
+
const result = duplicates.map(({ bestVersion, packageName, installedVersion, requestedVersion }) => {
|
|
129
|
+
return `Package "${packageName}" wants ${requestedVersion} and could get ${bestVersion}, but got ${installedVersion}`;
|
|
130
|
+
});
|
|
131
|
+
return result;
|
|
132
|
+
};
|
|
133
|
+
exports.listDuplicates = listDuplicates;
|
|
134
|
+
const yarnLockHeader = `${[
|
|
135
|
+
`# This file is generated by running "yarn install" inside your project.\n`,
|
|
136
|
+
`# Manual changes might be lost - proceed with caution!\n`,
|
|
137
|
+
].join(``)}\n`;
|
|
138
|
+
const fixDuplicates = (yarnLock, options = {}) => {
|
|
139
|
+
const yarnEntries = parseYarnLock(yarnLock);
|
|
140
|
+
const packages = extractPackages(yarnEntries);
|
|
141
|
+
const bestPackages = (0, exports.getBest)(packages, options);
|
|
142
|
+
const packageResolutions = {};
|
|
143
|
+
for (const bestPackage of bestPackages) {
|
|
144
|
+
const { descriptorString, bestVersion, requestedProtocol, installedVersion, pkg, descriptor, ignored, packageKey } = bestPackage;
|
|
145
|
+
const keyWithBestVersion = ignored ? packageKey : core_1.structUtils.stringifyDescriptor({
|
|
146
|
+
...descriptor,
|
|
147
|
+
range: requestedProtocol + ':' + bestVersion
|
|
148
|
+
});
|
|
149
|
+
packageResolutions[keyWithBestVersion] = packageResolutions[keyWithBestVersion] || { keys: [] };
|
|
150
|
+
packageResolutions[keyWithBestVersion].keys.push(descriptorString);
|
|
151
|
+
if (bestVersion === installedVersion)
|
|
152
|
+
packageResolutions[keyWithBestVersion].pkg = pkg;
|
|
153
|
+
}
|
|
154
|
+
const newYarnEntries = { __metadata: yarnEntries.__metadata };
|
|
155
|
+
for (const packageResolution of Object.values(packageResolutions)) {
|
|
156
|
+
const key = packageResolution.keys.join(', ');
|
|
157
|
+
newYarnEntries[key] = packageResolution.pkg;
|
|
158
|
+
}
|
|
159
|
+
return yarnLockHeader + yarnParsers.stringifySyml(newYarnEntries);
|
|
160
|
+
};
|
|
161
|
+
exports.fixDuplicates = fixDuplicates;
|
|
162
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,wCAAwD;AACxD,sEAAgD;A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