Skip to content

Commit 4e09afd

Browse files
committed
add major version after latest for CDN to leave v1 unchanged
1 parent 35f9a19 commit 4e09afd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tasks/stats.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ var prettySize = require('prettysize');
77
var common = require('./util/common');
88
var constants = require('./util/constants');
99
var pkgVersion = require('../package.json').version;
10+
var majorVersion = pkgVersion.split('.')[0];
11+
var theLatest = 'latest' + (
12+
(majorVersion === '1') ? '' : ('-v' + majorVersion)
13+
);
1014

1115
var pathDistREADME = path.join(constants.pathToDist, 'README.md');
1216
var cdnRoot = 'https://cdn.plot.ly/plotly-';
@@ -74,7 +78,7 @@ function getInfoContent() {
7478
'Plotly.js defaults to US English (en-US) and includes British English (en) in the standard bundle.',
7579
'Many other localizations are available - here is an example using Swiss-German (de-CH),',
7680
'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',
7882
'Note that the file names are all lowercase, even though the region is uppercase when you apply a locale.',
7983
'',
8084
'*After* the plotly.js script tag, add:',
@@ -109,12 +113,12 @@ function getMainBundleInfo() {
109113
'',
110114
'It be can imported as minified javascript',
111115
'- 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,
113117
'',
114118
'or as raw javascript:',
115119
'- using the `plotly.js-dist` npm package (starting in `v1.39.0`)',
116120
'- 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,
118122
'- using CommonJS with `require(\'plotly.js\')`',
119123
'',
120124
'If you would like to have access to the attribute meta information ' +
@@ -185,8 +189,8 @@ function makeBundleInfo(pathObj) {
185189
'',
186190
'| Flavor | URL |',
187191
'| ------ | --- |',
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 + ' |',
190194
'| Tagged | ' + cdnRoot + name + '-' + pkgVersion + JS + ' |',
191195
'| Tagged minified | ' + cdnRoot + name + '-' + pkgVersion + MINJS + ' |',
192196
'',

0 commit comments

Comments
 (0)