Content-Length: 456277 | pFad | http://github.com/chartjs/chartjs-plugin-deferred/commit/f428aeba494b9433e4a820e7a59878fa3c0af716

0B Generate the Chart.Deferred.js.zip package · chartjs/chartjs-plugin-deferred@f428aeb · GitHub
Skip to content

Commit f428aeb

Browse files
committed
Generate the Chart.Deferred.js.zip package
New `gulp package` task to ZIP dist files, samples and the license file. The archive is generated in the /dist folder and is deployed by Travis along the GH release. Note that the dist folder is not preserved but merged in the package root directory.
1 parent d0dc6fe commit f428aeb

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ node_js:
33
- '4.4'
44

55
script:
6-
- gulp build
76
- gulp lint
7+
- gulp build
8+
- gulp package
89

910
deploy:
1011
provider: releases
@@ -13,6 +14,7 @@ deploy:
1314
file:
1415
- "./dist/Chart.Deferred.js"
1516
- "./dist/Chart.Deferred.min.js"
17+
- "./dist/Chart.Deferred.js.zip"
1618
skip_cleanup: true
1719
on:
1820
tags: true

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,19 @@ Note that default options will defer the chart loading until the first line of p
3838

3939
## Development
4040

41-
The following commands are available from the repository root (requires [Node.js](https://nodejs.org/))
41+
You first need to install node dependencies (requires [Node.js](https://nodejs.org/)):
42+
43+
```shell
44+
> npm install
45+
```
46+
47+
The following commands will then be available from the repository root:
4248

4349
```shell
44-
> npm install // initialize node dependencies
4550
> gulp build // build dist files
4651
> gulp build --watch // build and watch for changes
4752
> gulp lint // perform code linting
53+
> gulp package // create an archive with dist files and samples
4854
```
4955

5056
## License

gulpfile.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ var replace = require('gulp-replace');
77
var streamify = require('gulp-streamify');
88
var uglify = require('gulp-uglify');
99
var gutil = require('gulp-util');
10+
var zip = require('gulp-zip');
11+
var merge = require('merge2');
1012
var path = require('path');
1113
var package = require('./package.json');
1214

1315
var srcDir = './src/';
1416
var outDir = './dist/';
17+
var samplesDir = './samples/';
1518

1619
var header = "/*!\n\
1720
* Chart.Deferred.js\n\
@@ -25,6 +28,7 @@ var header = "/*!\n\
2528

2629
gulp.task('build', buildTask);
2730
gulp.task('lint', lintTask);
31+
gulp.task('package', packageTask);
2832
gulp.task('default', ['build']);
2933

3034
function watch(glob, task) {
@@ -57,9 +61,28 @@ function buildTask() {
5761
}
5862

5963
function lintTask() {
60-
var files = [srcDir + '**/*.js'];
64+
var files = [
65+
srcDir + '**/*.js',
66+
samplesDir + '**/*.js'
67+
];
68+
6169
return gulp.src(files)
6270
.pipe(eslint())
6371
.pipe(eslint.format())
6472
.pipe(eslint.failAfterError());
6573
}
74+
75+
function packageTask() {
76+
return merge(
77+
// gather "regular" files landing in the package root
78+
gulp.src([outDir + '*.js', 'LICENSE.md']),
79+
80+
// dist files in the package are in the root, so we need to rewrite samples
81+
// src="../dist/ to src="../ and then copy them in the /samples directory.
82+
gulp.src(samplesDir + '**/*', { base: '.' })
83+
.pipe(streamify(replace('src="../dist/', 'src="../')))
84+
)
85+
// finally, create the zip archive
86+
.pipe(zip('Chart.Deferred.js.zip'))
87+
.pipe(gulp.dest(outDir));
88+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"gulp-streamify": "^1.0.2",
1919
"gulp-uglify": "^1.5.3",
2020
"gulp-util": "^3.0.7",
21+
"gulp-zip": "^3.2.0",
22+
"merge2": "^1.0.2",
2123
"path": "^0.12.7",
2224
"yargs": "^4.7.1"
2325
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/chartjs/chartjs-plugin-deferred/commit/f428aeba494b9433e4a820e7a59878fa3c0af716

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy