Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
},
"devDependencies": {
"brfs": "^1.4.4",
"browser-pack-flat": "^3.0.8",
"browserify": "^15.2.0",
"browserify-transform-tools": "^1.7.0",
"check-node-version": "^3.2.0",
Expand Down Expand Up @@ -148,6 +149,7 @@
"prettysize": "1.1.0",
"read-last-lines": "^1.1.0",
"requirejs": "^2.3.1",
"run-series": "^1.1.4",
"through2": "^2.0.3",
"true-case-path": "^1.0.2",
"watchify": "^3.10.0",
Expand Down
69 changes: 46 additions & 23 deletions tasks/bundle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path');
var glob = require('glob');
var runSeries = require('run-series');

var constants = require('./util/constants');
var common = require('./util/common');
Expand Down Expand Up @@ -30,41 +31,63 @@ if(!doesFileExist(constants.pathToCSSBuild) || !doesFileExist(constants.pathToFo
].join('\n'));
}

// Browserify plotly.js
_bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDist, {
standalone: 'Plotly',
debug: DEV,
pathToMinBundle: constants.pathToPlotlyDistMin
// "Browserify" the locales
var localeGlob = path.join(constants.pathToLib, 'locales', '*.js');
glob(localeGlob, function(err, files) {
files.forEach(function(file) {
var outName = 'plotly-locale-' + path.basename(file);
var outPath = path.join(constants.pathToDist, outName);
wrapLocale(file, outPath);
});
});

// list of tasks to pass to run-series to not blow up
// memory consumption.
var tasks = [];

// Browserify plotly.js
tasks.push(function(cb) {
_bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDist, {
standalone: 'Plotly',
debug: DEV,
compressAttrs: true,
packFlat: true,
pathToMinBundle: constants.pathToPlotlyDistMin
}, cb);
});

// Browserify the geo assets
_bundle(constants.pathToPlotlyGeoAssetsSrc, constants.pathToPlotlyGeoAssetsDist, {
standalone: 'PlotlyGeoAssets'
tasks.push(function(cb) {
_bundle(constants.pathToPlotlyGeoAssetsSrc, constants.pathToPlotlyGeoAssetsDist, {
standalone: 'PlotlyGeoAssets'
}, cb);
});

// Browserify the plotly.js with meta
_bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDistWithMeta, {
standalone: 'Plotly',
debug: DEV,
then: makeSchema(constants.pathToPlotlyDistWithMeta, constants.pathToSchema)
tasks.push(function(cb) {
_bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDistWithMeta, {
standalone: 'Plotly',
debug: DEV,
packFlat: true
}, function() {
makeSchema(constants.pathToPlotlyDistWithMeta, constants.pathToSchema)();
cb();
});
});

// Browserify the plotly.js partial bundles
constants.partialBundlePaths.forEach(function(pathObj) {
_bundle(pathObj.index, pathObj.dist, {
standalone: 'Plotly',
debug: DEV,
pathToMinBundle: pathObj.distMin
tasks.push(function(cb) {
_bundle(pathObj.index, pathObj.dist, {
standalone: 'Plotly',
debug: DEV,
compressAttrs: true,
packFlat: true,
pathToMinBundle: pathObj.distMin
}, cb);
});
});

// "Browserify" the locales
var localeGlob = path.join(constants.pathToLib, 'locales', '*.js');
glob(localeGlob, function(err, files) {
files.forEach(function(file) {
var outName = 'plotly-locale-' + path.basename(file);
var outPath = path.join(constants.pathToDist, outName);
wrapLocale(file, outPath);
});
runSeries(tasks, function(err) {
if(err) throw err;
});
Loading