Commit 41a1d5ef authored by 曾沂轮's avatar 曾沂轮

Feat: add commit lint optional

parent c4a8467f
module.exports = { module.exports = {
renderFiles: [ renderFiles: ['package.json', 'README.md'],
'package.json',
'README.md'
],
filters: { filters: {
commitValid: [
'.husky'
]
}, },
prompts: { prompts: {
commitValid: {
type: 'confirm',
default: false,
message: 'Add git commit valid to you project',
},
name: { name: {
type: 'string', type: 'string',
required: true, required: true,
message: 'Project name' message: 'Project name',
}, },
description: { description: {
type: 'string', type: 'string',
...@@ -19,7 +24,7 @@ module.exports = { ...@@ -19,7 +24,7 @@ module.exports = {
}, },
author: { author: {
type: 'string', type: 'string',
message: 'Author' message: 'Author',
} },
} },
} };
\ No newline at end of file \ No newline at end of file
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit $1
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install lint-staged
npx --no-install pretty-quick --staged
...@@ -7,12 +7,18 @@ ...@@ -7,12 +7,18 @@
"dev": "vite", "dev": "vite",
"build": "vue-tsc --noEmit && vite build", "build": "vue-tsc --noEmit && vite build",
"serve": "vite preview", "serve": "vite preview",
"lint": "eslint \"src/*.ts\" \"src/**\" --fix" "lint": "eslint \"src/*.ts\" \"src/**\" --fix"{{#commitValid}},
"prepare": "husky install"{{/commitValid}}
}, },
"dependencies": { "dependencies": {
"vue": "^3.2.13" "vue": "^3.2.13"
}, },
"devDependencies": { "devDependencies": {
{{#commitValid}}
"@commitlint/cli": "^16.2.3",
"@smart/commitlint-config": "^0.1.2",
"@smart/conventional-changelog-smart": "^1.0.6",
{{/commitValid}}
"@smart/eslint-config-typescript": "^2.0.0", "@smart/eslint-config-typescript": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^5.21.0", "@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0", "@typescript-eslint/parser": "^5.21.0",
...@@ -22,9 +28,19 @@ ...@@ -22,9 +28,19 @@
"@vue/eslint-config-typescript": "^10.0.0", "@vue/eslint-config-typescript": "^10.0.0",
"eslint": "^8.14.0", "eslint": "^8.14.0",
"eslint-plugin-vue": "^8.7.1", "eslint-plugin-vue": "^8.7.1",
"prettier": "^2.4.1", {{#commitValid}}
"husky": "^7.0.4",
"lint-staged": "^12.4.1",
{{/commitValid}}
"prettier": "2.6.2",
{{#commitValid}}
"pretty-quick": "3.1.3",
{{/commitValid}}
"typescript": "^4.6.3", "typescript": "^4.6.3",
"vite": "^2.9.6", "vite": "^2.9.6",
"vue-tsc": "^0.34" "vue-tsc": "^0.34"
} }{{#commitValid}},
"lint-staged": {
"*.{vue,js,ts,jsx,tsx}": "eslint --fix"
}{{/commitValid}}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment