build: add commitlint and commitizen (#4)

* build: add commitlint and commitizen

* docs: add section about commit message to readme

* chore: 🤖 use streamich/git-cz for creating commit message
This commit is contained in:
Krist Wongsuphasawat 2019-02-25 13:24:22 -08:00 committed by Yongjie Zhao
parent 96fbba6399
commit 5586e58776
3 changed files with 20 additions and 2 deletions

View File

@ -90,6 +90,10 @@ yarn build
Each package defines its own build config, linting, and testing. You can have lerna run commands Each package defines its own build config, linting, and testing. You can have lerna run commands
across all packages using the syntax `yarn run test` (or `yarn run test:watch` for watch mode) from the root `@superset-ui` directory. across all packages using the syntax `yarn run test` (or `yarn run test:watch` for watch mode) from the root `@superset-ui` directory.
### Committing
This repository follows [conventional commits](https://www.conventionalcommits.org/en/v1.0.0-beta.3/) guideline for commit messages and has a `commitlint` hook which will require you to have the valid commit message before committing. You can use `npm run commit` to help you create a commit message.
### Publishing ### Publishing
**Prerequisite:** You'll need an [npmjs.com](https://npmjs.com) account that is part of the `@superset-ui` organization. **Prerequisite:** You'll need an [npmjs.com](https://npmjs.com) account that is part of the `@superset-ui` organization.

View File

@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional', '@commitlint/config-lerna-scopes'] };

View File

@ -8,6 +8,7 @@
"build:cjs": "NODE_ENV=production beemo babel --extensions=\".js,.jsx,.ts,.tsx\" ./src --out-dir lib/ --minify --workspaces=\"@superset-ui/!(plugins-demo)\"", "build:cjs": "NODE_ENV=production beemo babel --extensions=\".js,.jsx,.ts,.tsx\" ./src --out-dir lib/ --minify --workspaces=\"@superset-ui/!(plugins-demo)\"",
"build:esm": "NODE_ENV=production beemo babel --extensions=\".js,.jsx,.ts,.tsx\" ./src --out-dir esm/ --esm --minify --workspaces=\"@superset-ui/!(plugins-demo)\"", "build:esm": "NODE_ENV=production beemo babel --extensions=\".js,.jsx,.ts,.tsx\" ./src --out-dir esm/ --esm --minify --workspaces=\"@superset-ui/!(plugins-demo)\"",
"build:assets": "node ./buildAssets.js", "build:assets": "node ./buildAssets.js",
"commit": "git-cz",
"type": "NODE_ENV=production beemo typescript --workspaces=\"@superset-ui/(plugin-*)\" --noEmit", "type": "NODE_ENV=production beemo typescript --workspaces=\"@superset-ui/(plugin-*)\" --noEmit",
"type:dts": "NODE_ENV=production beemo typescript --workspaces=\"@superset-ui/(plugin-*)\" --emitDeclarationOnly", "type:dts": "NODE_ENV=production beemo typescript --workspaces=\"@superset-ui/(plugin-*)\" --emitDeclarationOnly",
"lint": "beemo create-config prettier && beemo eslint \"./packages/*/{src,test,storybook}/**/*.{js,jsx,ts,tsx}\"", "lint": "beemo create-config prettier && beemo eslint \"./packages/*/{src,test,storybook}/**/*.{js,jsx,ts,tsx}\"",
@ -37,17 +38,23 @@
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^7.5.2",
"@commitlint/config-conventional": "^7.5.0",
"@commitlint/config-lerna-scopes": "^7.5.1",
"@commitlint/prompt-cli": "^7.5.0",
"@superset-ui/build-config": "^0.0.3", "@superset-ui/build-config": "^0.0.3",
"@superset-ui/chart": "^0.9.6", "@superset-ui/chart": "^0.9.6",
"@superset-ui/color": "^0.9.5", "@superset-ui/color": "^0.9.5",
"@superset-ui/core": "^0.9.5",
"@superset-ui/connection": "^0.9.5", "@superset-ui/connection": "^0.9.5",
"@superset-ui/core": "^0.9.5",
"@superset-ui/dimension": "^0.9.3", "@superset-ui/dimension": "^0.9.3",
"@superset-ui/number-format": "^0.9.5", "@superset-ui/number-format": "^0.9.5",
"@superset-ui/time-format": "^0.9.5", "@superset-ui/time-format": "^0.9.5",
"@superset-ui/translation": "^0.9.5", "@superset-ui/translation": "^0.9.5",
"commitizen": "^3.0.7",
"fast-glob": "^2.2.6", "fast-glob": "^2.2.6",
"fs-extra": "^7.0.1", "fs-extra": "^7.0.1",
"git-cz": "^1.8.0",
"husky": "^1.1.2", "husky": "^1.1.2",
"lerna": "^3.2.1", "lerna": "^3.2.1",
"lint-staged": "^8.0.4", "lint-staged": "^8.0.4",
@ -78,7 +85,8 @@
], ],
"husky": { "husky": {
"hooks": { "hooks": {
"pre-commit": "lint-staged" "pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
} }
}, },
"lint-staged": { "lint-staged": {
@ -86,5 +94,10 @@
"yarn run prettier --write", "yarn run prettier --write",
"git add" "git add"
] ]
},
"config": {
"commitizen": {
"path": "git-cz"
}
} }
} }