Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add commit script and commitlint configuration
  • Loading branch information
jrolfs committed Sep 12, 2019
commit cc116ab4b42b4385fab97b09aa0d461ec36d72f4
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['./src/config/commitlint.config'],
}
1 change: 1 addition & 0 deletions commitlint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./dist/config/commitlint.config')
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"build": "node src build",
"lint": "node src lint",
"format": "node src format",
"validate": "node src validate"
"validate": "node src validate",
"commit": "node src commit"
},
"husky": {
"hooks": {
Expand Down Expand Up @@ -43,6 +44,8 @@
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.5.4",
"@commitlint/config-conventional": "^8.1.0",
"@commitlint/prompt": "^8.1.0",
"@typescript-eslint/eslint-plugin": "^2.1.0",
"arrify": "^2.0.1",
"babel-core": "^7.0.0-0",
Expand All @@ -53,6 +56,7 @@
"babel-plugin-transform-inline-environment-variables": "^0.4.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
"browserslist": "^4.6.4",
"commitizen": "^4.0.3",
"concurrently": "^4.1.1",
"cross-env": "^5.1.4",
"cross-spawn": "^6.0.5",
Expand Down
23 changes: 23 additions & 0 deletions src/config/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'test',
],
],
'scope-case': [1, 'always', 'kebab-case'],
'scope-enum': [1, 'always', ['deps', 'build']],
},
}
1 change: 1 addition & 0 deletions src/config/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
babel: require('./babelrc'),
commitlint: require('./commitlint.config'),
eslint: require('./eslintrc'),
jest: require('./jest.config'),
lintStaged: require('./lintstagedrc'),
Expand Down
11 changes: 11 additions & 0 deletions src/scripts/commit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path')
const {bootstrap} = require('commitizen/dist/cli/git-cz')

const here = p => path.join(__dirname, p)

bootstrap({
cliPath: here('../../node_modules/commitizen'),
config: {
path: '@commitlint/prompt',
},
})
Loading