npm发包流程

1、注册账号

打开https://www.npmjs.com/,注册一个账号。注册好后到注册的邮箱确认一下。

 

2、查看项目的package.json配置

可以在这里配置name(包名)、version(版本号)、description(描述)、main(入口文件)、files(包含的文件夹)等。

 

3、确认npm的源是https://registry.npmjs.org

查看当前源

npm config get registry

修改源

npm config set registry https://registry.npmjs.org

 

4、在终端登录账号

npm adduser

按提示输入用户名和密码等(注意密码输入是不显示的,不是没写上)

 

5、发包

发包前确认自己的项目构建好了,然后在命令行运行

npm publish --access public

发布成功后就可以在npm网站上找到了,然后就可以在项目里安装自己的包了(^o^)/~

     

 

6、 管理包的开发者(npm-owner)

参考https://docs.npmjs.com/cli/v8/commands/npm-owner

  • 添加owner
npm owner add <user> [<@scope>/]<pkg>
  • 移除owner
npm owner rm <user> [<@scope>/]<pkg>
  • 查看owner
npm owner ls [<@scope>/]<pkg>

例子:

npm owner add myname project-name
npm owner rm myname project-name
npm owner ls project-name

 

END-------------------------------

I see skies of blue, clouds of white

The bright blessed day, the dark sacred night

And I think to myself, what a wonderful world

I see trees of green, red roses too

I see them bloom for me and you

And I think to myself, what a wonderful world

 

posted @ 2021-08-20 17:29  麦豇豆  阅读(231)  评论(0编辑  收藏  举报