Skip to content

How to build an engineered front-end library, combined with Github Actions, that automatically publishes to the full flow of Github and NPM

Notifications You must be signed in to change notification settings

dddddf72/Front-end-engineering

Repository files navigation

Front-end-engineering

How to build an engineered front-end library, combined with Github Actions, that automatically publishes to the full flow of Github and NPM

作者:molvqingtai 链接:https://juejin.cn/post/6971812117993226248

package.json 生成之后,我需要添加如下配置项:

   "main": "index.js",
+  "type": "module",
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1"
   },
+  "publishConfig": {
+    "access": "public"
+  }

我们将项目定义为ESM规范,前端社区正逐渐向ESM标准迁移,从Node v12.0.0开始,只要设置了 "type": "module", Node 会将整个项目视为ESM规范,我们就可以直接写裸写 import/export

publishConfig.access表示当前项目发布到NPM的访问级别,它有 restrictedpublic两个选项,restricted表示我们发布到NPM上的是私有包(收费),访问级别默认为 restricted,因为我们是开源项目所以标记为 public

About

How to build an engineered front-end library, combined with Github Actions, that automatically publishes to the full flow of Github and NPM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published