|
1 | 1 | var path = require('path'); |
2 | 2 | var glob = require('glob'); |
| 3 | +var runSeries = require('run-series'); |
3 | 4 |
|
4 | 5 | var constants = require('./util/constants'); |
5 | 6 | var common = require('./util/common'); |
@@ -30,41 +31,63 @@ if(!doesFileExist(constants.pathToCSSBuild) || !doesFileExist(constants.pathToFo |
30 | 31 | ].join('\n')); |
31 | 32 | } |
32 | 33 |
|
33 | | -// Browserify plotly.js |
34 | | -_bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDist, { |
35 | | - standalone: 'Plotly', |
36 | | - debug: DEV, |
37 | | - pathToMinBundle: constants.pathToPlotlyDistMin |
| 34 | +// "Browserify" the locales |
| 35 | +var localeGlob = path.join(constants.pathToLib, 'locales', '*.js'); |
| 36 | +glob(localeGlob, function(err, files) { |
| 37 | + files.forEach(function(file) { |
| 38 | + var outName = 'plotly-locale-' + path.basename(file); |
| 39 | + var outPath = path.join(constants.pathToDist, outName); |
| 40 | + wrapLocale(file, outPath); |
| 41 | + }); |
38 | 42 | }); |
39 | 43 |
|
| 44 | +// list of tasks to pass to run-series to not blow up |
| 45 | +// memory consumption. |
| 46 | +var tasks = []; |
| 47 | + |
| 48 | +// Browserify plotly.js |
| 49 | +tasks.push(function(cb) { |
| 50 | + _bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDist, { |
| 51 | + standalone: 'Plotly', |
| 52 | + debug: DEV, |
| 53 | + compressAttrs: true, |
| 54 | + packFlat: true, |
| 55 | + pathToMinBundle: constants.pathToPlotlyDistMin |
| 56 | + }, cb); |
| 57 | +}); |
40 | 58 |
|
41 | 59 | // Browserify the geo assets |
42 | | -_bundle(constants.pathToPlotlyGeoAssetsSrc, constants.pathToPlotlyGeoAssetsDist, { |
43 | | - standalone: 'PlotlyGeoAssets' |
| 60 | +tasks.push(function(cb) { |
| 61 | + _bundle(constants.pathToPlotlyGeoAssetsSrc, constants.pathToPlotlyGeoAssetsDist, { |
| 62 | + standalone: 'PlotlyGeoAssets' |
| 63 | + }, cb); |
44 | 64 | }); |
45 | 65 |
|
46 | 66 | // Browserify the plotly.js with meta |
47 | | -_bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDistWithMeta, { |
48 | | - standalone: 'Plotly', |
49 | | - debug: DEV, |
50 | | - then: makeSchema(constants.pathToPlotlyDistWithMeta, constants.pathToSchema) |
| 67 | +tasks.push(function(cb) { |
| 68 | + _bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDistWithMeta, { |
| 69 | + standalone: 'Plotly', |
| 70 | + debug: DEV, |
| 71 | + packFlat: true |
| 72 | + }, function() { |
| 73 | + makeSchema(constants.pathToPlotlyDistWithMeta, constants.pathToSchema)(); |
| 74 | + cb(); |
| 75 | + }); |
51 | 76 | }); |
52 | 77 |
|
53 | 78 | // Browserify the plotly.js partial bundles |
54 | 79 | constants.partialBundlePaths.forEach(function(pathObj) { |
55 | | - _bundle(pathObj.index, pathObj.dist, { |
56 | | - standalone: 'Plotly', |
57 | | - debug: DEV, |
58 | | - pathToMinBundle: pathObj.distMin |
| 80 | + tasks.push(function(cb) { |
| 81 | + _bundle(pathObj.index, pathObj.dist, { |
| 82 | + standalone: 'Plotly', |
| 83 | + debug: DEV, |
| 84 | + compressAttrs: true, |
| 85 | + packFlat: true, |
| 86 | + pathToMinBundle: pathObj.distMin |
| 87 | + }, cb); |
59 | 88 | }); |
60 | 89 | }); |
61 | 90 |
|
62 | | -// "Browserify" the locales |
63 | | -var localeGlob = path.join(constants.pathToLib, 'locales', '*.js'); |
64 | | -glob(localeGlob, function(err, files) { |
65 | | - files.forEach(function(file) { |
66 | | - var outName = 'plotly-locale-' + path.basename(file); |
67 | | - var outPath = path.join(constants.pathToDist, outName); |
68 | | - wrapLocale(file, outPath); |
69 | | - }); |
| 91 | +runSeries(tasks, function(err) { |
| 92 | + if(err) throw err; |
70 | 93 | }); |
0 commit comments