@@ -4,6 +4,7 @@ var browserify = require('browserify');
4
4
var UglifyJS = require ( 'uglify-js' ) ;
5
5
6
6
var compressAttributes = require ( './util/compress_attributes' ) ;
7
+ var appendVersion = require ( './util/append_version' ) ;
7
8
var constants = require ( './util/constants' ) ;
8
9
9
10
/*
24
25
fs . statSync ( constants . pathToFontSVGBuild ) . isFile ( ) ;
25
26
}
26
27
catch ( e ) {
27
- throw new Error ( 'Please run `npm run preprocess` first' ) ;
28
+ throw new Error ( [
29
+ 'build/ is missing a or more files' ,
30
+ 'Please run `npm run preprocess` first'
31
+ ] . join ( '\n' ) ) ;
28
32
}
29
33
30
34
@@ -41,30 +45,43 @@ browserify(constants.pathToPlotlySrc, {
41
45
if ( ! DEV ) {
42
46
fs . writeFile (
43
47
constants . pathToPlotlyDistMin ,
44
- UglifyJS . minify ( buf . toString ( ) , constants . uglifyOptions ) . code
48
+ UglifyJS . minify ( buf . toString ( ) , constants . uglifyOptions ) . code ,
49
+ function ( ) {
50
+ appendVersion (
51
+ constants . pathToPlotlyDistMin , { object : 'Plotly' }
52
+ ) ;
53
+ }
45
54
) ;
46
55
}
47
56
} )
48
- . pipe ( fs . createWriteStream ( constants . pathToPlotlyDist ) ) ;
57
+ . pipe ( fs . createWriteStream ( constants . pathToPlotlyDist ) )
58
+ . on ( 'finish' , function ( ) {
59
+ appendVersion ( constants . pathToPlotlyDist , { object : 'Plotly' , DEV : DEV } ) ;
60
+ } ) ;
49
61
50
62
51
63
// Browserify the geo assets
52
64
browserify ( constants . pathToPlotlyGeoAssetsSrc , {
53
65
standalone : 'PlotlyGeoAssets'
54
66
} )
55
- . bundle ( function ( err , buf ) {
67
+ . bundle ( function ( err ) {
56
68
if ( err ) throw err ;
57
69
} )
58
- . pipe ( fs . createWriteStream ( constants . pathToPlotlyGeoAssetsDist ) ) ;
59
-
70
+ . pipe ( fs . createWriteStream ( constants . pathToPlotlyGeoAssetsDist ) )
71
+ . on ( 'finish' , function ( ) {
72
+ appendVersion ( constants . pathToPlotlyGeoAssetsDist , { object : 'PlotlyGeoAssets' } ) ;
73
+ } ) ;
60
74
61
75
62
76
// Browserify the plotly.js with meta
63
77
browserify ( constants . pathToPlotlySrc , {
64
78
debug : DEV ,
65
79
standalone : 'Plotly'
66
80
} )
67
- . bundle ( function ( err , buf ) {
81
+ . bundle ( function ( err ) {
68
82
if ( err ) throw err ;
69
83
} )
70
- . pipe ( fs . createWriteStream ( constants . pathToPlotlyDistWithMeta ) ) ;
84
+ . pipe ( fs . createWriteStream ( constants . pathToPlotlyDistWithMeta ) )
85
+ . on ( 'finish' , function ( ) {
86
+ appendVersion ( constants . pathToPlotlyDistWithMeta , { object : 'Plotly' , DEV : DEV } ) ;
87
+ } ) ;
0 commit comments