mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Create a task to bump + write version numbers
Also run `gulp release` to tag the latest release.
This commit is contained in:
parent
22c50b0aba
commit
adf6f3abb2
@ -4,7 +4,8 @@
|
|||||||
"description": "Simple HTML5 Charts using the canvas element",
|
"description": "Simple HTML5 Charts using the canvas element",
|
||||||
"homepage": "https://github.com/nnnick/Chart.js",
|
"homepage": "https://github.com/nnnick/Chart.js",
|
||||||
"author": "nnnick",
|
"author": "nnnick",
|
||||||
"main": ["Chart.min.js"],
|
"main": [
|
||||||
"dependencies": {
|
"Chart.min.js"
|
||||||
}
|
],
|
||||||
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
46
gulpfile.js
46
gulpfile.js
@ -5,7 +5,13 @@ var gulp = require('gulp'),
|
|||||||
jshint = require('gulp-jshint'),
|
jshint = require('gulp-jshint'),
|
||||||
size = require('gulp-size'),
|
size = require('gulp-size'),
|
||||||
connect = require('gulp-connect'),
|
connect = require('gulp-connect'),
|
||||||
exec = require('child_process').exec;
|
replace = require('gulp-replace'),
|
||||||
|
inquirer = require('inquirer'),
|
||||||
|
semver = require('semver'),
|
||||||
|
exec = require('child_process').exec,
|
||||||
|
fs = require('fs'),
|
||||||
|
package = require('./package.json'),
|
||||||
|
bower = require('./bower.json');
|
||||||
|
|
||||||
var srcDir = './src/';
|
var srcDir = './src/';
|
||||||
/*
|
/*
|
||||||
@ -28,8 +34,10 @@ gulp.task('build', function(){
|
|||||||
// So we can use this to sort out dependency order - aka include Core first!
|
// So we can use this to sort out dependency order - aka include Core first!
|
||||||
srcFiles.push(srcDir+'*');
|
srcFiles.push(srcDir+'*');
|
||||||
}
|
}
|
||||||
|
|
||||||
return gulp.src(srcFiles)
|
return gulp.src(srcFiles)
|
||||||
.pipe(concat('Chart.js'))
|
.pipe(concat('Chart.js'))
|
||||||
|
.pipe(replace('{{ version }}', package.version))
|
||||||
.pipe(gulp.dest(outputDir))
|
.pipe(gulp.dest(outputDir))
|
||||||
.pipe(uglify({preserveComments:'some'}))
|
.pipe(uglify({preserveComments:'some'}))
|
||||||
.pipe(concat('Chart.min.js'))
|
.pipe(concat('Chart.min.js'))
|
||||||
@ -40,6 +48,42 @@ gulp.task('build', function(){
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Usage : gulp bump
|
||||||
|
* Prompts: Version increment to bump
|
||||||
|
* Output: - New version number written into package.json & bower.json
|
||||||
|
*/
|
||||||
|
|
||||||
|
gulp.task('bump', function(complete){
|
||||||
|
util.log('Current version:', util.colors.cyan(package.version));
|
||||||
|
var choices = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'].map(function(versionType){
|
||||||
|
return versionType + ' (v' + semver.inc(package.version, versionType) + ')';
|
||||||
|
});
|
||||||
|
inquirer.prompt({
|
||||||
|
type: 'list',
|
||||||
|
name: 'version',
|
||||||
|
message: 'What version update would you like?',
|
||||||
|
choices: choices
|
||||||
|
}, function(res){
|
||||||
|
var increment = res.version.split(' ')[0],
|
||||||
|
newVersion = semver.inc(package.version, increment);
|
||||||
|
|
||||||
|
// Set the new versions into the bower/package object
|
||||||
|
package.version = newVersion;
|
||||||
|
bower.version = newVersion;
|
||||||
|
|
||||||
|
// Write these to their own files, then build the output
|
||||||
|
fs.writeFileSync('package.json', JSON.stringify(package, null, 2));
|
||||||
|
fs.writeFileSync('bower.json', JSON.stringify(bower, null, 2));
|
||||||
|
|
||||||
|
complete();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('release', ['build'], function(){
|
||||||
|
exec('git tag -a v' + newVersion);
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task('jshint', function(){
|
gulp.task('jshint', function(){
|
||||||
return gulp.src(srcDir + '*.js')
|
return gulp.src(srcDir + '*.js')
|
||||||
.pipe(jshint())
|
.pipe(jshint())
|
||||||
|
|||||||
@ -12,10 +12,13 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "3.5.x",
|
"gulp": "3.5.x",
|
||||||
"gulp-concat": "~2.1.x",
|
"gulp-concat": "~2.1.x",
|
||||||
|
"gulp-connect": "~2.0.5",
|
||||||
|
"gulp-jshint": "~1.5.1",
|
||||||
|
"gulp-replace": "^0.4.0",
|
||||||
|
"gulp-size": "~0.4.0",
|
||||||
"gulp-uglify": "~0.2.x",
|
"gulp-uglify": "~0.2.x",
|
||||||
"gulp-util": "~2.2.x",
|
"gulp-util": "~2.2.x",
|
||||||
"gulp-jshint": "~1.5.1",
|
"inquirer": "^0.5.1",
|
||||||
"gulp-size": "~0.4.0",
|
"semver": "^3.0.1"
|
||||||
"gulp-connect": "~2.0.5"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
/*!
|
/*!
|
||||||
* Chart.js
|
* Chart.js
|
||||||
* http://chartjs.org/
|
* http://chartjs.org/
|
||||||
|
* Version: {{ version }}
|
||||||
*
|
*
|
||||||
* Copyright 2014 Nick Downie
|
* Copyright 2014 Nick Downie
|
||||||
* Released under the MIT license
|
* Released under the MIT license
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user