tiantingrui / daily-harvest

记录每日收获
MIT License
2 stars 0 forks source link

npm 发包教程 #52

Open tiantingrui opened 1 year ago

tiantingrui commented 1 year ago

准备工作

  1. 注册npm账户
  2. 绑定OTA(2FA)
  3. nrm (方便切换npm源)
tiantingrui commented 1 year ago

常用命令

登录npm账户

$ npm login
1. username: xxx
2. password: xxx
3. ota(2fa): xxx  

发布npm包

$ cd  package-root
$ npm publish

如何删除npm包

# 废弃 (废弃不可以重新上传该包)
$ npm deprecate xxx 'a deprecate msg'
# 删除
$ npm unpublish xxx --force

更新npm 包

  1. 更改npm包的版本 version x.y.z
$ npm version major | minor | patch
  1. 重新发布 npm包
    $ npm publish