Skip to content

Commit

Permalink
feat: new commitizen implementation (#134)
Browse files Browse the repository at this point in the history
@W-8080532@
  • Loading branch information
LisandroFernandezSF authored and lcampos committed Sep 16, 2020
1 parent 4c59248 commit 325e600
Show file tree
Hide file tree
Showing 6 changed files with 1,527 additions and 22 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"]
}
28 changes: 28 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@
"command": "./scripts/publish-workflow.sh",
"type": "shell",
"args": ["${input:circleCiId}", "${input:publishType}"]
},
{
"label": "Commit",
"command": "yarn",
"type": "shell",
"presentation": {
"focus": true,
"panel": "shared",
},
"args": [
"run",
"commit"
],
"isBackground": false
},
{
"label": "Commitizen Initialization",
"command": "yarn",
"type": "shell",
"presentation": {
"focus": false,
"panel": "shared",
},
"args": [
"run",
"commit-init"
],
"isBackground": false
}
],
"inputs": [
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![CircleCI](https://circleci.com/gh/forcedotcom/source-deploy-retrieve.svg?style=svg&circle-token=8cab4c48eb81996544b9fa3dfa29e6734376b73f)](https://circleci.com/gh/forcedotcom/source-deploy-retrieve)
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
![npm (scoped)](https://img.shields.io/npm/v/@salesforce/source-deploy-retrieve)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

Typescript Library to support the Salesforce extensions for VS Code.

Expand Down
6 changes: 6 additions & 0 deletions contributing/commit-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ Ignore warnings and CLI update messages when using --json (#406)
@W-4485495@
```

### 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 will prompt 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 will run several hooks to ensure the commit message is in the correct format and that everything lints and compiles properly.
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"xmldom-sfdx-encoding": "^0.1.29"
},
"devDependencies": {
"@commitlint/cli": "^7",
"@commitlint/config-conventional": "^7",
"@salesforce/ts-sinon": "^1.1.2",
"@salesforce/ts-types": "^1.4.2",
"@types/archiver": "^3.1.0",
Expand All @@ -45,6 +47,8 @@
"@typescript-eslint/eslint-plugin": "^2.22.0",
"@typescript-eslint/parser": "^2.22.0",
"chai": "^4",
"commitizen": "^3.0.5",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-header": "^3.0.0",
Expand All @@ -64,6 +68,8 @@
},
"scripts": {
"build": "shx rm -rf ./lib && tsc -b",
"commit-init": "commitizen init cz-conventional-changelog --save-dev --save-exact --force",
"commit": "git-cz",
"format": "prettier --config .prettierrc --loglevel warn --write './{src,test,scripts}/**/*.{js,json,ts}'",
"lint": "eslint -c .eslintrc.json --ext .ts ./src ./test",
"local:install": "./scripts/localInstall.js install",
Expand All @@ -75,7 +81,8 @@
},
"husky": {
"hooks": {
"pre-commit": "yarn lint-staged"
"pre-commit": "yarn lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
Expand All @@ -86,5 +93,10 @@
"volta": {
"node": "12.4.0",
"yarn": "1.22.4"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
Loading

0 comments on commit 325e600

Please sign in to comment.