跳至主要内容

[Note] Setting Started Project Environment

開發上環境基本設定

pre commit

git commit 規範的工具,規範產生正規的 commit message 。

  • conventional-changelog/commitlint
    • @commitlint/config-conventional
      echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
      npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'
  • conventional-changelog/conventional-changelog
    "devDependencies": {
    "conventional-changelog-angular": "^5.0.13",
    "conventional-changelog-cli": "^2.2.2",
  • typicode/husky
    npx husky-init && npm install
  • commitizen/cz-cli
    • install dev package
      npm install commitizen --save-dev
      npm install @commitlint/cz-commitlint --save-dev
    • package.json
      "config": {
      "commitizen": {
      "path": "@commitlint/cz-commitlint"
      }
      }
    • add hook
      npx husky add .husky/prepare-commit-msg 'exec < /dev/tty && node_modules/.bin/cz --hook || true'

npm version & gen changelog

依據 commit message 異動 package 版號以及產生異動文件。

dotenv-flow

  • dotenv-flow 可以使用不同的 .env*,像是 .env.development, .env.production, .env.local