Skip to content

Commit

Permalink
fix(dev): update cz & husky
Browse files Browse the repository at this point in the history
  • Loading branch information
zouhangwithsweet committed Jul 24, 2020
1 parent cdfd204 commit 6902b96
Show file tree
Hide file tree
Showing 5 changed files with 13,872 additions and 25 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
48 changes: 48 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const importFrom = require('import-from')

function getPackages (context) {
return Promise.resolve()
.then(() => {
const ctx = context || {}
const cwd = ctx.cwd || process.cwd()
const Project = importFrom(cwd, '@lerna/project')
const project = new Project(cwd)
return project.getPackages()
})
.then((packages) => {
return packages.map((pkg) => pkg.name).map((name) => (name.charAt(0) === '@' ? name.split('/')[1] : name))
})
}

const scopes = [
'project',
'core',
'style',
'docs',
'ci',
'dev',
'build',
'deploy',
'other'
]

module.exports = {
utils: {getPackages},
rules: {
'scope-enum': (ctx) => getPackages(ctx).then((packages) => [2, 'always', [...packages, ...scopes]]),
'body-leading-blank': [1, 'always'],
'footer-leading-blank': [1, 'always'],
'header-max-length': [2, 'always', 72],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [1, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test', 'improvement'],
],
},
}
26 changes: 21 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"cz": "npx git-cz",
"cz": "git add -A && npx git-cz",
"test": "jest",
"gen": "bash ./scripts/gc.sh",
"storybook": "start-storybook",
Expand All @@ -16,27 +16,43 @@
"vue-router": "^4.0.0-beta.2"
},
"devDependencies": {
"@types/jest": "^26.0.7",
"@babel/core": "^7.10.5",
"@commitlint/cli": "^9.1.1",
"@commitlint/config-conventional": "^9.1.1",
"@storybook/html": "^5.3.19",
"@types/jest": "^26.0.7",
"@vue/compiler-sfc": "^3.0.0-rc.1",
"babel-loader": "^8.1.0",
"babel-preset-vue": "^2.0.2",
"cz-conventional-changelog": "^3.2.0",
"lerna": "^3.22.1",
"husky": "^4.2.5",
"jest": "^24.1.0",
"lerna": "^3.22.1",
"lint-staged": "^10.2.11",
"ts-jest": "^26.1.3",
"vue-jest": "5.0.0-alpha.1",
"vite": "^1.0.0-rc.1",
"ts-loader": "^8.0.1",
"typescript": "^3.9.7",
"vite": "^1.0.0-rc.1",
"vue-jest": "5.0.0-alpha.1",
"vue-loader": "^v16.0.0-beta.4"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push-todo-open": "npm run test",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"*": [
""
]
},
"workspaces": [
"packages/*"
],
Expand Down
Loading

0 comments on commit 6902b96

Please sign in to comment.