1.0.0 • Published 2 years ago
front-end-engineering v1.0.0
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的访问级别,它有 restricted
和 public
两个选项,restricted
表示我们发布到NPM上的是私有包(收费),访问级别默认为 restricted
,因为我们是开源项目所以标记为 public
。
1.0.0
2 years ago