package.json中的自定义许可证URL [英] Custom license url in package.json

查看:530
本文介绍了package.json中的自定义许可证URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以在NPM的package.json文件中传递自定义许可证URL.

I'm interested to know if there is a way for passing custom license urls in NPM's package.json files.

我尝试过:

{
  "license": {"name": "foo", "url": "http://example.com" }
}

似乎已经不推荐使用此格式:

// Not valid metadata
{ "license" :
  { "type" : "ISC"
  , "url" : "http://opensource.org/licenses/ISC"
  }
}

还有另一种在package.json中传递许可证URL的方法吗?

Is there another way to pass the license url in package.json?

推荐答案

似乎还有另一种/新的方法可以做到这一点.最近,当我使用{ "license" : "LicenseRef-LICENSE" }时,我的npm软件包开始抱怨.

It seems there is another/new way to do it. Recently my npm packages started to complain when I was using { "license" : "LicenseRef-LICENSE" }.

我现在宁愿使用 npm文档中记录的符号:

I'm now rather using the notation as documented in the npm docs:

如果您使用的许可证尚未分配SPDX 标识符,或者如果您使用的是自定义许可证,请使用以下命令 有效的SPDX表达式:

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>" }

然后在软件包的顶层添加一个名为 filename 的文件.

Then include a file named filename at the top level of the package.

这篇关于package.json中的自定义许可证URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆