Skip to content

Commit 65bf762

Browse files
committed
Licenses: Add BSD-3-Clause W3C variant as an allowed license
Also, check if the license defined in package.json is telling us to look in the license file, instead.
1 parent 231a909 commit 65bf762

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
"build:packages": "cross-env EXCLUDE_PACKAGES=babel-plugin-import-jsx-pragma,jest-console,postcss-themes node ./bin/packages/build.js",
158158
"build": "npm run build:packages && cross-env NODE_ENV=production webpack",
159159
"check-engines": "check-node-version --package",
160-
"check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2 --ignore=abab\" \"wp-scripts check-licenses --dev --ignore=abab\"",
160+
"check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2\" \"wp-scripts check-licenses --dev\"",
161161
"ci": "concurrently \"npm run lint\" \"npm run test-unit:coverage-ci\"",
162162
"predev": "npm run check-engines",
163163
"dev": "npm run build:packages && concurrently \"cross-env webpack --watch\" \"npm run dev:packages\"",

packages/scripts/scripts/check-licenses.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const gpl2CompatibleLicenses = [
4545
'BSD',
4646
'BSD-2-Clause',
4747
'BSD-3-Clause',
48+
'BSD-3-Clause-W3C',
4849
'BSD-like',
4950
'CC-BY-3.0',
5051
'CC-BY-4.0',
@@ -111,6 +112,9 @@ const licenseFileStrings = {
111112
BSD: [
112113
'Redistributions in binary form must reproduce the above copyright notice,',
113114
],
115+
'BSD-3-Clause-W3C': [
116+
'W3C 3-clause BSD License',
117+
],
114118
MIT: [
115119
'Permission is hereby granted, free of charge,',
116120
'## License\n\nMIT',
@@ -221,6 +225,11 @@ modules.forEach( ( path ) => {
221225
);
222226
let licenseType = typeof license === 'object' ? license.type : license;
223227

228+
// Check if the license we've detected is telling us to look in the license file, instead.
229+
if ( licenseType && licenseFiles.find( ( licenseFile ) => licenseType.indexOf( licenseFile ) >= 0 ) ) {
230+
licenseType = undefined;
231+
}
232+
224233
/*
225234
* If we haven't been able to detect a license in the package.json file, try reading
226235
* it from the files defined in licenseFiles, instead.

0 commit comments

Comments
 (0)