From: Simon Brunel Date: Sat, 14 May 2016 23:19:57 +0000 (+0200) Subject: New Chart.js.zip package X-Git-Tag: v2.2.0-rc.1~25^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53a0c5442e3d8f75cacff02bb158e2b4d65c6a9c;p=thirdparty%2FChart.js.git New Chart.js.zip package Samples need to be packaged with built libraries (which one have been removed from the repository), so create a new `gulp package` task to generate a ZIP archive with dist files, samples and the license file. This archive is generated in the ./dist/ folder and will be deployed by Travis along the GH release. Note that the ./dist/ folder is not preserved but merged in the archive root. Also change samples requiring moment.js to load this lib from the CDN instead of the ./node_module folder. --- diff --git a/.travis.yml b/.travis.yml index cdddbcd9d..6671fc2a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ script: - gulp build - gulp test - gulp coverage + - gulp package - cat ./coverage/lcov.info | ./node_modules/.bin/coveralls notifications: @@ -39,6 +40,7 @@ deploy: - "./dist/Chart.bundle.min.js" - "./dist/Chart.js" - "./dist/Chart.min.js" + - "./dist/Chart.js.zip" skip_cleanup: true on: tags: true diff --git a/gulpfile.js b/gulpfile.js index 4396265ca..991b93f86 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -8,6 +8,7 @@ var gulp = require('gulp'), replace = require('gulp-replace'), htmlv = require('gulp-html-validator'), insert = require('gulp-insert'), + zip = require('gulp-zip'), inquirer = require('inquirer'), semver = require('semver'), exec = require('child_process').exec, @@ -49,6 +50,7 @@ var testFiles = [ ]; gulp.task('build', buildTask); +gulp.task('package', packageTask); gulp.task('coverage', coverageTask); gulp.task('watch', watchTask); gulp.task('bump', bumpTask); @@ -101,6 +103,21 @@ function buildTask() { } +function packageTask() { + return merge( + // gather "regular" files landing in the package root + gulp.src([outDir + '*.js', 'LICENSE.md']), + + // since we moved the dist files one folder up (package root), we need to rewrite + // samples src="../dist/ to src="../ and then copy them in the /samples directory. + gulp.src('./samples/**/*', { base: '.' }) + .pipe(streamify(replace(/src="((?:\.\.\/)+)dist\//g, 'src="$1'))) + ) + // finally, create the zip archive + //.pipe(zip('Chart.js.zip')) + .pipe(gulp.dest(outDir)); +} + /* * Usage : gulp bump * Prompts: Version increment to bump diff --git a/package.json b/package.json index bc7c2a404..d4fcf60c4 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,13 @@ "gulp-insert": "~0.5.0", "gulp-jshint": "~1.5.1", "gulp-karma": "0.0.4", - "gulp-replace": "^0.4.0", + "gulp-replace": "^0.5.4", "gulp-size": "~0.4.0", "gulp-streamify": "^1.0.2", "gulp-uglify": "~0.2.x", "gulp-umd": "~0.2.0", "gulp-util": "~2.2.x", + "gulp-zip": "~3.2.0", "inquirer": "^0.5.1", "jasmine": "^2.3.2", "jasmine-core": "^2.3.4", diff --git a/samples/timeScale/combo-time-scale.html b/samples/timeScale/combo-time-scale.html index c2d9ee854..f6c178a7d 100644 --- a/samples/timeScale/combo-time-scale.html +++ b/samples/timeScale/combo-time-scale.html @@ -3,9 +3,9 @@ Line Chart - Combo Time Scale - - + +