Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dfe13b5

Browse filesBrowse files
authored
Merge pull request #2447 from etpinard/browser-pack-flat
Bundle with browser-pack-flat plugin
2 parents d55a1be + 7b05183 commit dfe13b5
Copy full SHA for dfe13b5

File tree

Expand file treeCollapse file tree

4 files changed

+209
-36
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+209
-36
lines changed

‎package-lock.json

Copy file name to clipboardExpand all lines: package-lock.json
+135Lines changed: 135 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Copy file name to clipboardExpand all lines: package.json
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
},
115115
"devDependencies": {
116116
"brfs": "^1.4.4",
117+
"browser-pack-flat": "^3.0.8",
117118
"browserify": "^15.2.0",
118119
"browserify-transform-tools": "^1.7.0",
119120
"check-node-version": "^3.2.0",
@@ -148,6 +149,7 @@
148149
"prettysize": "1.1.0",
149150
"read-last-lines": "^1.1.0",
150151
"requirejs": "^2.3.1",
152+
"run-series": "^1.1.4",
151153
"through2": "^2.0.3",
152154
"true-case-path": "^1.0.2",
153155
"watchify": "^3.10.0",

‎tasks/bundle.js

Copy file name to clipboard
+46-23Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var path = require('path');
22
var glob = require('glob');
3+
var runSeries = require('run-series');
34

45
var constants = require('./util/constants');
56
var common = require('./util/common');
@@ -30,41 +31,63 @@ if(!doesFileExist(constants.pathToCSSBuild) || !doesFileExist(constants.pathToFo
3031
].join('\n'));
3132
}
3233

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+
});
3842
});
3943

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+
});
4058

4159
// 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);
4464
});
4565

4666
// 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+
});
5176
});
5277

5378
// Browserify the plotly.js partial bundles
5479
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);
5988
});
6089
});
6190

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;
7093
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.