Open gracekrcx opened 3 years ago
npm dependencies For example, these are all valid:
{ "dependencies" :
{ "foo" : "1.0.0 - 2.9999.9999"
, "bar" : ">=1.0.2 <2.1.2"
, "baz" : ">1.0.2 <=2.3.4"
, "boo" : "2.0.1"
, "qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0"
, "asd" : "http://asdf.com/asdf.tar.gz"
, "til" : "~1.2"
, "elf" : "~1.2.3"
, "two" : "2.x"
, "thr" : "3.3.x"
, "lat" : "latest"
, "dyl" : "file:../dyl"
}
}
dependencies 是這個專案有用到的 package file 是,安裝此 path 下的相依 package
參考文章: NPM使用Local Modules
Bundle, Publish and Use A React Component Library | Frontend Cookbook 4 文章裡提到: 因為這是個 React Component Library,而且只會被用在使用 Webpack Bundler 的 Project,所以這邊我們只用 esm format 做 Output。 ---> 這句話感覺像是,不需要是 CJS 的格式,因為只會用在 client react 上面
rollup+antd构建npm包 Ant Design + rollup
Build a Modern JS Project - #5 Rollup with CJS, ESM & UMD 蠻完整的一個課程
The complete guide to publishing a React package to npm 把完整的步驟寫出來了
Your custom React component 也是一個蠻完整的課程
David Wells - Building a self-documenting component library for your company
目標
讓 components 被不同的專案引用
package vs Git submodules
Git Submodule
好處package
好處npm upgrade
需考慮的點:
也可以說當把檔案包成 dist 後 可以有幾條路,去發佈 package
相關名詞解釋
目前解讀 npm registry 就是如果你想把 package 放在 npm 讓 everyone 下載,就必須先去註冊一個資料,讓 npm 可以解讀一些 package info
實作分享文章: Bundle, Publish and Use A React Component Library | Frontend Cookbook 4
實作分享文章: verdaccio verdaccio gitHub Day 27 - 三周目 - 五分鐘建立私有 NPM: verdaccio [筆記] 建立自己的 npm, 以npm Orgs跟Verdaccio為例 [通过verdaccio搭建私有的包管理器]
ES6 Modules : 簡稱 ESM,在 ECMAScript 2015 被提出,跑在 browser 的標準
CommonJS : 簡稱 CJS, Node.js 採用標準
[試著把切版專案升級到 gulp4.0 吧] Day06 來自 gulp 的 hello world:JavaScript 模組化方案 有張對照圖 JS 中的模块化方案
遇到的問題
or
參考文章
利用 shell script 快速產出前端專案交付上版檔案 Day 27 - 三周目 - 五分鐘建立私有 NPM: verdaccio React 元件開發指南
npm install private repositories by dependency in package.json
npm install private github repositories by dependency in package.json How to install an npm package from GitHub directly? Installing private Git repositories through npm install in Docker