Skip to content

Commit

Permalink
feat(all): add commitizen + commitlint with scripts, config & depende…
Browse files Browse the repository at this point in the history
  • Loading branch information
tenretC committed Apr 26, 2018
1 parent d5c77c2 commit 5e55732
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const commitLintConfig = require("./commitlint.config");
const generateScopes = () => {
let rules = [];
for (rule of commitLintConfig.rules["scope-enum"][2]) {
rules.push({ name: rule });
}
return rules;
};

module.exports = {
//See here for options details https://github.com/leonardoanalista/cz-customizable#options
types: [
{ value: "feat", name: "feat: A new feature" },
{ value: "fix", name: "fix: A bug fix" },
{ value: "docs", name: "docs: Documentation only changes" },
{
value: "style",
name:
"style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)"
},
{ value: "refactor", name: "refactor: A code change that neither fixes a bug nor adds a feature" },
{ value: "perf", name: "perf: A code change that improves performance" },
{ value: "test", name: "test: Adding missing tests or correcting existing tests" },
{
value: "build",
name:
"build: Changes that affect the build system or external dependencies\n (example scopes: gulp, broccoli, npm)"
},
{
value: "ci",
name:
"ci: Changes to our CI configuration files and scripts\n (example scopes: Travis, Circle, BrowserStack, SauceLabs)"
},
{
value: "chore",
name: "chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation"
},
{ value: "revert", name: "revert: Reverts a previous commit" }
],
scopes: generateScopes()
};
32 changes: 32 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
extends: ["@commitlint/config-conventional"],

//See here for the rules definition : https://github.com/marionebl/commitlint/blob/master/docs/reference-rules.md
rules: {
"header-max-length": [1, "always", 100],
"scope-enum": [
2,
"always",
[
"core",
"ui",
"test",
"build",
"accessibility",
"build-main",
"developer-guide",
"docs",
"qa",
"stark-all",
"stark-build",
"stark-core",
"stark-demo",
"stark-starter",
"stark-rbac",
"stark-ui",
"testing"
]
],
"scope-case": [2, "always", "lowerCase"]
}
};
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@
"npm": ">=5.3.0"
},
"devDependencies": {
"@angular/core": "5.2.10",
"@angular/compiler": "5.2.10",
"@angular/compiler-cli": "5.2.10",
"@angular/core": "5.2.10",
"@commitlint/cli": "6.1.3",
"@commitlint/config-conventional": "6.1.3",
"codelyzer": "4.3.0",
"conventional-changelog-cli": "1.3.22",
"commitizen": "2.9.6",
"cz-conventional-changelog": "2.1.0",
"cz-customizable": "^5.2.0",
"husky": "0.14.3",
"lint-staged": "7.0.4",
"prettier": "1.12.1",
Expand Down Expand Up @@ -57,6 +62,8 @@
"clean:modules:stark-core": "cd packages/stark-core && npm run clean:modules && cd ../..",
"clean:modules:stark-testing": "cd packages/stark-testing && npm run clean:modules dist && cd ../..",
"clean:modules:starter": "cd starter && npm run clean:modules dist && cd ..",
"commit": "./node_modules/.bin/git-cz",
"commitmsg": "commitlint -e $GIT_PARAMS",
"generate:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"generate:changelog-recent": "conventional-changelog -p angular | tail -n +3",
"preupdate:starter": "npm run clean:starter",
Expand Down Expand Up @@ -98,5 +105,10 @@
"prettier --write",
"git add"
]
},
"config": {
"commitizen": {
"path": "node_modules/cz-customizable"
}
}
}

0 comments on commit 5e55732

Please sign in to comment.