问题
I'm interested to know if there is a way for passing custom license urls in NPM's package.json files.
I tried:
{
"license": {"name": "foo", "url": "http://example.com" }
}
It seems that this format is now deprecated:
// Not valid metadata
{ "license" :
{ "type" : "ISC"
, "url" : "http://opensource.org/licenses/ISC"
}
}
Is there another way to pass the license url in package.json?
回答1:
It seems there is another/new way to do it. Recently my npm packages started to complain when I was using { "license" : "LicenseRef-LICENSE" }
.
I'm now rather using the notation as documented in the npm docs:
If you are using a license that hasn't been assigned an SPDX identifier, or if you are using a custom license, use the following valid SPDX expression:
{ "license" : "SEE LICENSE IN <filename>" }
Then include a file named filename at the top level of the package.
回答2:
On the same page that was linked is the following:
If you are using a license that hasn't been assigned an SPDX identifier, or if you are using a custom license, use the following valid SPDX expression:
{ "license" : "LicenseRef-LICENSE" }
Then include a LICENSE file at the top level of the package.
In the same vein, you chould simply specify your URL in your LICENSE and/or copy/paste your existing license to that location.
来源:https://stackoverflow.com/questions/30596309/custom-license-url-in-package-json