作为组织成员,你可以在组织范围内创建和发布公共和私有包。
🌐 As an organization member, you can create and publish public and private packages within the organization's scope.
🌐 Creating an organization scoped package
在命令行上,使用你要创建的包的名称创建一个目录。
mkdir /path/to/package/directory
导航到新创建的包目录。
要创建组织范围的包,请在命令行上运行:
npm init --scope=<your_org_name>
要验证该软件包是否使用了你的组织范围,请在文本编辑器中打开该软件包的 package.json 文件,并检查名称是否为 @your_org_name/<pkg_name>,将 your_org_name 替换为你组织的名称。
🌐 Publishing a private organization scoped package
默认情况下,npm publish 会将带作用域的包发布为私有。
🌐 By default, npm publish will publish a scoped package as private.
默认情况下,任何作用域包都会作为私有包发布。然而,如果你的组织没有私有包功能,除非你使用 access 标志,否则 npm publish 将会失败。
🌐 By default, any scoped package is published as private. However, if you have an organization that does not have the Private Packages feature, npm publish will fail unless you pass the access flag.
npm publish。私有包将在 npm 网站上包名称下方显示 private。
🌐 Private packages will say private below the package name on the npm website.
🌐 Publishing a public organization scoped package
要将组织范围的包发布为公共包,请使用 npm publish --access public。
🌐 To publish an organization scoped package as public, use npm publish --access public.
npm publish --access public。公共包将在 npm 网站上包名下方显示 public。
🌐 Public packages will say public below the package name on the npm website.
