Skip to content

Commit 4c45bee

Browse files
committed
Merge pull request #18 from plotly/fix-umd
Fix UMD in plotly.js dist files
2 parents 78be916 + 970088a commit 4c45bee

File tree

6 files changed

+12
-56
lines changed

6 files changed

+12
-56
lines changed

src/assets/geo_assets.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@
99

1010
var saneTopojson = require('sane-topojson');
1111

12+
// export the version found in the package.json
13+
exports.version = require('../../package.json').version;
14+
1215
exports.topojson = saneTopojson;

src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
var Plotly = require('./plotly');
1818

19+
// export the version found in the package.json
20+
exports.version = require('../package.json').version;
21+
1922
// plot api
2023
exports.plot = Plotly.plot;
2124
exports.newPlot = Plotly.newPlot;

tasks/bundle.js

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ var browserify = require('browserify');
44
var UglifyJS = require('uglify-js');
55

66
var compressAttributes = require('./util/compress_attributes');
7-
var appendVersion = require('./util/append_version');
87
var constants = require('./util/constants');
98

109
/*
@@ -48,19 +47,11 @@ browserify(constants.pathToPlotlySrc, {
4847
if(!DEV) {
4948
fs.writeFile(
5049
constants.pathToPlotlyDistMin,
51-
UglifyJS.minify(buf.toString(), constants.uglifyOptions).code,
52-
function() {
53-
appendVersion(
54-
constants.pathToPlotlyDistMin, {object: 'Plotly'}
55-
);
56-
}
50+
UglifyJS.minify(buf.toString(), constants.uglifyOptions).code
5751
);
5852
}
5953
})
60-
.pipe(fs.createWriteStream(constants.pathToPlotlyDist))
61-
.on('finish', function() {
62-
appendVersion(constants.pathToPlotlyDist, {object: 'Plotly', DEV: DEV});
63-
});
54+
.pipe(fs.createWriteStream(constants.pathToPlotlyDist));
6455

6556

6657
// Browserify the geo assets
@@ -70,10 +61,7 @@ browserify(constants.pathToPlotlyGeoAssetsSrc, {
7061
.bundle(function(err) {
7162
if(err) throw err;
7263
})
73-
.pipe(fs.createWriteStream(constants.pathToPlotlyGeoAssetsDist))
74-
.on('finish', function() {
75-
appendVersion(constants.pathToPlotlyGeoAssetsDist, {object: 'PlotlyGeoAssets'});
76-
});
64+
.pipe(fs.createWriteStream(constants.pathToPlotlyGeoAssetsDist));
7765

7866

7967
// Browserify the plotly.js with meta
@@ -84,7 +72,4 @@ browserify(constants.pathToPlotlySrc, {
8472
.bundle(function(err) {
8573
if(err) throw err;
8674
})
87-
.pipe(fs.createWriteStream(constants.pathToPlotlyDistWithMeta))
88-
.on('finish', function() {
89-
appendVersion(constants.pathToPlotlyDistWithMeta, {object: 'Plotly', DEV: DEV});
90-
});
75+
.pipe(fs.createWriteStream(constants.pathToPlotlyDistWithMeta));

tasks/cibundle.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ var fs = require('fs');
33
var browserify = require('browserify');
44

55
var compressAttributes = require('./util/compress_attributes');
6-
var appendVersion = require('./util/append_version');
76
var constants = require('./util/constants');
87

98
/*
@@ -24,10 +23,7 @@ browserify(constants.pathToPlotlySrc, {
2423
.bundle(function(err) {
2524
if(err) throw err;
2625
})
27-
.pipe(fs.createWriteStream(constants.pathToPlotlyBuild))
28-
.on('finish', function() {
29-
appendVersion(constants.pathToPlotlyBuild, {object: 'Plotly'});
30-
});
26+
.pipe(fs.createWriteStream(constants.pathToPlotlyBuild));
3127

3228

3329
// Browserify the geo assets
@@ -37,7 +33,4 @@ browserify(constants.pathToPlotlyGeoAssetsSrc, {
3733
.bundle(function(err) {
3834
if(err) throw err;
3935
})
40-
.pipe(fs.createWriteStream(constants.pathToPlotlyGeoAssetsDist))
41-
.on('finish', function() {
42-
appendVersion(constants.pathToPlotlyGeoAssetsDist, {object: 'PlotlyGeoAssets'});
43-
});
36+
.pipe(fs.createWriteStream(constants.pathToPlotlyGeoAssetsDist));

tasks/util/append_version.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

tasks/util/make_watchified_bundle.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ var browserify = require('browserify');
44
var watchify = require('watchify');
55

66
var compressAttributes = require('./compress_attributes');
7-
var appendVersion = require('./append_version');
87
var formatBundleMsg = require('./format_bundle_msg');
98
var constants = require('./constants');
109

@@ -53,9 +52,6 @@ module.exports = function makeWatchifiedBundle(onFirstBundleCallback) {
5352
.pipe(
5453
fs.createWriteStream(constants.pathToPlotlyBuild)
5554
)
56-
.on('finish', function() {
57-
appendVersion(constants.pathToPlotlyBuild, {object: 'Plotly', DEV: true});
58-
});
5955
}
6056

6157
return bundle;

0 commit comments

Comments
 (0)