Skip to content

Commit 34460c3

Browse files
committed
tasks: dry up paths to partial bundles
1 parent dcb1229 commit 34460c3

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

tasks/bundle.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,11 @@ _bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDistWithMeta, {
5454
});
5555

5656
// Browserify the plotly.js partial bundles
57-
constants.partialBundleNames.forEach(function(name) {
58-
var pathToIndex = path.join(constants.pathToLib, 'index-' + name + '.js'),
59-
pathToBundle = path.join(constants.pathToDist, 'plotly-' + name + '.js'),
60-
pathToMinBundle = path.join(constants.pathToDist, 'plotly-' + name + '.min.js');
61-
62-
_bundle(pathToIndex, pathToBundle, {
57+
constants.partialBundlePaths.forEach(function(pathObj) {
58+
_bundle(pathObj.index, pathObj.dist, {
6359
standalone: 'Plotly',
6460
debug: DEV,
65-
pathToMinBundle: pathToMinBundle
61+
pathToMinBundle: pathObj.distMin
6662
});
6763
});
6864

tasks/util/constants.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var path = require('path');
2-
32
var pkg = require('../../package.json');
43

54
var pathToRoot = path.join(__dirname, '../../');
@@ -13,6 +12,19 @@ var pathToTopojsonSrc = path.join(
1312
path.dirname(require.resolve('sane-topojson')), 'dist/'
1413
);
1514

15+
var partialBundleNames = [
16+
'basic', 'cartesian', 'geo', 'gl3d', 'gl2d', 'mapbox'
17+
];
18+
19+
var partialBundlePaths = partialBundleNames.map(function(name) {
20+
return {
21+
name: name,
22+
index: path.join(pathToLib, 'index-' + name + '.js'),
23+
dist: path.join(pathToDist, 'plotly-' + name + '.js'),
24+
distMin: path.join(pathToDist, 'plotly-' + name + '.min.js')
25+
};
26+
});
27+
1628
var year = (new Date()).getFullYear();
1729

1830
module.exports = {
@@ -29,9 +41,8 @@ module.exports = {
2941
pathToPlotlyDistMin: path.join(pathToDist, 'plotly.min.js'),
3042
pathToPlotlyDistWithMeta: path.join(pathToDist, 'plotly-with-meta.js'),
3143

32-
partialBundleNames: [
33-
'basic', 'cartesian', 'geo', 'gl3d', 'gl2d', 'mapbox'
34-
],
44+
partialBundleNames: partialBundleNames,
45+
partialBundlePaths: partialBundlePaths,
3546

3647
pathToTopojsonSrc: pathToTopojsonSrc,
3748
pathToTopojsonDist: path.join(pathToDist, 'topojson/'),

0 commit comments

Comments
 (0)