Skip to content

Commit

Permalink
Add command to generate CHANGELOG
Browse files Browse the repository at this point in the history
This forms the basis of the CHANGELOG, but the commits
need to be formatted with the linkify command and sorted
into the various sections.
  • Loading branch information
mAAdhaTTah committed Mar 24, 2019
1 parent 4f78f1d commit 212666d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
44 changes: 42 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const concat = require('gulp-concat');
const replace = require('gulp-replace');
const pump = require('pump');
const fs = require('fs');
const shelljs = require('shelljs');

const paths = {
componentsFile: 'components.json',
Expand Down Expand Up @@ -173,7 +174,7 @@ function languagePlugins(cb) {
});
}

function changelog(cb) {
function linkify(cb) {
return pump([
src(paths.changelog),
replace(
Expand All @@ -188,10 +189,49 @@ function changelog(cb) {
], cb);
}

const COMMIT_RE = /^([\da-z]{8})\s(.*)/;

function changes(cb) {
const tag = shelljs.exec('git describe --abbrev=0 --tags', { silent: true }).stdout;
const commits = shelljs
.exec(
`git log ${tag.trim()}..HEAD --oneline`,
{ silent: true }
)
.stdout.split('\n')
.map(line => line.trim())
.filter(line => line !== '')
.map(line => {
const [,hash, msg] = COMMIT_RE.exec(line);
return `* ${msg} [\`${hash}\`]`
})
.join('\n');

const changes = `## Unreleased
${commits}
### New components
### Updated components
### Updated plugins
### Updated themes
### Other changes
* __Website__`;

console.log(changes);
cb();
}

const components = minifyComponents;
const plugins = series(languagePlugins, minifyPlugins);


exports.watch = watchComponentsAndPlugins;
exports.default = parallel(components, plugins, componentsJsonToJs, build);
exports.changelog = changelog;
exports.linkify = linkify;
exports.changes = changes;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"jsdom": "^13.0.0",
"mocha": "^6.0.0",
"pump": "^3.0.0",
"shelljs": "^0.8.3",
"yargs": "^13.2.2"
},
"jspm": {
Expand Down

0 comments on commit 212666d

Please sign in to comment.