From e8c4d96d76dd77b4add889118c1733877bbfb990 Mon Sep 17 00:00:00 2001 From: davinkevin Date: Thu, 22 Oct 2015 17:04:36 +0200 Subject: [PATCH] feat(conventional-changelog): add conventional-changelog gulp support It's based on 0.0.11, a ticket is open to ask for the equivalent in 0.5.1 (https://github.com/ajoslin/conventional-changelog/issues/117) --- CHANGELOG.md | 0 build/paths.js | 2 ++ build/tasks/conventional-changelog.js | 35 +++++++++++++++++++++++++++ package.json | 6 +++++ 4 files changed, 43 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 build/tasks/conventional-changelog.js diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/build/paths.js b/build/paths.js index 253d17d..e78ef55 100644 --- a/build/paths.js +++ b/build/paths.js @@ -11,6 +11,8 @@ const root = path.dirname(__dirname); export default { root : root, systemConfigJs : `${root}/system.config.js`, + packageJson : `${root}/package.json`, + changeLog : `${root}/CHANGELOG.md`, srcDir: `${root}/${srcDirName}`, releaseDir: `${root}/${releaseDirName}`, releaseDirName: releaseDirName, diff --git a/build/tasks/conventional-changelog.js b/build/tasks/conventional-changelog.js new file mode 100644 index 0000000..feeff69 --- /dev/null +++ b/build/tasks/conventional-changelog.js @@ -0,0 +1,35 @@ +/** + * angularjs-jspm-seed + * Created by kdavin on 22/10/2015. + */ +import gulp from "gulp"; +import fs from 'fs'; +import cg from 'conventional-changelog'; +import util from 'gulp-util'; +import paths from '../paths'; + +const argv = util.env; +const from = argv.from, to = argv.to; + +// Conventional Changelog Generating Task +// Can be use with '--from START_COMMIT --to END_COMMIT --version RELEASED_VERSION_NAME' +// ex : gulp conventional-changelog --from 70a938f811256262b8411d9f05d91f600eac4123 +// it generate all the changelog from the commit id to today, it is useful to use the last commit id of the changelog.md +gulp.task('conventional-changelog', function(cal){ + function changeParsed(err, log){ + if (err) { + return cal(err); + } + fs.writeFile(paths.changeLog, log); + } + fs.readFile(paths.packageJson, 'utf8', function(err, data){ + var ref$, repository, version; + ref$ = JSON.parse(data), repository = ref$.repository, version = argv.vname || ref$.version; + cg({ + repository: repository.url, + version: version, + from: from, + to: to + }, changeParsed); + }); +}); \ No newline at end of file diff --git a/package.json b/package.json index 5972c2e..1de265f 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,9 @@ { + "version": "0.1.0", + "repository": { + "type": "git", + "url": "https://github.com/davinkevin/angularjs-jspm-seed.git" + }, "jspm": { "configFile": "system.config.js", "dependencies": { @@ -21,6 +26,7 @@ "babel": "^5.8.23", "browser-sync": "^2.9.11", "connect-modrewrite": "^0.8.2", + "conventional-changelog": "^0.0.11", "del": "^2.0.2", "gulp": "^3.9.0", "gulp-inject": "^3.0.0",