Skip to content

Commit

Permalink
Merge pull request #100 from odecee/feature/support-optional-scopes-i…
Browse files Browse the repository at this point in the history
…n-commits

fix(release): support optional scopes in conventional commits via latest cz-customizable-ghooks
  • Loading branch information
uglow authored Dec 17, 2016
2 parents 4e75b83 + 1883441 commit 0a707f4
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion config/release/commitMessageConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ module.exports = {
*/

allowCustomScopes: false,
allowBreakingChanges: ['feat', 'fix']
allowBreakingChanges: ['feat', 'fix'],

// Appends the branch name to the footer of the commit. Useful for tracking commits after branches have been merged
appendBranchNameToCommitMessage: false
};
2 changes: 1 addition & 1 deletion lib/buildTool/npm/npmResources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ release:
packageJsonConfig:
- config.commitizen.path: node_modules/cz-customizable
- config.cz-customizable.config: <%- paths.config.configDir + resources.release.configSubDir %>commitMessageConfig.js
- config.ghooks.commit-msg: ./node_modules/cz-customizable-ghooks/lib/index.js $2
- config.ghooks.commit-msg: node ./node_modules/cz-customizable-ghooks/lib/index.js $2
templateFiles:
- src: commitMessageConfig.js
dest: <%- paths.config.configDir + resources.release.configSubDir %>commitMessageConfig.js
Expand Down
4 changes: 3 additions & 1 deletion lib/buildTool/npm/release/templates/commitMessageConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module.exports = {
*/

allowCustomScopes: true,
allowBreakingChanges: ['feat', 'fix']
allowBreakingChanges: ['feat', 'fix'],

// Appends the branch name to the footer of the commit. Useful for tracking commits after branches have been merged
appendBranchNameToCommitMessage: true
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const fs = require('fs'); // path is declared elsewhere
const confitConfig = yaml.load(fs.readFileSync(path.join(process.cwd(), 'confit.yml')))['generator-confit']; // Try to keep the code lively! If confit.json changes, this code still works.

const HOST = process.env.HOST || confitConfig.serverDev.hostname;
const PORT = process.env.PORT || confitConfig.serverDev.port;
const PORT = Number(process.env.PORT || confitConfig.serverDev.port);

/**
* Webpack Development Server configuration
Expand Down
2 changes: 1 addition & 1 deletion lib/core/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ $packages:

- &pkg_cz-customizable-ghooks
name: cz-customizable-ghooks
version: 1.3.0
version: 1.4.0

- &pkg_enzyme
name: enzyme
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
},
"ghooks": {
"pre-commit": "exact-semver && npm-run-all test:unit:once",
"commit-msg": "./node_modules/cz-customizable-ghooks/lib/index.js $2",
"commit-msg": "node ./node_modules/cz-customizable-ghooks/lib/index.js $2",
"pre-push": "npm-run-all verify test:coverage --silent"
}
},
Expand All @@ -116,13 +116,13 @@
"coveralls": "2.11.15",
"cross-env": "3.1.3",
"cz-customizable": "4.0.0",
"cz-customizable-ghooks": "1.3.0",
"cz-customizable-ghooks": "1.4.0",
"eslint": "3.12.2",
"eslint-config-google": "0.7.0",
"eslint-plugin-node": "2.0.0",
"exact-semver": "1.2.0",
"freeport": "1.0.5",
"gh-pages": "0.11.0",
"gh-pages": "0.12.0",
"ghooks": "1.3.2",
"http-server": "0.9.0",
"istanbul": "0.4.4",
Expand Down
4 changes: 2 additions & 2 deletions test/spec/unit/releaseGenerator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Release Generator', () => {
// There should also be some configuration in package.json/config
let pkg = fs.readJsonSync('package.json');

assert.equal(pkg.config.ghooks['commit-msg'], './node_modules/cz-customizable-ghooks/lib/index.js $2');
assert.equal(pkg.config.ghooks['commit-msg'], 'node ./node_modules/cz-customizable-ghooks/lib/index.js $2');
assert.equal(pkg.config.ghooks['pre-push'], undefined);

done();
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('Release Generator', () => {

assert.equal(pkg.config.commitizen.path, 'node_modules/cz-customizable');
assert.equal(pkg.config['cz-customizable'].config, 'config/release/commitMessageConfig.js');
assert.equal(pkg.config.ghooks['commit-msg'], './node_modules/cz-customizable-ghooks/lib/index.js $2');
assert.equal(pkg.config.ghooks['commit-msg'], 'node ./node_modules/cz-customizable-ghooks/lib/index.js $2');
assert.equal(pkg.config.ghooks['pre-push'], 'npm-run-all verify test:coverage --silent');

done();
Expand Down

0 comments on commit 0a707f4

Please sign in to comment.