Skip to content

Commit

Permalink
style: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Jul 18, 2019
1 parent bd3470a commit e916973
Show file tree
Hide file tree
Showing 7 changed files with 513 additions and 448 deletions.
9 changes: 4 additions & 5 deletions conventional-changelog.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
'use strict';
"use strict";

const Q = require(`q`);
const parserOpts = require(`./parser-opts`);
const writerOpts = require(`./writer-opts`);

module.exports = Q.all([parserOpts, writerOpts])
.spread((parserOpts, writerOpts) => {
return {parserOpts, writerOpts};
});
module.exports = Q.all([parserOpts, writerOpts]).spread((parserOpts, writerOpts) => {
return { parserOpts, writerOpts };
});
60 changes: 28 additions & 32 deletions conventional-recommended-bump.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
'use strict';
"use strict";

module.exports = {
whatBump: (commits) => {
let level = 2;
let breakings = 0;
let features = 0;
whatBump: commits => {
let level = 2;
let breakings = 0;
let features = 0;

commits.forEach(commit => {
if (commit.notes.length > 0) {
breakings += commit.notes.length;
level = 0;
} else if (commit.type === `feat`) {
features += 1;
if (level === 2) {
level = 1;
}
}
});
commits.forEach(commit => {
if (commit.notes.length > 0) {
breakings += commit.notes.length;
level = 0;
} else if (commit.type === `feat`) {
features += 1;
if (level === 2) {
level = 1;
}
}
});

return {
level: level,
reason: `There are ${breakings} BREAKING CHANGES and ${features} features`
};
},
return {
level: level,
reason: `There are ${breakings} BREAKING CHANGES and ${features} features`
};
},

parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?\: (.*)$/,
headerCorrespondence: [
`type`,
`scope`,
`subject`
],
noteKeywords: `BREAKING CHANGE`,
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
}
parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?\: (.*)$/,
headerCorrespondence: [`type`, `scope`, `subject`],
noteKeywords: `BREAKING CHANGE`,
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
}
};
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
'use strict';
"use strict";

const Q = require(`q`);
const conventionalChangelog = require(`./conventional-changelog`);
const parserOpts = require(`./parser-opts`);
const recommendedBumpOpts = require(`./conventional-recommended-bump`);
const writerOpts = require(`./writer-opts`);

module.exports = Q.all([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts])
.spread((conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts) => {
return {conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts};
});
module.exports = Q.all([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts]).spread(
(conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts) => {
return { conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts };
}
);
27 changes: 23 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "conventional-changelog angular preset",
"main": "index.js",
"scripts": {
"lint": "jshint *.js --exclude node_modules && jscs *.js",
"test": "mocha --timeout 30000 && npm run-script lint",
"test-windows": "mocha --timeout 30000"
"test": "mocha --timeout 30000",
"test-windows": "mocha --timeout 30000",
"prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\""
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -36,16 +36,35 @@
"chai": "^3.4.1",
"conventional-changelog-core": "^1.9.5",
"git-dummy-commit": "^1.1.1",
"husky": "^3.0.0",
"istanbul": "^0.4.1",
"jscs": "^3.0.7",
"jshint": "^2.9.1",
"lint-staged": "^9.2.0",
"mocha": "*",
"prettier": "^1.18.2",
"shelljs": "^0.7.3",
"through2": "^2.0.0"
},
"dependencies": {
"compare-func": "^1.3.1",
"conventional-commit-types": "^2.1.1",
"q": "^1.4.1"
},
"prettier": {
"singleQuote": false,
"printWidth": 120,
"tabWidth": 4
},
"husky": {
"hooks": {
"precommit": "lint-staged"
}
},
"lint-staged": {
"*.{js,jsx,ts,tsx,css}": [
"prettier --write",
"git add"
]
}
}
}
16 changes: 6 additions & 10 deletions parser-opts.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
'use strict';
"use strict";

module.exports = {
headerPattern: /^(\w*)(?:\((.*)\))?\: (.*)$/,
headerCorrespondence: [
`type`,
`scope`,
`subject`
],
noteKeywords: [`BREAKING CHANGE`, `BREAKING CHANGES`],
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
headerPattern: /^(\w*)(?:\((.*)\))?\: (.*)$/,
headerCorrespondence: [`type`, `scope`, `subject`],
noteKeywords: [`BREAKING CHANGE`, `BREAKING CHANGES`],
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
};
Loading

0 comments on commit e916973

Please sign in to comment.