@@ -7,6 +7,10 @@ var prettySize = require('prettysize');
7
7
var common = require ( './util/common' ) ;
8
8
var constants = require ( './util/constants' ) ;
9
9
var pkgVersion = require ( '../package.json' ) . version ;
10
+ var majorVersion = pkgVersion . split ( '.' ) [ 0 ] ;
11
+ var theLatest = 'latest' + (
12
+ ( majorVersion === '1' ) ? '' : ( '-v' + majorVersion )
13
+ ) ;
10
14
11
15
var pathDistREADME = path . join ( constants . pathToDist , 'README.md' ) ;
12
16
var cdnRoot = 'https://cdn.plot.ly/plotly-' ;
@@ -74,7 +78,7 @@ function getInfoContent() {
74
78
'Plotly.js defaults to US English (en-US) and includes British English (en) in the standard bundle.' ,
75
79
'Many other localizations are available - here is an example using Swiss-German (de-CH),' ,
76
80
'see the contents of this directory for the full list.' ,
77
- 'They are also available on our CDN as ' + cdnRoot + 'locale-de-ch-' + 'latest' + '.js OR ' + cdnRoot + 'locale-de-ch-' + pkgVersion + '.js' ,
81
+ 'They are also available on our CDN as ' + cdnRoot + 'locale-de-ch-' + theLatest + '.js OR ' + cdnRoot + 'locale-de-ch-' + pkgVersion + '.js' ,
78
82
'Note that the file names are all lowercase, even though the region is uppercase when you apply a locale.' ,
79
83
'' ,
80
84
'*After* the plotly.js script tag, add:' ,
@@ -109,12 +113,12 @@ function getMainBundleInfo() {
109
113
'' ,
110
114
'It be can imported as minified javascript' ,
111
115
'- using dist file `dist/plotly.min.js`' ,
112
- '- using CDN URL ' + cdnRoot + 'latest' + MINJS + ' OR ' + cdnRoot + pkgVersion + MINJS ,
116
+ '- using CDN URL ' + cdnRoot + theLatest + MINJS + ' OR ' + cdnRoot + pkgVersion + MINJS ,
113
117
'' ,
114
118
'or as raw javascript:' ,
115
119
'- using the `plotly.js-dist` npm package (starting in `v1.39.0`)' ,
116
120
'- using dist file `dist/plotly.js`' ,
117
- '- using CDN URL ' + cdnRoot + 'latest' + JS + ' OR ' + cdnRoot + pkgVersion + JS ,
121
+ '- using CDN URL ' + cdnRoot + theLatest + JS + ' OR ' + cdnRoot + pkgVersion + JS ,
118
122
'- using CommonJS with `require(\'plotly.js\')`' ,
119
123
'' ,
120
124
'If you would like to have access to the attribute meta information ' +
@@ -185,8 +189,8 @@ function makeBundleInfo(pathObj) {
185
189
'' ,
186
190
'| Flavor | URL |' ,
187
191
'| ------ | --- |' ,
188
- '| Latest | ' + cdnRoot + name + '-' + 'latest' + JS + ' |' ,
189
- '| Latest minified | ' + cdnRoot + name + '-' + 'latest' + MINJS + ' |' ,
192
+ '| Latest | ' + cdnRoot + name + '-' + theLatest + JS + ' |' ,
193
+ '| Latest minified | ' + cdnRoot + name + '-' + theLatest + MINJS + ' |' ,
190
194
'| Tagged | ' + cdnRoot + name + '-' + pkgVersion + JS + ' |' ,
191
195
'| Tagged minified | ' + cdnRoot + name + '-' + pkgVersion + MINJS + ' |' ,
192
196
'' ,
0 commit comments