ci: 优化 pre-commit

pull/41/head
zjx0905 2023-04-05 09:29:20 +08:00
parent 2793dd8b5e
commit 30c3503b22
2 changed files with 10 additions and 4 deletions

View File

@ -73,7 +73,7 @@
"vitest": "^0.29.7" "vitest": "^0.29.7"
}, },
"simple-git-hooks": { "simple-git-hooks": {
"pre-commit": "pnpm lint-staged", "pre-commit": "pnpm lint-staged && pnpm test && pnpm build -a",
"commit-msg": "pnpm commitlint --edit $1" "commit-msg": "pnpm commitlint --edit $1"
}, },
"config": { "config": {
@ -82,7 +82,13 @@
} }
}, },
"lint-staged": { "lint-staged": {
"*.(j|t)s": "pnpm lint:fix" "*.{js,json}": [
"prettier --write"
],
"*.ts?(x)": [
"eslint",
"prettier --parser=typescript --write"
]
}, },
"pnpm": { "pnpm": {
"peerDependencyRules": { "peerDependencyRules": {

View File

@ -22,13 +22,13 @@ async function main() {
consola.info('Git add'); consola.info('Git add');
exec('git add .'); exec('git add .');
exec(`git commit -m "chore: release v${version}"`);
exec(`git tag -a v${version} -m "v${version}"`);
consola.info('Git push'); consola.info('Git push');
exec(`git commit -m "chore: release v${version}"`);
exec('git push'); exec('git push');
consola.info('Git push tag'); consola.info('Git push tag');
exec(`git tag -a v${version} -m "v${version}"`);
exec(`git push origin v${version}`); exec(`git push origin v${version}`);
} }