npm profile 全方位解读

本文参考了NPM中文文档写作而成的

npm profile 功能

更改注册表配置文件上的设置

npm profile 使用

npm profile get [--json|--parseable][<property>]
npm profile set [--json|--parseable] <property> <value>
npm profile set password
npm profile enable-2fa [auth-and-writes|auth-only]
npm profile disable-2fa

npm profile 说明

在注册表上更改您的配置文件信息。如果您使用的是非 npmjs 注册表,则此功能不可用。

npm profile get [<property>]:显示个人资料的所有属性,或一个或多个特定属性。看起来像:

+-----------------+---------------------------+
| name            | example                   |
+-----------------+---------------------------+
| email           | me@example.com (verified) |
+-----------------+---------------------------+
| two factor auth | auth-and-writes           |
+-----------------+---------------------------+
| fullname        | Example User              |
+-----------------+---------------------------+
| homepage        |                           |
+-----------------+---------------------------+
| freenode        |                           |
+-----------------+---------------------------+
| twitter         |                           |
+-----------------+---------------------------+
| github          |                           |
+-----------------+---------------------------+
| created         | 2015-02-26T01:38:35.892Z  |
+-----------------+---------------------------+
| updated         | 2017-10-02T21:29:45.922Z  |
+-----------------+---------------------------+
  • npm profile set <property> <value>:设置配置文件属性的值。您可以通过以下方式设置以下属性:电子邮件,全名,主页,freenode,twitter,github
  • npm profile set password: 更改您的密码。这是交互式的,系统将提示您输入当前密码和新密码。如果启用了双重身份验证,系统也会提示您输入 OTP。
  • npm profile enable-2fa [auth-and-writes|auth-only]:启用双重身份验证。默认为 auth-and-writesmode。模式有:

    • auth-only:登录或更改帐户的身份验证时要求输入 OTP。网站和命令行上都将需要 OTP。
    • auth-and-writes:始终需要 OTP 进行 auth-only,并且在发布模块,设置 latestdist-tag 或通过 npm access 和更改访问时也需要一个 OTP npm owner。
  • npm profile disable-2fa:禁用两因素身份验证。

详细说明

所有 npm profile 子命令都会接受--json--parseable 会根据这些命令调整其输出。

其中一些命令可能在非 npmjs.com 注册表上不可用。

本文参考NPM中文文档

    原文作者:金色的唉
    原文地址: https://segmentfault.com/a/1190000020598607
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞