Custom license url in package.json

为君一笑 提交于 2019-12-11 09:08:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!