Skip to content

Commit d59eea9

Browse files
committed
add cibundle.js task:
- call it on npm run cibuild - add to the circle.yml
1 parent e243b7d commit d59eea9

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies:
1717
pre:
1818
- docker pull plotly/imageserver:0.2.1
1919
- npm install
20-
- npm run watch
20+
- npm run cibuild
2121

2222
test:
2323
override:

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"postinstall": "npm run preprocess",
4747
"bundle": "node tasks/bundle.js",
4848
"build": "npm run preprocess && npm run bundle",
49+
"cibuild": "npm run preprocess && npm run cibundle.js",
4950
"watch": "node tasks/watch_plotly.js",
5051
"lint": "cd src && jshint . || true",
5152
"test-jasmine": "karma start test/jasmine/karma.conf.js",

tasks/cibundle.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
var fs = require('fs');
2+
3+
var browserify = require('browserify');
4+
5+
var compressAttributes = require('./util/compress_attributes');
6+
var appendVersion = require('./util/append_version');
7+
var constants = require('./util/constants');
8+
9+
/*
10+
* Trimmed down version of ./bundle.js for CI testing
11+
*
12+
* Outputs plotly.js bundle in build/ and
13+
* plotly-geo-assets.js bundle in dist/
14+
* in accordance with test/image/index.html
15+
*
16+
*/
17+
18+
19+
// Browserify plotly.js
20+
browserify(constants.pathToPlotlySrc, {
21+
standalone: 'Plotly',
22+
transform: [compressAttributes]
23+
})
24+
.bundle(function(err) {
25+
if(err) throw err;
26+
})
27+
.pipe(fs.createWriteStream(constants.pathToPlotlyBuild))
28+
.on('finish', function() {
29+
appendVersion(constants.pathToPlotlyDist, {object: 'Plotly'});
30+
});
31+
32+
33+
// Browserify the geo assets
34+
browserify(constants.pathToPlotlyGeoAssetsSrc, {
35+
standalone: 'PlotlyGeoAssets'
36+
})
37+
.bundle(function(err) {
38+
if(err) throw err;
39+
})
40+
.pipe(fs.createWriteStream(constants.pathToPlotlyGeoAssetsDist))
41+
.on('finish', function() {
42+
appendVersion(constants.pathToPlotlyGeoAssetsDist, {object: 'PlotlyGeoAssets'});
43+
});

0 commit comments

Comments
 (0)