From 0311c267f542dd92bbf9f14c7e9ac4ee56aff21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 9 Jul 2016 20:56:58 +0200 Subject: [PATCH] Gulp: More work on improved publish task for Bower. --- CHANGELOG.md | 17 +++++++++++------ bower.json | 8 ++++---- gulp/jsdoc | 2 +- gulp/tasks/build.js | 2 +- gulp/tasks/docs.js | 2 +- gulp/tasks/load.js | 2 +- gulp/tasks/publish.js | 11 +++++++---- gulp/tasks/watch.js | 1 - gulp/utils/options.js | 27 ++++++++++++++------------- 9 files changed, 40 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2c45b2b..22d3d8d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # Change Log -All notable changes to Paper.js shall be documented in this file, following -common [CHANGELOG](http://keepachangelog.com/) conventions. As of `0.10.0`, -Paper.js adheres to [Semantic Versioning](http://semver.org/). + +## `0.10.2` + +### Fixed +- Get published version to work correctly in Bower again. ## `0.10.1` @@ -14,9 +16,12 @@ Paper.js adheres to [Semantic Versioning](http://semver.org/). ### Preamble This is a huge release for Paper.js as we aim for a version `1.0.0` release -later this year. There are many items in the changelog (and many more items not -in the changelog) so here a high-level overview to frame the long list of -changes: +later this year. As of this version, all notable changes are documented in the +change-log following common [CHANGELOG](http://keepachangelog.com/) conventions. +Paper.js now also adheres to [Semantic Versioning](http://semver.org/). + +There are many items in the changelog (and many more items not in the changelog) +so here a high-level overview to frame the long list of changes: - Boolean operations have been improved and overhauled for reliability and efficiency. These include the path functions to unite, intersect, subtract, diff --git a/bower.json b/bower.json index b0dd0e83..7be82ba4 100644 --- a/bower.json +++ b/bower.json @@ -15,13 +15,13 @@ "main": "dist/paper-full.js", "ignore": [ "build", - "components", - "dist/paper-node.js", - "projects", + "gulp", "node_modules", "package.json", + "projects", "src", - "test" + "test", + "travis" ], "keywords": [ "vector", diff --git a/gulp/jsdoc b/gulp/jsdoc index 698991bf..b6f36edb 160000 --- a/gulp/jsdoc +++ b/gulp/jsdoc @@ -1 +1 @@ -Subproject commit 698991bfba9210c6d94c08bd70ba9f815ea98bdf +Subproject commit b6f36edba33690cee908cadcb24515ec5be97b1d diff --git a/gulp/tasks/build.js b/gulp/tasks/build.js index b0c4636b..7fb687e5 100644 --- a/gulp/tasks/build.js +++ b/gulp/tasks/build.js @@ -17,7 +17,7 @@ var gulp = require('gulp'), whitespace = require('gulp-whitespace'), del = require('del'), extend = require('extend'), - options = require('../utils/options.js')({ suffix: true }); + options = require('../utils/options.js'); // Options to be used in Prepro.js preprocessing through the global __options // object, merged in with the options required above. diff --git a/gulp/tasks/docs.js b/gulp/tasks/docs.js index 0854ac14..217b7293 100644 --- a/gulp/tasks/docs.js +++ b/gulp/tasks/docs.js @@ -14,7 +14,7 @@ var gulp = require('gulp'), del = require('del'), rename = require('gulp-rename'), shell = require('gulp-shell'), - options = require('../utils/options.js')({ suffix: true }); + options = require('../utils/options.js'); var docOptions = { local: 'docs', // Generates the offline docs diff --git a/gulp/tasks/load.js b/gulp/tasks/load.js index f34fe48b..1d301aab 100644 --- a/gulp/tasks/load.js +++ b/gulp/tasks/load.js @@ -21,5 +21,5 @@ gulp.task('load', ['clean:load'], function() { }); gulp.task('clean:load', function() { - return del([ 'dist/paper-full.js', 'dist/paper-core.js', 'dist/node/**' ]); + return del([ 'dist/*.js', 'dist/node/**' ]); }); diff --git a/gulp/tasks/publish.js b/gulp/tasks/publish.js index b07fe442..376e404c 100644 --- a/gulp/tasks/publish.js +++ b/gulp/tasks/publish.js @@ -15,14 +15,14 @@ var gulp = require('gulp'), git = require('gulp-git-streamed'), run = require('run-sequence'), shell = require('gulp-shell'), - options = require('../utils/options.js')({ suffix: false }); + options = require('../utils/options.js'); gulp.task('publish', function() { if (options.branch !== 'develop') { throw new Error('Publishing is only allowed on the develop branch.'); } return run( - 'publish:bump', + 'publish:version', 'publish:dist', 'publish:commit', 'publish:release', @@ -30,7 +30,10 @@ gulp.task('publish', function() { ); }); -gulp.task('publish:bump', function() { +gulp.task('publish:version', function() { + // Since we're executing this on the develop branch but we don't wan the + // version suffixed, reset the version value again. + options.resetVersion(); return gulp.src([ 'package.json', 'component.json' ]) .pipe(bump({ version: options.version })) .pipe(gulp.dest('.')); @@ -58,6 +61,6 @@ gulp.task('publish:release', function() { gulp.task('publish:load', ['load'], function() { return gulp.src('dist') .pipe(git.add()) - .pipe(git.commit('Switch back to load.js versions for development.')) + .pipe(git.commit('Switch back to load.js versions on develop branch.')) .pipe(git.push('origin', 'develop')); }); diff --git a/gulp/tasks/watch.js b/gulp/tasks/watch.js index ce138803..5864e895 100644 --- a/gulp/tasks/watch.js +++ b/gulp/tasks/watch.js @@ -14,7 +14,6 @@ var gulp = require('gulp'), path = require('path'), gutil = require('gulp-util'); - gulp.task('watch', function () { gulp.watch('src/**/*.js', ['jshint']) .on('change', function(event) { diff --git a/gulp/utils/options.js b/gulp/utils/options.js index 1b6b9111..7773e863 100644 --- a/gulp/utils/options.js +++ b/gulp/utils/options.js @@ -20,19 +20,20 @@ function git(command) { return execSync('git ' + command).toString().trim(); } +options.date = git('log -1 --pretty=format:%ad'); +options.branch = git('rev-parse --abbrev-ref HEAD'); + // Get the date of the last commit from this branch for release date: -var date = git('log -1 --pretty=format:%ad'), - branch = git('rev-parse --abbrev-ref HEAD'); +var version = options.version, + branch = options.branch; -extend(options, { - date: date, - branch: branch, - // If we're not on the master branch, use the branch name as a suffix: - suffix: branch === 'master' ? '' : '-' + branch -}); +// If we're not on the master branch, use the branch name as a suffix: +if (branch !== 'master') + options.version += '-' + branch; -module.exports = function(opts) { - return extend({}, options, opts && opts.suffix && { - version: options.version + options.suffix - }); -}; +// Allow the removal of the suffix again, as needed by the publish task. +options.resetVersion = function() { + options.version = version; +} + +module.exports = options;