Skip to content

Commit

Permalink
chore: implement commitizen (@W-8165492) (forcedotcom#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfsholden authored and rcoringrato-sfdc committed Oct 14, 2020
1 parent 5dcc7f3 commit 657b9ac
Show file tree
Hide file tree
Showing 6 changed files with 445 additions and 40 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
22 changes: 22 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@
"command": "./scripts/port-changes.js",
"type": "shell",
"args": ["${input:verboseOutput}", "-r", "${input:publishType}"]
},
{
"label": "Commit",
"command": "npm",
"type": "shell",
"presentation": {
"focus": true,
"panel": "shared"
},
"args": ["run", "commit"],
"isBackground": false
},
{
"label": "Commitizen Initialization",
"command": "npm",
"type": "shell",
"presentation": {
"focus": false,
"panel": "shared"
},
"args": ["run", "commit-init"],
"isBackground": false
}
],
"inputs": [
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
1. Send us a pull request when you are done. We'll review your code, suggest any
needed changes, and merge it in.

### Committing

1. We enforce commit message format. We recommend using [commitizen](https://github.com/commitizen/cz-cli) by installing it with `npm install -g commitizen` and running `npm run commit-init`. When you commit, we recommend that you use `npm run commit`, which prompts you with a series of questions to format the commit message. Or you can use our VS Code Task `Commit`.
1. The commit message format that we expect is: `type: commit message`. Valid types are: feat, fix, improvement, docs, style, refactor, perf, test, build, ci, chore and revert.
1. Before commit and push, Husky runs several hooks to ensure the commit message is in the correct format and that everything lints and compiles properly.

### CLA

External contributors will be required to sign a Contributor's License
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![npm (scoped)](https://img.shields.io/npm/v/@salesforce/lwc-language-server?label=lwc-language-server&logo=npm)](https://www.npmjs.com/package/@salesforce/lwc-language-server)
[![npm (scoped)](https://img.shields.io/npm/v/@salesforce/aura-language-server?label=aura-language-server&logo=npm)](https://www.npmjs.com/package/@salesforce/aura-language-server)
[![npm (scoped)](https://img.shields.io/npm/v/@salesforce/lightning-lsp-common?label=lightning-lsp-common&logo=npm)](https://www.npmjs.com/package/@salesforce/lightning-lsp-common)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

# Lightning Language Servers

Expand Down
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"url": "https://github.com/forcedotcom/lightning-language-server.git"
},
"devDependencies": {
"@commitlint/cli": "^7",
"@commitlint/config-conventional": "^7",
"commitizen": "^3.0.5",
"cz-conventional-changelog": "^2.1.0",
"@types/node": "^10.12.18",
"@typescript-eslint/eslint-plugin": "^2.22.0",
"@typescript-eslint/parser": "^2.22.0",
Expand All @@ -27,6 +31,8 @@
"scripts": {
"bootstrap": "lerna bootstrap --force-local",
"bump-versions": "lerna version --force-publish --no-git-tag-version --exact --yes",
"commit-init": "commitizen init cz-conventional-changelog --save-dev --save-exact --force",
"commit": "git-cz",
"clean": "lerna run clean --stream",
"cleanTestData": "lerna run cleanTestData --stream",
"build": "lerna run build --stream",
Expand All @@ -43,6 +49,17 @@
"windowsCopySymlinks": "lerna run windowsCopySymlinks --stream --no-bail",
"package": "lerna run package"
},
"husky": {
"hooks": {
"pre-commit": "yarn lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"./{src,test}/**/*.{ts,js}": [
"eslint -c .eslintrc.json --fix"
]
},
"private": true,
"workspaces": {
"packages": [
Expand All @@ -56,5 +73,10 @@
"volta": {
"node": "12.4.0",
"yarn": "1.22.4"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
Loading

0 comments on commit 657b9ac

Please sign in to comment.