Skip to content

Commit c656145

Browse files
committed
build: build: build: build: add commitizen, husky, and standard-release for better commit messages
1 parent 765ee07 commit c656145

9 files changed

+1968
-824
lines changed

.cz-config.js

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
'use strict'
2+
3+
module.exports = {
4+
extends: ['cz'],
5+
types: [
6+
{ value: 'feat', name: 'feat: A new feature' },
7+
{ value: 'fix', name: 'fix: A bug fix' },
8+
{ value: 'docs', name: 'docs: Documentation only changes' },
9+
{
10+
value: 'style',
11+
name: 'style: Changes that do not affect the meaning of the code\n(white-space, formatting, missing semi-colons, etc)',
12+
},
13+
{
14+
value: 'refactor',
15+
name: 'refactor: A code change that neither fixes a bug nor adds a feature',
16+
},
17+
{
18+
value: 'perf',
19+
name: 'perf: A code change that improves performance',
20+
},
21+
{ value: 'test', name: 'test: Adding missing tests' },
22+
{
23+
value: 'build',
24+
name: 'build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
25+
},
26+
{
27+
value: 'ci',
28+
name: 'ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
29+
},
30+
{
31+
value: 'chore',
32+
name: 'chore: Changes to the build process or auxiliary tools\nand libraries such as documentation generation',
33+
},
34+
{ value: 'revert', name: 'revert: Reverts a previous commit' },
35+
{ value: 'WIP', name: 'WIP: Work in progress' },
36+
],
37+
38+
// override the messages, defaults are as follows
39+
messages: {
40+
type: "Select the type of change that you're committing:",
41+
scope: '\nDenote the SCOPE of this change (optional):',
42+
// used if allowCustomScopes is true
43+
// customScope: 'Denote the SCOPE of this change:',
44+
subject: 'Write a SHORT, IMPERATIVE tense description of the change:\n',
45+
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
46+
breaking: 'List any BREAKING CHANGES (optional):\n',
47+
footer:
48+
'List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:\n',
49+
confirmCommit: 'Are you sure you want to proceed with the commit above?',
50+
},
51+
52+
skipQuestions: ['scope'],
53+
allowCustomScopes: false,
54+
allowBreakingChanges: ['feat', 'fix'],
55+
56+
// limit subject length
57+
subjectLimit: 100,
58+
}

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn commitlint --edit $1

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint-staged

.husky/pre-push

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint

commitlint.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['cz'],
3+
}

package.json

+21-9
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,52 @@
2323
"scripts": {
2424
"serve": "vue-cli-service serve",
2525
"build": "vue-cli-service build --mode production --target lib --name vue-leaflet-minimap ./src/vue-leaflet-minimap.vue",
26-
"lint": "vue-cli-service lint"
26+
"lint": "vue-cli-service lint",
27+
"release": "standard-version",
28+
"prepare": "husky install",
29+
"gitcommit": "cz"
2730
},
2831
"dependencies": {
2932
"leaflet-minimap": "^3.6.1",
3033
"vue2-leaflet": "^2.5.2"
3134
},
3235
"devDependencies": {
36+
"@commitlint/cli": "^12.1.4",
37+
"@commitlint/config-conventional": "^12.1.4",
3338
"@vue/cli-plugin-babel": "^4.4.6",
3439
"@vue/cli-plugin-eslint": "^4.4.6",
3540
"@vue/cli-service": "^4.4.6",
3641
"@vue/eslint-config-prettier": "^6.0.0",
3742
"babel-eslint": "^10.1.0",
43+
"commitizen": "^4.2.4",
44+
"commitlint-config-cz": "^0.13.2",
3845
"core-js": "^3.6.4",
46+
"cz-conventional-changelog": "3.3.0",
47+
"cz-customizable": "^6.3.0",
3948
"eslint": "^7.9.0",
4049
"eslint-plugin-prettier": "^3.1.1",
41-
"eslint-plugin-vue": "^6.2.2",
50+
"eslint-plugin-vue": "^7.9.0",
51+
"husky": "^6.0.0",
4252
"leaflet": "^1.6.0",
43-
"lint-staged": "^9.5.0",
44-
"prettier": "^1.19.1",
53+
"lint-staged": "^11.0.0",
54+
"prettier": "^2.3.0",
55+
"standard-version": "^9.3.0",
4556
"vue": "^2.6.11",
4657
"vue-template-compiler": "^2.6.11"
4758
},
4859
"peerDependencies": {
4960
"leaflet": "^1.6.0"
5061
},
51-
"gitHooks": {
52-
"pre-commit": "lint-staged"
53-
},
5462
"lint-staged": {
5563
"*.{js,jsx,vue}": [
56-
"vue-cli-service lint",
57-
"git add"
64+
"vue-cli-service lint"
5865
]
5966
},
67+
"config": {
68+
"commitizen": {
69+
"path": "./node_modules/cz-customizable"
70+
}
71+
},
6072
"files": [
6173
"src/vue-leaflet-minimap.vue",
6274
"dist/*.js"

src/vue-leaflet-minimap.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default {
5858
this.mapObject.toggle()
5959
},
6060
},
61-
render: function(h) {
61+
render: function (h) {
6262
if (this.ready && this.$slots.default) {
6363
return h('div', { style: { display: 'none' } }, this.$slots.default)
6464
}

0 commit comments

Comments
 (0)