
正宗敘利亞 Najel 月桂油12% 阿勒坡手工古皂 180g (±10g)
姆,覺得洗了身體油油的不太好沖
peerDependencies, devDependencies, dependencies
dependencies
跑這個程式需要的套件
devDependencies
開發的時候需要的套件,例如Jest之類的測試工具,但是執行的時候不需要(例如babel)
peerDependencies
告訴安裝這個套件的人,需要自己安裝什麼套件
--save-dev
存到devDependencies,也就是-D
--save
存到dependencies
參考文章:
Types of dependencies
↑解釋最清楚
What’s the difference between dependencies, devDependencies and peerDependencies in npm package.json file?
↑解釋的不怎樣。
安裝套件
npm install git+https://git…..
npm 套件製作
6/16的時候開始研究怎麼做npm套件,爬了一些文章,發現網路很多文章沒有交代很多
細節,需要爬很多文章才知道怎麼做。
在babel編譯的過程中也蠻多問題的
- 如果使用create-react-app的話,babel的config這樣設定就好
"babel": { "presets": [ [ "react-app" ] ] }, - 接下來打指令
rm -rf dist && mkdir dist && babel ./src/components -d dist --copy-files
- 發現錯誤,沒有安裝babel
‘babel’ is not recognized as an internal or external command,
趕快來安裝一下:
npm install --save-dev @babel/cli - 結果又加了一個index.js把所有元件導出,還在package.json加上
"main": "dist/export.js", - 後來又報錯:
Error: [BABEL] C:\demo\monolith\package\src\components\AccountInfo.js: Using `babel-preset-react-app` requires that you specify `NODE_ENV` or `BABEL_ENV` e
nvironment variables. Valid values are "development", "test", and "production". Instead, received: undefined. (While processing: "C:\\demo\\monolith\\packa
ge\\node_modules\\babel-preset-react-app\\index.js")
還要再安裝cross-env
npm i cross-env
再修改指令成rm -rf dist && mkdir dist && cross-env NODE_ENV=development babel ./src/components -d dist --copy-files
- host站要把
package-lock.json和node_modules刪光,再輸入
npm install --save ./../package - 可以加以下指令到script,要重裝很方便
rm -rf node_module/custom_module && npm install
npm線上版:
首先需要先登入
npm login
接下來把代碼編譯 ES6 => ES5
npm run publish:npm
※已經編譯過就可以跳過這步
然後把package.json的名子改掉
"name": "@catsheue/lib",
之後說我要公開?
npm publish --access=public
然後就可以發佈了,注意版本號
npm version 1.0.2
可以直接更新版本號
※打 git tag 1.0.x 並不會更新package.json裡的版本號
npm publish
參考文章
Publishing Packages using npm
How to Publish ES6 React Modules to NPM
Building a React component as an NPM module
The complete guide to publishing a React package to npm
Create a simple React npm package in simple steps using CRA
How to make a beautiful, tiny npm package and publish it
How to Create and Publish React Components using the create-react-app?
How to Publish an Updated Version of an npm Package
How to clean npm cache
Just paste it:
npm cache clean --force
How to Update npm Packages to their Latest Version
- delete the package key/value in package.json
- reinstall it !
webstorm React snippets
為了開發方便還是記一下好了!
flex 必讀文章
A Complete Guide to Flexbox | CSS-Tricks
A Visual Guide to CSS3 Flexbox Properties ― Scotch.io
Flexy Boxes — CSS flexbox playground and code generation tool
Flexbox Froggy – A game for learning CSS flexbox
The Complete CSS Flex Box Tutorial
這篇的圖表還蠻好懂的
CSS Flexbox Tutorial – Vegibit
Visual CSS Flex (Flexbox) Layout Editor / Online Tool
互動式教學,可是介面設計的不太喜歡
react 視覺化工具
promise
promise是一個根據你給的callback function回傳的物件
.callback在目前的promise沒跑完前,絕對不會執行
.在then()裡的callback,不管promise有沒有成功,絕對會執行
參考文章:
Using Promises

