yarn-berry-deduplicate 6.0.4 → 6.0.6
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/README.md +12 -116
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,59 +1,31 @@
|
|
|
1
|
-
# yarn-deduplicate
|
|
1
|
+
# yarn-berry-deduplicate
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
11
|
-
A duplicate package is when two dependencies are resolved to a different version, even when a single
|
|
12
|
-
version matches the range specified in the dependencies. See the
|
|
13
|
-
[Deduplication strategies](#deduplication-strategies) section for a few examples.
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
Install the package globally:
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
npm install -g yarn-deduplicate
|
|
21
|
-
```
|
|
3
|
+
*This is a fork of [yarn-deduplicate](https://www.npmjs.com/package/yarn-deduplicate) for yarn berry. *
|
|
22
4
|
|
|
23
|
-
|
|
5
|
+
Cleans up `yarn.lock` by removing duplicates.
|
|
24
6
|
|
|
25
|
-
|
|
26
|
-
yarn global add yarn-deduplicate
|
|
27
|
-
```
|
|
7
|
+
Yarn berry includes [`yarn dedupe`](https://yarnpkg.com/cli/dedupe) that currently only supports "highest" strategy. Follow this issue: https://github.com/yarnpkg/berry/issues/2297.
|
|
28
8
|
|
|
29
|
-
|
|
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
|
-
```
|
|
36
|
-
|
|
37
|
-
---
|
|
9
|
+
In the meantime, this is a fork of [yarn-deduplicate](https://www.npmjs.com/package/yarn-deduplicate) that works with both highest and fewer strategies.
|
|
38
10
|
|
|
39
11
|
## Usage
|
|
40
12
|
|
|
41
|
-
The most common scenario is to run
|
|
42
|
-
|
|
43
13
|
```sh
|
|
44
|
-
yarn-deduplicate
|
|
14
|
+
yarn dlx yarn-berry-deduplicate
|
|
45
15
|
```
|
|
46
16
|
|
|
47
|
-
This will use the
|
|
17
|
+
This will use the fewest then highest strategy to remove duplicated packages in `yarn.lock`.
|
|
48
18
|
|
|
49
19
|
If you do not specify the yarn.lock path, it defaults to `yarn.lock`.
|
|
50
20
|
|
|
51
21
|
Check all available options with:
|
|
52
22
|
|
|
53
23
|
```sh
|
|
54
|
-
yarn-deduplicate --help
|
|
24
|
+
yarn dlx yarn-berry-deduplicate --help
|
|
55
25
|
```
|
|
56
26
|
|
|
27
|
+
Note: you can apply multiple times deduplication and each time dedupe more. To prevent issues, try running `yarn dedupe` after each `yarn-berry-deduplicate`.
|
|
28
|
+
|
|
57
29
|
---
|
|
58
30
|
|
|
59
31
|
## Duplicated packages
|
|
@@ -188,86 +160,10 @@ exit with status 1 if there are duplicated packages. Example:
|
|
|
188
160
|
|
|
189
161
|
```sh
|
|
190
162
|
# Print the list of duplicated packages and exit with status 1
|
|
191
|
-
yarn-deduplicate --list --fail
|
|
163
|
+
yarn dlx yarn-berry-deduplicate --list --fail
|
|
192
164
|
|
|
193
165
|
# Deduplicate yarn.lock and exit with status 1 if changes were required
|
|
194
|
-
yarn-deduplicate --fail
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## Migration guide
|
|
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
|
-
|
|
226
|
-
### From 0.x to 1.x
|
|
227
|
-
|
|
228
|
-
In this version we have renamed the project and refactored the CLI. These are the equivalent
|
|
229
|
-
commands:
|
|
230
|
-
|
|
231
|
-
#### Installation
|
|
232
|
-
|
|
233
|
-
```sh
|
|
234
|
-
# Old
|
|
235
|
-
npm install -g yarn-tools
|
|
236
|
-
|
|
237
|
-
# New
|
|
238
|
-
npm install -g yarn-deduplicate
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
#### List duplicates
|
|
242
|
-
|
|
243
|
-
```sh
|
|
244
|
-
# Old
|
|
245
|
-
yarn-tools list-duplicates path/to/yarn.lock
|
|
246
|
-
|
|
247
|
-
# New
|
|
248
|
-
yarn-deduplicate --list path/to/yarn.lock
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Deduplicate yarn.lock
|
|
252
|
-
|
|
253
|
-
```sh
|
|
254
|
-
# Old
|
|
255
|
-
yarn-tools fix-duplicates path/to/yarn.lock > tmp
|
|
256
|
-
mv tmp path/to/yarn.lock
|
|
257
|
-
|
|
258
|
-
# New
|
|
259
|
-
yarn-deduplicate path/to/yarn.lock
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### Limit packages to deduplicate yarn.lock
|
|
263
|
-
|
|
264
|
-
```sh
|
|
265
|
-
# Old
|
|
266
|
-
yarn-tools fix-duplicates path/to/yarn.lock package1 package2
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
# New
|
|
270
|
-
yarn-deduplicate --packages package1,package2 path/to/yarn.lock
|
|
166
|
+
yarn dlx yarn-berry-deduplicate --fail
|
|
271
167
|
```
|
|
272
168
|
|
|
273
169
|
## License
|