]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
New Chart.js.zip package
authorSimon Brunel <simonbrunel@users.noreply.github.com>
Sat, 14 May 2016 23:19:57 +0000 (01:19 +0200)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Sat, 18 Jun 2016 10:14:31 +0000 (12:14 +0200)
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.

.travis.yml
gulpfile.js
package.json
samples/timeScale/combo-time-scale.html
samples/timeScale/line-time-point-data.html
samples/timeScale/line-time-scale.html

index cdddbcd9da19e0edb383f54a1ba6169551657ebe..6671fc2a40f855705f7494d1c0b7010453d093a1 100644 (file)
@@ -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
index 4396265ca6efb36e64e3145049b385b22575d6e0..991b93f860ff4a55f3df014931cc9f6fcea9dd13 100644 (file)
@@ -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
index bc7c2a404b4084535d61372b2d771b76b9449a66..d4fcf60c40b79c339079d76a36367667de573d6a 100644 (file)
     "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",
index c2d9ee85422d0dba6fd0bb9b5cfb33653eb26ba7..f6c178a7db5298f8e3734f913a683d16663a041e 100644 (file)
@@ -3,9 +3,9 @@
 
 <head>
        <title>Line Chart - Combo Time Scale</title>
-       <script src="../../node_modules/moment/min/moment.min.js"></script>
-       <script src="../../dist/Chart.bundle.js"></script>
+       <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
+       <script src="../../dist/Chart.bundle.js"></script>
        <style>
     canvas {
         -moz-user-select: none;
index 97e03e3fdcb0d1cc3f4fabfc180c609c29394060..ffe2148173eabe66d8ab4ba8054f80e29a54365c 100644 (file)
@@ -3,8 +3,9 @@
 
 <head>
        <title>Time Scale Point Data</title>
-       <script src="../../dist/Chart.bundle.js"></script>
+       <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
+       <script src="../../dist/Chart.bundle.js"></script>
        <style>
     canvas {
         -moz-user-select: none;
@@ -39,7 +40,7 @@
                function newDate(days) {
                        return moment().add(days, 'd').toDate();
                }
-               
+
                function newDateString(days) {
                        return moment().add(days, 'd').format();
                }
index 47b7d10514a30551f194171995a67697df922f34..703e7faa9288b142d823b7173f09530d1db9b119 100644 (file)
@@ -3,9 +3,9 @@
 
 <head>
        <title>Line Chart</title>
-       <script src="../../node_modules/moment/min/moment.min.js"></script>
-       <script src="../../dist/Chart.bundle.js"></script>
+       <script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
+       <script src="../../dist/Chart.bundle.js"></script>
        <style>
     canvas {
         -moz-user-select: none;