Gulp: More work on improved publish task for Bower.

This commit is contained in:
Jürg Lehni 2016-07-09 20:56:58 +02:00
parent 1b1b9a1606
commit 0311c267f5
9 changed files with 40 additions and 32 deletions

View file

@ -1,7 +1,9 @@
# Change Log # 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`, ## `0.10.2`
Paper.js adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Get published version to work correctly in Bower again.
## `0.10.1` ## `0.10.1`
@ -14,9 +16,12 @@ Paper.js adheres to [Semantic Versioning](http://semver.org/).
### Preamble ### Preamble
This is a huge release for Paper.js as we aim for a version `1.0.0` release 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 later this year. As of this version, all notable changes are documented in the
in the changelog) so here a high-level overview to frame the long list of change-log following common [CHANGELOG](http://keepachangelog.com/) conventions.
changes: 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 - Boolean operations have been improved and overhauled for reliability and
efficiency. These include the path functions to unite, intersect, subtract, efficiency. These include the path functions to unite, intersect, subtract,

View file

@ -15,13 +15,13 @@
"main": "dist/paper-full.js", "main": "dist/paper-full.js",
"ignore": [ "ignore": [
"build", "build",
"components", "gulp",
"dist/paper-node.js",
"projects",
"node_modules", "node_modules",
"package.json", "package.json",
"projects",
"src", "src",
"test" "test",
"travis"
], ],
"keywords": [ "keywords": [
"vector", "vector",

@ -1 +1 @@
Subproject commit 698991bfba9210c6d94c08bd70ba9f815ea98bdf Subproject commit b6f36edba33690cee908cadcb24515ec5be97b1d

View file

@ -17,7 +17,7 @@ var gulp = require('gulp'),
whitespace = require('gulp-whitespace'), whitespace = require('gulp-whitespace'),
del = require('del'), del = require('del'),
extend = require('extend'), 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 // Options to be used in Prepro.js preprocessing through the global __options
// object, merged in with the options required above. // object, merged in with the options required above.

View file

@ -14,7 +14,7 @@ var gulp = require('gulp'),
del = require('del'), del = require('del'),
rename = require('gulp-rename'), rename = require('gulp-rename'),
shell = require('gulp-shell'), shell = require('gulp-shell'),
options = require('../utils/options.js')({ suffix: true }); options = require('../utils/options.js');
var docOptions = { var docOptions = {
local: 'docs', // Generates the offline docs local: 'docs', // Generates the offline docs

View file

@ -21,5 +21,5 @@ gulp.task('load', ['clean:load'], function() {
}); });
gulp.task('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/**' ]);
}); });

View file

@ -15,14 +15,14 @@ var gulp = require('gulp'),
git = require('gulp-git-streamed'), git = require('gulp-git-streamed'),
run = require('run-sequence'), run = require('run-sequence'),
shell = require('gulp-shell'), shell = require('gulp-shell'),
options = require('../utils/options.js')({ suffix: false }); options = require('../utils/options.js');
gulp.task('publish', function() { gulp.task('publish', function() {
if (options.branch !== 'develop') { if (options.branch !== 'develop') {
throw new Error('Publishing is only allowed on the develop branch.'); throw new Error('Publishing is only allowed on the develop branch.');
} }
return run( return run(
'publish:bump', 'publish:version',
'publish:dist', 'publish:dist',
'publish:commit', 'publish:commit',
'publish:release', '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' ]) return gulp.src([ 'package.json', 'component.json' ])
.pipe(bump({ version: options.version })) .pipe(bump({ version: options.version }))
.pipe(gulp.dest('.')); .pipe(gulp.dest('.'));
@ -58,6 +61,6 @@ gulp.task('publish:release', function() {
gulp.task('publish:load', ['load'], function() { gulp.task('publish:load', ['load'], function() {
return gulp.src('dist') return gulp.src('dist')
.pipe(git.add()) .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')); .pipe(git.push('origin', 'develop'));
}); });

View file

@ -14,7 +14,6 @@ var gulp = require('gulp'),
path = require('path'), path = require('path'),
gutil = require('gulp-util'); gutil = require('gulp-util');
gulp.task('watch', function () { gulp.task('watch', function () {
gulp.watch('src/**/*.js', ['jshint']) gulp.watch('src/**/*.js', ['jshint'])
.on('change', function(event) { .on('change', function(event) {

View file

@ -20,19 +20,20 @@ function git(command) {
return execSync('git ' + command).toString().trim(); 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: // Get the date of the last commit from this branch for release date:
var date = git('log -1 --pretty=format:%ad'), var version = options.version,
branch = git('rev-parse --abbrev-ref HEAD'); branch = options.branch;
extend(options, { // If we're not on the master branch, use the branch name as a suffix:
date: date, if (branch !== 'master')
branch: branch, options.version += '-' + branch;
// If we're not on the master branch, use the branch name as a suffix:
suffix: branch === 'master' ? '' : '-' + branch
});
module.exports = function(opts) { // Allow the removal of the suffix again, as needed by the publish task.
return extend({}, options, opts && opts.suffix && { options.resetVersion = function() {
version: options.version + options.suffix options.version = version;
}); }
};
module.exports = options;