diff options
Diffstat (limited to 'node_modules/init-package-json/node_modules/validate-npm-package-license/README.md')
-rw-r--r-- | node_modules/init-package-json/node_modules/validate-npm-package-license/README.md | 54 |
1 files changed, 43 insertions, 11 deletions
diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-license/README.md b/node_modules/init-package-json/node_modules/validate-npm-package-license/README.md index 904f74b9d..b71e26e06 100644 --- a/node_modules/init-package-json/node_modules/validate-npm-package-license/README.md +++ b/node_modules/init-package-json/node_modules/validate-npm-package-license/README.md @@ -1,29 +1,61 @@ -npm-validate-package-license +validate-npm-package-license ============================ -Give me a string and I'll tell you if it's a valid npm package license. - -*This package is not endorsed or approved by npm. It is part of a proposal to add license field validation to the npm command-line interface.* +Give me a string and I'll tell you if it's a valid npm package license string. <!-- js var valid = require('./'); --> ```js -var validResult = { +var noWarnings = { validForNewPackages: true, validForOldPackages: true }; -valid('Apache-2.0'); // => validResult -valid('GPL-3.0 OR BSD-2-Clause'); // => validResult +// SPDX license identifier for common open-source licenses +valid('MIT'); // => noWarnings +valid('BSD-2-Clause'); // => noWarnings +valid('Apache-2.0'); // => noWarnings +valid('ISC'); // => noWarnings + +// Simple SPDX license expression for dual licensing +valid('(GPL-3.0 OR BSD-2-Clause)'); // => noWarnings + +// Refer to a non-standard license found in the package +valid('SEE LICENSE IN LICENSE.txt'); // => noWarnings +valid('SEE LICENSE IN license.md'); // => noWarnings + +// No license +valid('UNLICENSED'); // => noWarnings +valid('UNLICENCED'); // => noWarnings + +var warningsWithSuggestion = { + validForOldPackages: false, + validForNewPackages: false, + warnings: [ + 'license should be ' + + 'a valid SPDX license expression without "LicenseRef", ' + + '"UNLICENSED", or ' + + '"SEE LICENSE IN <filename>"', + 'license is similar to the valid expression "Apache-2.0"' + ] +}; + +// Almost a valid SPDX license identifier +valid('Apache 2.0'); // => warningsWithSuggestion -var invalidResult = { +var warningAboutLicenseRef = { validForOldPackages: false, validForNewPackages: false, warnings: [ - 'license should be a valid SPDX license expression', - 'license is similar to the valid expression "Apache-2.0"' + 'license should be ' + + 'a valid SPDX license expression without "LicenseRef", ' + + '"UNLICENSED", or ' + + '"SEE LICENSE IN <filename>"', ] }; -valid('Apache 2.0'); // => invalidResult +// LicenseRef-* identifiers are valid SPDX expressions, +// but not valid in package.json +valid('LicenseRef-Made-Up'); // => warningAboutLicenseRef +valid('(MIT OR LicenseRef-Made-Up)'); // => warningAboutLicenseRef ``` |