[NPM] Publish npm packages using npm publish

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[NPM] Publish npm packages using npm publish相关的知识,希望对你有一定的参考价值。

In this lesson we will publish our package. We will first add a prepublish script that runs our buildscript; this will ensure the built folder gets added to npm when published. We will also add a .npmignore so that only our built files get installed. We need to run npm adduser to log in to an npm account. We can then run npm publish to publish our package and view it on npm.

Note: if you want to actually publish the package from this course, you‘ll need to rename it since sensitive-words is already taken. You can use a scoped package name for this as well.

 

Inside our .npmigore:

src // ignore, therefore users install our package will not include src folder

 

script:

"prepublish": "npm run build",

Add prepublish script, so that everytime we publish the lib, will make sure use the latest code.

以上是关于[NPM] Publish npm packages using npm publish的主要内容,如果未能解决你的问题,请参考以下文章

发布npm包时报错:You do not have permission to publish “package-demo“.

发布npm包时报错:You do not have permission to publish “package-demo“.

npm publish

NPM 常用命令

在 react 中使用自制的 npm 包。编译失败

在npm上发布一个自己的包