Skip to content

Commit

Permalink
Licenses: Add BSD-3-Clause W3C variant as an allowed license
Browse files Browse the repository at this point in the history
Also, check if the license defined in package.json is telling us to look in the license file, instead.
  • Loading branch information
pento committed Sep 13, 2018
1 parent 231a909 commit 65bf762
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
"build:packages": "cross-env EXCLUDE_PACKAGES=babel-plugin-import-jsx-pragma,jest-console,postcss-themes node ./bin/packages/build.js",
"build": "npm run build:packages && cross-env NODE_ENV=production webpack",
"check-engines": "check-node-version --package",
"check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2 --ignore=abab\" \"wp-scripts check-licenses --dev --ignore=abab\"",
"check-licenses": "concurrently \"wp-scripts check-licenses --prod --gpl2\" \"wp-scripts check-licenses --dev\"",
"ci": "concurrently \"npm run lint\" \"npm run test-unit:coverage-ci\"",
"predev": "npm run check-engines",
"dev": "npm run build:packages && concurrently \"cross-env webpack --watch\" \"npm run dev:packages\"",
Expand Down
9 changes: 9 additions & 0 deletions packages/scripts/scripts/check-licenses.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const gpl2CompatibleLicenses = [
'BSD',
'BSD-2-Clause',
'BSD-3-Clause',
'BSD-3-Clause-W3C',
'BSD-like',
'CC-BY-3.0',
'CC-BY-4.0',
Expand Down Expand Up @@ -111,6 +112,9 @@ const licenseFileStrings = {
BSD: [
'Redistributions in binary form must reproduce the above copyright notice,',
],
'BSD-3-Clause-W3C': [
'W3C 3-clause BSD License',
],
MIT: [
'Permission is hereby granted, free of charge,',
'## License\n\nMIT',
Expand Down Expand Up @@ -221,6 +225,11 @@ modules.forEach( ( path ) => {
);
let licenseType = typeof license === 'object' ? license.type : license;

// Check if the license we've detected is telling us to look in the license file, instead.
if ( licenseType && licenseFiles.find( ( licenseFile ) => licenseType.indexOf( licenseFile ) >= 0 ) ) {
licenseType = undefined;
}

/*
* If we haven't been able to detect a license in the package.json file, try reading
* it from the files defined in licenseFiles, instead.
Expand Down

0 comments on commit 65bf762

Please sign in to comment.