yarn-deduplicate
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -5,16 +5,32 @@ # Changelog | ||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). | ||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project | ||
adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). | ||
## master | ||
## [3.0.0] - 2020-10-29 | ||
## 3.1.0 - 2020-10-25 | ||
### Chores | ||
- Updated dependency `jest` to 26.6.1 | ||
- Updated `yarn` to 1.22.10 (via policy) | ||
- Updated `eslint-config-prettier` to 6.14.0 | ||
- Updated `prettier` to 2.1.2 | ||
- Updated `eslint-plugin-jest` to 24.1.0 | ||
- Updated `eslint` to 7.12.0 | ||
- Prettify and fix typos in README.md (thanks to @friederbluemle) | ||
### Added | ||
- Added flag to include pre-release versions in the deduplication process. (thanks to @marcodejongh) | ||
## 3.0.0- 2020-10-29 | ||
### Breaking | ||
### Variadic flags | ||
#### Variadic flags | ||
Flags `--packages`, `--scopes` and `--exclude` don't support comma-separated values anymore (eg: | ||
`--packages libA,libB`). Instead, you can pass multiple values per flag (eg: `--packages libA libB`) | ||
or pass the flag multiple times (eg: `--packages libA --packages libB`). | ||
or pass the flag multiple times (eg: `--packages libA --packages libB`). | ||
@@ -33,3 +49,3 @@ If you use one of those flags _and_ you want to specify a custom `yarn.lock` file, you need to use | ||
## [2.1.0] - 2020-07-10 | ||
## 2.1.0- 2020-07-10 | ||
@@ -48,3 +64,3 @@ ### Chores | ||
## [2.0.0] - 2020-02-29 | ||
## 2.0.0- 2020-02-29 | ||
@@ -55,9 +71,9 @@ ### Breaks | ||
## [1.2.0] - 2020-02-29 | ||
## 1.2.0- 2020-02-29 | ||
Edit: *Do not use. It breaks Node 8 compatiblity. Use 2.0.0 instead* | ||
Edit: _Do not use. It breaks Node 8 compatiblity. Use 2.0.0 instead_ | ||
### Added | ||
- Typescript definitions (thanks to @bluelovers) | ||
- TypeScript definitions (thanks to @bluelovers) | ||
- Info about the source of duplication to README | ||
@@ -67,3 +83,3 @@ - CLI option to exclude packages (thanks to @JacobBlomgren) | ||
## [1.1.1] - 2019-02-03 | ||
## 1.1.1- 2019-02-03 | ||
@@ -75,10 +91,11 @@ ### Fixed | ||
## [1.1.0] - 2018-12-22 | ||
## 1.1.0- 2018-12-22 | ||
### Added | ||
- Option `--fail` to exit the process with an error if there are duplicated packages (thanks to @amark) | ||
- Option `--fail` to exit the process with an error if there are duplicated packages (thanks to | ||
@amark) | ||
- If the path to `yarn.lock` is not specified, use `yarn.lock` as the default (thanks to @Joge97) | ||
## [1.0.5] - 2018-12-15 | ||
## 1.0.5- 2018-12-15 | ||
@@ -91,10 +108,11 @@ ### Changed | ||
- Moved eslint and stricter to devDependencies (thanks @hawkrives) | ||
- Re-enabled disabled tests (thanks @amark) | ||
- Moved eslint and stricter to devDependencies (thanks @hawkrives) | ||
- Re-enabled disabled tests (thanks @amark) | ||
## [1.0.4] - 2018-12-12 | ||
## 1.0.4- 2018-12-12 | ||
### Changed | ||
- Fixes parsing the strategy. Now specifying `-s fewer` actually does something! (thanks to @leipert) | ||
- Fixes parsing the strategy. Now specifying `-s fewer` actually does something! (thanks to | ||
@leipert) | ||
@@ -105,3 +123,3 @@ ### Chores | ||
## [1.0.3] - 2018-11-22 | ||
## 1.0.3- 2018-11-22 | ||
@@ -112,3 +130,3 @@ ### Changed | ||
## [1.0.2] - 2018-11-02 | ||
## 1.0.2- 2018-11-02 | ||
@@ -119,10 +137,10 @@ ### Chores | ||
## [1.0.1] - 2018-11-02 | ||
## 1.0.1- 2018-11-02 | ||
### Chores | ||
- Removed unused files (tests, local `.history`) from the NPM package. Only `*.js` and | ||
text files are included now. | ||
- Removed unused files (tests, local `.history`) from the npm package. Only `*.js` and text files | ||
are included now. | ||
## [1.0.0] - 2018-10-31 | ||
## 1.0.0- 2018-10-31 | ||
@@ -152,3 +170,3 @@ ### Breaking | ||
## [0.4.1] - 2018-06-05 | ||
## 0.4.1- 2018-06-05 | ||
@@ -160,3 +178,3 @@ ### Changed | ||
## [0.4.0] - 2018-01-18 | ||
## 0.4.0- 2018-01-18 | ||
@@ -163,0 +181,0 @@ ### Added |
@@ -28,3 +28,7 @@ #!/usr/bin/env node | ||
.option('--exclude <exclude...>', 'a list of packages not to deduplicate.') | ||
.option('--print', 'instead of saving the deduplicated yarn.lock, print the result in stdout'); | ||
.option('--print', 'instead of saving the deduplicated yarn.lock, print the result in stdout') | ||
.option( | ||
'--includePrerelease', | ||
'Include prereleases in version comparisons, e.g. ^1.0.0 will be satisfied by 1.0.1-alpha' | ||
); | ||
@@ -66,2 +70,3 @@ commander.parse(process.argv); | ||
excludePackages: commander.exclude, | ||
includePrerelease: commander.includePrerelease, | ||
}); | ||
@@ -68,0 +73,0 @@ |
# Contributor Code of Conduct | ||
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. | ||
As contributors and maintainers of this project, and in the interest of fostering an open and | ||
welcoming community, we pledge to respect all people who contribute through reporting issues, | ||
posting feature requests, updating documentation, submitting pull requests or patches, and other | ||
activities. | ||
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. | ||
We are committed to making participation in this project a harassment-free experience for everyone, | ||
regardless of level of experience, gender, gender identity and expression, sexual orientation, | ||
disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. | ||
Examples of unacceptable behavior by participants include: | ||
* The use of sexualized language or imagery | ||
* Personal attacks | ||
* Trolling or insulting/derogatory comments | ||
* Public or private harassment | ||
* Publishing other's private information, such as physical or electronic addresses, without explicit permission | ||
* Submitting contributions or comments that you know to violate the intellectual property or privacy rights of others | ||
* Other unethical or unprofessional conduct | ||
- The use of sexualized language or imagery | ||
- Personal attacks | ||
- Trolling or insulting/derogatory comments | ||
- Public or private harassment | ||
- Publishing other's private information, such as physical or electronic addresses, without explicit | ||
permission | ||
- Submitting contributions or comments that you know to violate the intellectual property or privacy | ||
rights of others | ||
- Other unethical or unprofessional conduct | ||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. | ||
By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. | ||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, | ||
code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or | ||
to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. By adopting this Code of Conduct, project maintainers commit | ||
themselves to fairly and consistently applying these principles to every aspect of managing this | ||
project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently | ||
removed from the project team. | ||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. | ||
This Code of Conduct applies both within project spaces and in public spaces when an individual is | ||
representing the project or its community. | ||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer. Complaints will result in a response and be reviewed and investigated in a way that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a | ||
project maintainer. Complaints will result in a response and be reviewed and investigated in a way | ||
that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain | ||
confidentiality with regard to the reporter of an incident. | ||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.3.0, available at [http://contributor-covenant.org/version/1/3/0/][version] | ||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.3.0, available | ||
at [http://contributor-covenant.org/version/1/3/0/][version] | ||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/3/0/ |
33
index.js
@@ -54,3 +54,3 @@ const lockfile = require('@yarnpkg/lockfile'); | ||
const computePackageInstances = (packages, name, useMostCommon) => { | ||
const computePackageInstances = (packages, name, useMostCommon, includePrerelease = false) => { | ||
// Instances of this package in the tree | ||
@@ -78,4 +78,4 @@ const packageInstances = packages[name]; | ||
if ( | ||
semver.validRange(packageInstance.requestedVersion) && | ||
semver.satisfies(version, packageInstance.requestedVersion) | ||
semver.validRange(packageInstance.requestedVersion, { includePrerelease }) && | ||
semver.satisfies(version, packageInstance.requestedVersion, { includePrerelease }) | ||
) { | ||
@@ -103,3 +103,3 @@ satisfies.add(packageInstance); | ||
} | ||
return semver.rcompare(versionA, versionB); | ||
return semver.rcompare(versionA, versionB, { includePrerelease }); | ||
}); | ||
@@ -117,3 +117,3 @@ packageInstance.satisfiedBy = candidateVersions; | ||
json, | ||
{ includeScopes, includePackages, excludePackages, useMostCommon } | ||
{ includeScopes, includePackages, excludePackages, useMostCommon, includePrerelease = false } | ||
) => { | ||
@@ -123,3 +123,6 @@ const packages = extractPackages(json, includeScopes, includePackages, excludePackages); | ||
.reduce( | ||
(acc, name) => acc.concat(computePackageInstances(packages, name, useMostCommon)), | ||
(acc, name) => | ||
acc.concat( | ||
computePackageInstances(packages, name, useMostCommon, includePrerelease) | ||
), | ||
[] | ||
@@ -132,3 +135,9 @@ ) | ||
yarnLock, | ||
{ includeScopes = [], includePackages = [], excludePackages = [], useMostCommon = false } = {} | ||
{ | ||
includeScopes = [], | ||
includePackages = [], | ||
excludePackages = [], | ||
useMostCommon = false, | ||
includePrerelease = false, | ||
} = {} | ||
) => { | ||
@@ -143,2 +152,3 @@ const json = parseYarnLock(yarnLock); | ||
useMostCommon, | ||
includePrerelease, | ||
}).forEach(({ bestVersion, name, installedVersion, requestedVersion }) => { | ||
@@ -155,3 +165,9 @@ result.push( | ||
yarnLock, | ||
{ includeScopes = [], includePackages = [], excludePackages = [], useMostCommon = false } = {} | ||
{ | ||
includeScopes = [], | ||
includePackages = [], | ||
excludePackages = [], | ||
useMostCommon = false, | ||
includePrerelease = false, | ||
} = {} | ||
) => { | ||
@@ -165,2 +181,3 @@ const json = parseYarnLock(yarnLock); | ||
useMostCommon, | ||
includePrerelease, | ||
}).forEach(({ bestVersion, name, versions, requestedVersion }) => { | ||
@@ -167,0 +184,0 @@ json[`${name}@${requestedVersion}`] = versions[bestVersion].pkg; |
274
LICENSE.md
@@ -1,2 +0,1 @@ | ||
Apache License | ||
@@ -6,176 +5,137 @@ Version 2.0, January 2004 | ||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | ||
1. Definitions. | ||
1. Definitions. | ||
"License" shall mean the terms and conditions for use, reproduction, | ||
and distribution as defined by Sections 1 through 9 of this document. | ||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined | ||
by Sections 1 through 9 of this document. | ||
"Licensor" shall mean the copyright owner or entity authorized by | ||
the copyright owner that is granting the License. | ||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is | ||
granting the License. | ||
"Legal Entity" shall mean the union of the acting entity and all | ||
other entities that control, are controlled by, or are under common | ||
control with that entity. For the purposes of this definition, | ||
"control" means (i) the power, direct or indirect, to cause the | ||
direction or management of such entity, whether by contract or | ||
otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||
outstanding shares, or (iii) beneficial ownership of such entity. | ||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are | ||
controlled by, or are under common control with that entity. For the purposes of this definition, | ||
"control" means (i) the power, direct or indirect, to cause the direction or management of such | ||
entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the | ||
outstanding shares, or (iii) beneficial ownership of such entity. | ||
"You" (or "Your") shall mean an individual or Legal Entity | ||
exercising permissions granted by this License. | ||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this | ||
License. | ||
"Source" form shall mean the preferred form for making modifications, | ||
including but not limited to software source code, documentation | ||
source, and configuration files. | ||
"Source" form shall mean the preferred form for making modifications, including but not limited | ||
to software source code, documentation source, and configuration files. | ||
"Object" form shall mean any form resulting from mechanical | ||
transformation or translation of a Source form, including but | ||
not limited to compiled object code, generated documentation, | ||
and conversions to other media types. | ||
"Object" form shall mean any form resulting from mechanical transformation or translation of a | ||
Source form, including but not limited to compiled object code, generated documentation, and | ||
conversions to other media types. | ||
"Work" shall mean the work of authorship, whether in Source or | ||
Object form, made available under the License, as indicated by a | ||
copyright notice that is included in or attached to the work | ||
(an example is provided in the Appendix below). | ||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under | ||
the License, as indicated by a copyright notice that is included in or attached to the work (an | ||
example is provided in the Appendix below). | ||
"Derivative Works" shall mean any work, whether in Source or Object | ||
form, that is based on (or derived from) the Work and for which the | ||
editorial revisions, annotations, elaborations, or other modifications | ||
represent, as a whole, an original work of authorship. For the purposes | ||
of this License, Derivative Works shall not include works that remain | ||
separable from, or merely link (or bind by name) to the interfaces of, | ||
the Work and Derivative Works thereof. | ||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or | ||
derived from) the Work and for which the editorial revisions, annotations, elaborations, or other | ||
modifications represent, as a whole, an original work of authorship. For the purposes of this | ||
License, Derivative Works shall not include works that remain separable from, or merely link (or | ||
bind by name) to the interfaces of, the Work and Derivative Works thereof. | ||
"Contribution" shall mean any work of authorship, including | ||
the original version of the Work and any modifications or additions | ||
to that Work or Derivative Works thereof, that is intentionally | ||
submitted to Licensor for inclusion in the Work by the copyright owner | ||
or by an individual or Legal Entity authorized to submit on behalf of | ||
the copyright owner. For the purposes of this definition, "submitted" | ||
means any form of electronic, verbal, or written communication sent | ||
to the Licensor or its representatives, including but not limited to | ||
communication on electronic mailing lists, source code control systems, | ||
and issue tracking systems that are managed by, or on behalf of, the | ||
Licensor for the purpose of discussing and improving the Work, but | ||
excluding communication that is conspicuously marked or otherwise | ||
designated in writing by the copyright owner as "Not a Contribution." | ||
"Contribution" shall mean any work of authorship, including the original version of the Work and | ||
any modifications or additions to that Work or Derivative Works thereof, that is intentionally | ||
submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or | ||
Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this | ||
definition, "submitted" means any form of electronic, verbal, or written communication sent to | ||
the Licensor or its representatives, including but not limited to communication on electronic | ||
mailing lists, source code control systems, and issue tracking systems that are managed by, or on | ||
behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding | ||
communication that is conspicuously marked or otherwise designated in writing by the copyright | ||
owner as "Not a Contribution." | ||
"Contributor" shall mean Licensor and any individual or Legal Entity | ||
on behalf of whom a Contribution has been received by Licensor and | ||
subsequently incorporated within the Work. | ||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a | ||
Contribution has been received by Licensor and subsequently incorporated within the Work. | ||
2. Grant of Copyright License. Subject to the terms and conditions of | ||
this License, each Contributor hereby grants to You a perpetual, | ||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
copyright license to reproduce, prepare Derivative Works of, | ||
publicly display, publicly perform, sublicense, and distribute the | ||
Work and such Derivative Works in Source or Object form. | ||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor | ||
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, | ||
sublicense, and distribute the Work and such Derivative Works in Source or Object form. | ||
3. Grant of Patent License. Subject to the terms and conditions of | ||
this License, each Contributor hereby grants to You a perpetual, | ||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
(except as stated in this section) patent license to make, have made, | ||
use, offer to sell, sell, import, and otherwise transfer the Work, | ||
where such license applies only to those patent claims licensable | ||
by such Contributor that are necessarily infringed by their | ||
Contribution(s) alone or by combination of their Contribution(s) | ||
with the Work to which such Contribution(s) was submitted. If You | ||
institute patent litigation against any entity (including a | ||
cross-claim or counterclaim in a lawsuit) alleging that the Work | ||
or a Contribution incorporated within the Work constitutes direct | ||
or contributory patent infringement, then any patent licenses | ||
granted to You under this License for that Work shall terminate | ||
as of the date such litigation is filed. | ||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor | ||
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable | ||
(except as stated in this section) patent license to make, have made, use, offer to sell, sell, | ||
import, and otherwise transfer the Work, where such license applies only to those patent claims | ||
licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or | ||
by combination of their Contribution(s) with the Work to which such Contribution(s) was | ||
submitted. If You institute patent litigation against any entity (including a cross-claim or | ||
counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work | ||
constitutes direct or contributory patent infringement, then any patent licenses granted to You | ||
under this License for that Work shall terminate as of the date such litigation is filed. | ||
4. Redistribution. You may reproduce and distribute copies of the | ||
Work or Derivative Works thereof in any medium, with or without | ||
modifications, and in Source or Object form, provided that You | ||
meet the following conditions: | ||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof | ||
in any medium, with or without modifications, and in Source or Object form, provided that You | ||
meet the following conditions: | ||
(a) You must give any other recipients of the Work or | ||
Derivative Works a copy of this License; and | ||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; | ||
and | ||
(b) You must cause any modified files to carry prominent notices | ||
stating that You changed the files; and | ||
(b) You must cause any modified files to carry prominent notices stating that You changed the | ||
files; and | ||
(c) You must retain, in the Source form of any Derivative Works | ||
that You distribute, all copyright, patent, trademark, and | ||
attribution notices from the Source form of the Work, | ||
excluding those notices that do not pertain to any part of | ||
the Derivative Works; and | ||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all | ||
copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding | ||
those notices that do not pertain to any part of the Derivative Works; and | ||
(d) If the Work includes a "NOTICE" text file as part of its | ||
distribution, then any Derivative Works that You distribute must | ||
include a readable copy of the attribution notices contained | ||
within such NOTICE file, excluding those notices that do not | ||
pertain to any part of the Derivative Works, in at least one | ||
of the following places: within a NOTICE text file distributed | ||
as part of the Derivative Works; within the Source form or | ||
documentation, if provided along with the Derivative Works; or, | ||
within a display generated by the Derivative Works, if and | ||
wherever such third-party notices normally appear. The contents | ||
of the NOTICE file are for informational purposes only and | ||
do not modify the License. You may add Your own attribution | ||
notices within Derivative Works that You distribute, alongside | ||
or as an addendum to the NOTICE text from the Work, provided | ||
that such additional attribution notices cannot be construed | ||
as modifying the License. | ||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative | ||
Works that You distribute must include a readable copy of the attribution notices contained | ||
within such NOTICE file, excluding those notices that do not pertain to any part of the | ||
Derivative Works, in at least one of the following places: within a NOTICE text file distributed | ||
as part of the Derivative Works; within the Source form or documentation, if provided along with | ||
the Derivative Works; or, within a display generated by the Derivative Works, if and wherever | ||
such third-party notices normally appear. The contents of the NOTICE file are for informational | ||
purposes only and do not modify the License. You may add Your own attribution notices within | ||
Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the | ||
Work, provided that such additional attribution notices cannot be construed as modifying the | ||
License. | ||
You may add Your own copyright statement to Your modifications and | ||
may provide additional or different license terms and conditions | ||
for use, reproduction, or distribution of Your modifications, or | ||
for any such Derivative Works as a whole, provided Your use, | ||
reproduction, and distribution of the Work otherwise complies with | ||
the conditions stated in this License. | ||
You may add Your own copyright statement to Your modifications and may provide additional or | ||
different license terms and conditions for use, reproduction, or distribution of Your | ||
modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and | ||
distribution of the Work otherwise complies with the conditions stated in this License. | ||
5. Submission of Contributions. Unless You explicitly state otherwise, | ||
any Contribution intentionally submitted for inclusion in the Work | ||
by You to the Licensor shall be under the terms and conditions of | ||
this License, without any additional terms or conditions. | ||
Notwithstanding the above, nothing herein shall supersede or modify | ||
the terms of any separate license agreement you may have executed | ||
with Licensor regarding such Contributions. | ||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution | ||
intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms | ||
and conditions of this License, without any additional terms or conditions. Notwithstanding the | ||
above, nothing herein shall supersede or modify the terms of any separate license agreement you | ||
may have executed with Licensor regarding such Contributions. | ||
6. Trademarks. This License does not grant permission to use the trade | ||
names, trademarks, service marks, or product names of the Licensor, | ||
except as required for reasonable and customary use in describing the | ||
origin of the Work and reproducing the content of the NOTICE file. | ||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service | ||
marks, or product names of the Licensor, except as required for reasonable and customary use in | ||
describing the origin of the Work and reproducing the content of the NOTICE file. | ||
7. Disclaimer of Warranty. Unless required by applicable law or | ||
agreed to in writing, Licensor provides the Work (and each | ||
Contributor provides its Contributions) on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
implied, including, without limitation, any warranties or conditions | ||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||
PARTICULAR PURPOSE. You are solely responsible for determining the | ||
appropriateness of using or redistributing the Work and assume any | ||
risks associated with Your exercise of permissions under this License. | ||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor | ||
provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT | ||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, | ||
any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | ||
PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or | ||
redistributing the Work and assume any risks associated with Your exercise of permissions under | ||
this License. | ||
8. Limitation of Liability. In no event and under no legal theory, | ||
whether in tort (including negligence), contract, or otherwise, | ||
unless required by applicable law (such as deliberate and grossly | ||
negligent acts) or agreed to in writing, shall any Contributor be | ||
liable to You for damages, including any direct, indirect, special, | ||
incidental, or consequential damages of any character arising as a | ||
result of this License or out of the use or inability to use the | ||
Work (including but not limited to damages for loss of goodwill, | ||
work stoppage, computer failure or malfunction, or any and all | ||
other commercial damages or losses), even if such Contributor | ||
has been advised of the possibility of such damages. | ||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including | ||
negligence), contract, or otherwise, unless required by applicable law (such as deliberate and | ||
grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for | ||
damages, including any direct, indirect, special, incidental, or consequential damages of any | ||
character arising as a result of this License or out of the use or inability to use the Work | ||
(including but not limited to damages for loss of goodwill, work stoppage, computer failure or | ||
malfunction, or any and all other commercial damages or losses), even if such Contributor has | ||
been advised of the possibility of such damages. | ||
9. Accepting Warranty or Additional Liability. While redistributing | ||
the Work or Derivative Works thereof, You may choose to offer, | ||
and charge a fee for, acceptance of support, warranty, indemnity, | ||
or other liability obligations and/or rights consistent with this | ||
License. However, in accepting such obligations, You may act only | ||
on Your own behalf and on Your sole responsibility, not on behalf | ||
of any other Contributor, and only if You agree to indemnify, | ||
defend, and hold each Contributor harmless for any liability | ||
incurred by, or claims asserted against, such Contributor by reason | ||
of your accepting any such warranty or additional liability. | ||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works | ||
thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, | ||
indemnity, or other liability obligations and/or rights consistent with this License. However, in | ||
accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, | ||
not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each | ||
Contributor harmless for any liability incurred by, or claims asserted against, such Contributor | ||
by reason of your accepting any such warranty or additional liability. | ||
END OF TERMS AND CONDITIONS | ||
END OF TERMS AND CONDITIONS | ||
APPENDIX: How to apply the Apache License to your work. | ||
APPENDIX: How to apply the Apache License to your work. | ||
@@ -191,14 +151,12 @@ To apply the Apache License to your work, attach the following | ||
Copyright [yyyy] [name of copyright owner] | ||
Copyright [yyyy] [name of copyright owner] | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in | ||
compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is | ||
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
implied. See the License for the specific language governing permissions and limitations under the | ||
License. |
{ | ||
"name": "yarn-deduplicate", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"bin": "./cli.js", | ||
@@ -38,9 +38,10 @@ "description": "Deduplication tool for yarn.lock files", | ||
"devDependencies": { | ||
"eslint": "^7.7.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-jest": "^23.20.0", | ||
"eslint": "^7.12.0", | ||
"eslint-config-prettier": "^6.14.0", | ||
"eslint-plugin-jest": "^24.1.0", | ||
"eslint-plugin-md": "^1.0.19", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"jest": "^26.4.2", | ||
"jest": "^26.6.1", | ||
"outdent": "^0.7.1", | ||
"prettier": "^2.1.1" | ||
"prettier": "^2.1.2" | ||
}, | ||
@@ -47,0 +48,0 @@ "jest": { |
131
README.md
@@ -1,6 +0,8 @@ | ||
Builds: ![Node.js CI](https://github.com/atlassian/yarn-deduplicate/workflows/Node.js%20CI/badge.svg) | ||
# yarn-deduplicate | ||
This package only works with Yarn v1. Yarn v2 supports package deduplcatiion [natively](https://github.com/yarnpkg/berry/pull/1558)! | ||
Builds: | ||
![Node.js CI](https://github.com/atlassian/yarn-deduplicate/workflows/Node.js%20CI/badge.svg) | ||
# Yarn deduplicate | ||
This package only works with Yarn v1. Yarn v2 supports package deduplication | ||
[natively](https://github.com/yarnpkg/berry/pull/1558)! | ||
@@ -10,4 +12,4 @@ Cleans up `yarn.lock` by removing duplicates. | ||
A duplicate package is when two dependencies are resolved to a different version, even when a single | ||
version matches the range specified in the dependencies. See the [Deduplication | ||
strategies](#deduplication-strategies) section for a few examples. | ||
version matches the range specified in the dependencies. See the | ||
[Deduplication strategies](#deduplication-strategies) section for a few examples. | ||
@@ -18,3 +20,3 @@ ## Installation | ||
```bash | ||
```sh | ||
npm install -g yarn-deduplicate | ||
@@ -25,8 +27,9 @@ ``` | ||
```bash | ||
```sh | ||
yarn global add yarn-deduplicate | ||
``` | ||
This package also works wth [npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b), | ||
so you don't need to install it. | ||
This package also works wth | ||
[npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b), so you | ||
don't need to install it. | ||
@@ -39,3 +42,3 @@ --- | ||
```bash | ||
```sh | ||
yarn-deduplicate yarn.lock | ||
@@ -50,3 +53,3 @@ ``` | ||
```bash | ||
```sh | ||
yarn-deduplicate --help | ||
@@ -87,3 +90,3 @@ ``` | ||
This is, however, not exactly true. There are cases where yarn will *not* deduplicate existing | ||
This is, however, not exactly true. There are cases where yarn will _not_ deduplicate existing | ||
packages. For example, this scenario: | ||
@@ -100,2 +103,3 @@ | ||
Find more examples in: | ||
- [yarn-deduplicate — The Hero We Need](https://medium.com/@bnaya/yarn-deduplicate-the-hero-we-need-f4497a362128) | ||
@@ -109,14 +113,14 @@ - [De-duplicating yarn.lock](https://medium.com/@scinos/de-duplicating-yarn-lock-ae30be4aa41a) | ||
`highest` | ||
It will try to use the highest installed version. For example, with the following `yarn.lock`: | ||
`highest` will try to use the highest installed version. For example, with the following | ||
`yarn.lock`: | ||
``` | ||
```text | ||
library@^1.1.0: | ||
version "1.2.0" | ||
version "1.2.0" | ||
library@^1.2.0: | ||
version "1.2.0" | ||
version "1.2.0" | ||
library@^1.3.0: | ||
version "1.3.0" | ||
version "1.3.0" | ||
``` | ||
@@ -126,15 +130,14 @@ | ||
`fewer` | ||
It will try to minimize the number of installed versions by trying to deduplicate to the version | ||
that satisfies most of the ranges first. For example, with the following `yarn.lock`: | ||
`fewer` will try to minimize the number of installed versions by trying to deduplicate to the | ||
version that satisfies most of the ranges first. For example, with the following `yarn.lock`: | ||
``` | ||
```text | ||
library@*: | ||
version "2.0.0" | ||
version "2.0.0" | ||
library@>=1.1.0: | ||
version "3.0.0" | ||
version "3.0.0" | ||
library@^1.2.0: | ||
version "1.2.0" | ||
version "1.2.0" | ||
``` | ||
@@ -144,5 +147,4 @@ | ||
Note that this will cause some packages to **downgrade** it version. Be sure to check the changelogs | ||
between all versions and understand the consequences of that downgrade. If unsure, don't use this | ||
strategy. | ||
Note that this may cause some packages to be **downgraded**. Be sure to check the changelogs between | ||
all versions and understand the consequences of that downgrade. If unsure, don't use this strategy. | ||
@@ -158,5 +160,5 @@ It is not recommended to use different strategies for different packages. There is no guarantee that | ||
Receives a list of packages to deduplicate. It will ignore any other duplicated package not in the | ||
list. This option is recommended when the number of duplicated packages in `yarn.lock` is too big | ||
to be easily reviewed by a human. This will allow for a more controlled and progressive | ||
deduplication of `yarn.lock`. | ||
list. This option is recommended when the number of duplicated packages in `yarn.lock` is too big to | ||
be easily reviewed by a human. This will allow for a more controlled and progressive deduplication | ||
of `yarn.lock`. | ||
@@ -166,6 +168,16 @@ `--scopes <scope1> <scope2> <scopeN>` | ||
Receives a list of scopes to deduplicate. It will ignore any other duplicated package not in the | ||
list. This option is recommended when deduplicating a large number of inter-dependent packages | ||
from a single scope, such as @babel. This will allow for a more controlled and progressive | ||
deduplication of `yarn.lock` without specifying each package individually. | ||
list. This option is recommended when deduplicating a large number of inter-dependent packages from | ||
a single scope, such as @babel. This will allow for a more controlled and progressive deduplication | ||
of `yarn.lock` without specifying each package individually. | ||
### Pre-release versions | ||
By default, `yarn-deduplicate` will only match pre-release versions if they share they share the | ||
same `mayor`, `minor` and `patch` versions (example: `^1.2.3-alpha.1` and `1.2.3-alpha.2` can be | ||
deduplicated, but `^1.2.3` and `1.2.4-alpha.1` can't). This matches the behaviour of | ||
[semver](https://docs.npmjs.com/misc/semver#prerelease-tags). | ||
To change this behaviour you can use the flag `--includePrerelease`. This will treat all pre-release | ||
versionas as if they were normal versions (`^1.2.3` and `1.2.4-alpha.1` can be deduplicated). | ||
### Usage in CI | ||
@@ -176,3 +188,3 @@ | ||
```bash | ||
```sh | ||
# Print the list of duplicated packages and exit with status 1 | ||
@@ -194,3 +206,3 @@ yarn-deduplicate --list --fail | ||
```bash | ||
```sh | ||
#Old | ||
@@ -208,6 +220,6 @@ yarn-deduplicate --packages libA,libB | ||
A consequence of this change is that if you were using one or more of the affected options ( | ||
`--packages`, `--scopes` or `--exclude`) __and__ a custom path for `yarn.lock`, you need to use `--` | ||
`--packages`, `--scopes` or `--exclude`) **and** a custom path for `yarn.lock`, you need to use `--` | ||
to "stop" package/scope/exclude parsing: | ||
```bash | ||
```sh | ||
yarn-deduplicate --packages libA libB -- path/to/yarn.lock | ||
@@ -223,3 +235,3 @@ ``` | ||
```bash | ||
```sh | ||
# Old | ||
@@ -234,3 +246,3 @@ npm install -g yarn-tools | ||
```bash | ||
```sh | ||
# Old | ||
@@ -244,3 +256,4 @@ yarn-tools list-duplicates path/to/yarn.lock | ||
### Deduplicate yarn.lock | ||
```bash | ||
```sh | ||
# Old | ||
@@ -255,3 +268,4 @@ yarn-tools fix-duplicates path/to/yarn.lock > tmp | ||
### Limit packages to deduplicate yarn.lock | ||
```bash | ||
```sh | ||
# Old | ||
@@ -269,28 +283,25 @@ yarn-tools fix-duplicates path/to/yarn.lock package1 package2 | ||
* Add tests for new features and bug fixes | ||
* Follow the existing style | ||
* Separate unrelated changes into multiple pull requests | ||
- Add tests for new features and bug fixes | ||
- Follow the existing style | ||
- Separate unrelated changes into multiple pull requests | ||
See the existing issues for things to start contributing. | ||
For bigger changes, make sure you start a discussion first by creating | ||
an issue and explaining the intended change. | ||
For bigger changes, make sure you start a discussion first by creating an issue and explaining the | ||
intended change. | ||
Atlassian requires contributors to sign a Contributor License Agreement, | ||
known as a CLA. This serves as a record stating that the contributor is | ||
entitled to contribute the code/documentation/translation to the project | ||
and is willing to have it used in distributions and derivative works | ||
(or is willing to transfer ownership). | ||
Atlassian requires contributors to sign a Contributor License Agreement, known as a CLA. This serves | ||
as a record stating that the contributor is entitled to contribute the | ||
code/documentation/translation to the project and is willing to have it used in distributions and | ||
derivative works (or is willing to transfer ownership). | ||
Prior to accepting your contributions we ask that you please follow the appropriate | ||
link below to digitally sign the CLA. The Corporate CLA is for those who are | ||
contributing as a member of an organization and the individual CLA is for | ||
those contributing as an individual. | ||
Prior to accepting your contributions we ask that you please follow the appropriate link below to | ||
digitally sign the CLA. The Corporate CLA is for those who are contributing as a member of an | ||
organization and the individual CLA is for those contributing as an individual. | ||
* [CLA for corporate contributors](https://opensource.atlassian.com/corporate) | ||
* [CLA for individuals](https://opensource.atlassian.com/individual) | ||
- [CLA for corporate contributors](https://opensource.atlassian.com/corporate) | ||
- [CLA for individuals](https://opensource.atlassian.com/individual) | ||
## License | ||
Copyright (c) 2017 Atlassian and others. | ||
Apache 2.0 licensed, see [LICENSE.txt](LICENSE.txt) file. | ||
Copyright (c) 2017 Atlassian and others. Apache 2.0 licensed, see [LICENSE.txt](LICENSE.txt) file. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
58537
12
729
288
8
2
2