Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm publish #36

Open
Myoursky opened this issue Aug 8, 2018 · 0 comments
Open

npm publish #36

Myoursky opened this issue Aug 8, 2018 · 0 comments
Labels

Comments

@Myoursky
Copy link
Owner

Myoursky commented Aug 8, 2018

npm publish(npm发布项目)

package.json简单分析

{
  "name": "myoursky-npm-pkg",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

name: 发布的项目名称

version: 发布的版本

注意: 每次更新代码并发布时需要更新发布版本。此处有一个原则需要遵守。

semvertable

main: 入口文件

发布

npm adduser

此处如果设置了淘宝npm镜像,需要先切回原来的registry。
https://registry.npmjs.org/,不然会默认将user加到淘宝镜像上,
加完之后再切回淘宝镜像。此时为了让项目正常发布,需要在package.json中添加如下配置

"publishConfig": {
  "registry": "https://registry.npmjs.org/"
}

npm publish

发布成功!

npm unpublish

npm unpublish [email protected]

npm publish ignore

发布时如果需要忽略特定文件,则通过将文件名称添加到.npmignore中实现。

@Myoursky Myoursky added the tools label Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant