Scripts: Recognize GPLv3 as compatible in check-licenses - #80263
Scripts: Recognize GPLv3 as compatible in check-licenses#80263amoljadhavminiorange wants to merge 1 commit into
Conversation
Add GPL-3.0, GPL-3.0-only and GPL-3.0-or-later to the list of licenses that check-licenses accepts when the --gpl2 flag is not passed. Since WordPress is distributed under GPLv2 or later, GPLv3 dependencies can be combined with it, while strict GPLv2 mode continues to reject them. Also document in the readme that check-licenses is a WordPress-specific tool, and add unit tests covering getLicenses in both modes. Fixes WordPress#20701. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @ntwb. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @amoljadhavminiorange! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
All CI checks pass except |
Fixes #20701
What?
Adds the GPLv3 license identifiers (
GPL-3.0,GPL-3.0-only,GPL-3.0-or-later) to theotherOssLicenseslist incheck-licenses, so dependencies under those licenses are accepted when the--gpl2flag is not passed. Strict GPLv2 mode (--gpl2) continues to reject them.Why?
As reported in #20701,
wp-scripts check-licensescurrently errors onGPL-3.0-or-laterdependencies even in default mode. Since WordPress is distributed under "GPLv2 or later", GPLv3-licensed code can be combined with it. This implements the approach proposed by @pento in #20701 (comment): add GPLv3 tootherOssLicenses, and be more explicit in the readme thatcheck-licensesis a WordPress-specific tool.Note: I'm aware of the warning comment in
license.jsthat changes to the license lists need explicit review — flagging that this PR is exactly such a change. The deprecated SPDX identifierGPL-3.0is included alongside the two modern ones because older packages still declare it; happy to drop it if preferred.How?
packages/scripts/utils/license.js: three GPLv3 identifiers added tootherOssLicenses(kept alphabetical).packages/scripts/README.md: thecheck-licensessection now explains the tool is WordPress-specific, why GPLv3 is accepted by default, and that--gpl2restricts to strict GPLv2 compatibility.packages/scripts/utils/test/license.js: newgetLicenses()tests covering both modes (also converted the internal import torequireto satisfy the strictimport/orderpre-commit lint).packages/scripts/CHANGELOG.md: entry under Unreleased.Testing Instructions
npx jest packages/scripts/utils/test/license.js --config=test/unit/jest.config.js— 12 tests pass.package.jsondeclares"license": "GPL-3.0-or-later":wp-scripts check-licenses→ passes (exit 0). Before this change it errored withModule <dep> has an incompatible license 'GPL-3.0-or-later'.wp-scripts check-licenses --gpl2→ still fails as expected.