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

Upgrade bundling #2187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 1, 2017
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
3 changes: 2 additions & 1 deletion 3 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"has-hover": "^1.0.1",
"mapbox-gl": "^0.22.0",
"matrix-camera-controller": "^2.1.3",
"minify-stream": "^1.1.0",
"mouse-change": "^1.4.0",
"mouse-event-offset": "^3.0.2",
"mouse-wheel": "^1.0.2",
Expand All @@ -109,6 +110,7 @@
"brfs": "^1.4.3",
"browserify": "^14.1.0",
"browserify-transform-tools": "^1.7.0",
"cross-spawn": "^5.1.0",
"deep-equal": "^1.0.1",
"ecstatic": "^2.1.0",
"eslint": "^3.17.1",
Expand Down Expand Up @@ -140,7 +142,6 @@
"read-last-lines": "^1.1.0",
"requirejs": "^2.3.1",
"through2": "^2.0.3",
"uglify-js": "^2.8.12",
"watchify": "^3.9.0",
"xml2js": "^0.4.16"
}
Expand Down
1 change: 1 addition & 0 deletions 1 tasks/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ _bundle(constants.pathToPlotlyIndex, constants.pathToPlotlyDist, {
pathToMinBundle: constants.pathToPlotlyDistMin
});


// Browserify the geo assets
_bundle(constants.pathToPlotlyGeoAssetsSrc, constants.pathToPlotlyGeoAssetsDist, {
standalone: 'PlotlyGeoAssets'
Expand Down
2 changes: 1 addition & 1 deletion 2 tasks/stats.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var path = require('path');
var fs = require('fs');
var spawn = require('child_process').spawn;
var spawn = require('cross-spawn');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha nice catch. That's for that spawn('npm', ['ls', '--json', '--only', 'prod']); statement below - which will be obsolete when we switch to npm@5 as the new package-lock.json file will do that same as the current dist/npm-ls.json.


var falafel = require('falafel');
var gzipSize = require('gzip-size');
Expand Down
39 changes: 18 additions & 21 deletions 39 tasks/util/browserify_wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ var fs = require('fs');
var path = require('path');

var browserify = require('browserify');
var UglifyJS = require('uglify-js');
var minify = require('minify-stream');

var constants = require('./constants');
var compressAttributes = require('./compress_attributes');
var patchMinified = require('./patch_minified');
var strictD3 = require('./strict_d3');

/** Convenience browserify wrapper
Expand Down Expand Up @@ -46,30 +45,28 @@ module.exports = function _bundle(pathToIndex, pathToBundle, opts) {
}

var b = browserify(pathToIndex, browserifyOpts);
var bundleWriteStream = fs.createWriteStream(pathToBundle);

bundleWriteStream.on('finish', function() {
logger(pathToBundle);
if(opts.then) {
opts.then();
}
});

b.bundle(function(err, buf) {
var bundleStream = b.bundle(function(err) {
if(err) throw err;
});

if(outputMinified) {
var minifiedCode = UglifyJS.minify(buf.toString(), constants.uglifyOptions).code;
minifiedCode = patchMinified(minifiedCode);

fs.writeFile(pathToMinBundle, minifiedCode, function(err) {
if(err) throw err;

if(outputMinified) {
bundleStream
.pipe(minify(constants.uglifyOptions))
.pipe(fs.createWriteStream(pathToMinBundle))
.on('finish', function() {
logger(pathToMinBundle);
});
}
})
.pipe(bundleWriteStream);
}

bundleStream
.pipe(fs.createWriteStream(pathToBundle))
.on('finish', function() {
logger(pathToBundle);
if(opts.then) {
opts.then();
}
});
};

function logger(pathToOutput) {
Expand Down
7 changes: 3 additions & 4 deletions 7 tasks/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ module.exports = {
testContainerHome: '/var/www/streambed/image_server/plotly.js',

uglifyOptions: {
fromString: true,
mangle: true,
compress: {
warnings: false,
screw_ie8: true
warnings: false
},
output: {
beautify: false,
ascii_only: true
}
},
sourceMap: false
},

licenseDist: [
Expand Down
22 changes: 0 additions & 22 deletions 22 tasks/util/patch_minified.js

This file was deleted.

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