Skip to content

Commit afaeeaf

Browse files
committed
add versionify transform to add version to plotly.js dist files:
- task bundle.js uses the verisonify transform to insert to package.json version in exports.version - watch builds don't use the versionify transform because it breaks source maps webpro/versionify#11 - the exports.version placeholder is set to 'see pacakge.json'
1 parent 63041bc commit afaeeaf

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"alpha-shape": "^1.0.0",
4343
"arraytools": "^1.0.0",
4444
"browserify": "^12.0.1",
45+
"browserify-versionify": "^1.0.6",
4546
"convex-hull": "^1.0.3",
4647
"d3": "3.5.6",
4748
"delaunay-triangulate": "^1.1.6",

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 version using browserify-versionify
13+
exports.version = 'see package.json';
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 version using browserify-versionify
20+
exports.version = 'see package.json';
21+
1922
// plot api
2023
exports.plot = Plotly.plot;
2124
exports.newPlot = Plotly.newPlot;

tasks/bundle.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
var fs = require('fs');
22

33
var browserify = require('browserify');
4+
var versionify = require('browserify-versionify');
45
var UglifyJS = require('uglify-js');
56

67
var compressAttributes = require('./util/compress_attributes');
78
var constants = require('./util/constants');
89

10+
var versionifyArg = [versionify, {placeholder: 'see package.json'}];
11+
12+
913
/*
1014
* This script takes one argument
1115
*
@@ -38,7 +42,7 @@ catch(e) {
3842
browserify(constants.pathToPlotlySrc, {
3943
debug: DEV,
4044
standalone: 'Plotly',
41-
transform: [compressAttributes]
45+
transform: [compressAttributes, versionifyArg]
4246
})
4347
.bundle(function(err, buf) {
4448
if(err) throw err;
@@ -56,7 +60,8 @@ browserify(constants.pathToPlotlySrc, {
5660

5761
// Browserify the geo assets
5862
browserify(constants.pathToPlotlyGeoAssetsSrc, {
59-
standalone: 'PlotlyGeoAssets'
63+
standalone: 'PlotlyGeoAssets',
64+
transform: [versionifyArg]
6065
})
6166
.bundle(function(err) {
6267
if(err) throw err;
@@ -67,7 +72,8 @@ browserify(constants.pathToPlotlyGeoAssetsSrc, {
6772
// Browserify the plotly.js with meta
6873
browserify(constants.pathToPlotlySrc, {
6974
debug: DEV,
70-
standalone: 'Plotly'
75+
standalone: 'Plotly',
76+
transform: [versionifyArg]
7177
})
7278
.bundle(function(err) {
7379
if(err) throw err;

0 commit comments

Comments
 (0)