Skip to content

Commit 64bbc39

Browse files
authored
Merge pull request #5462 from plotly/CDN-latest-v2-and-higher
Mention major versions other than v1 after latest on CDN
2 parents 995ca16 + 4e09afd commit 64bbc39

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tasks/stats.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ var prettySize = require('prettysize');
66

77
var common = require('./util/common');
88
var constants = require('./util/constants');
9-
var pkg = require('../package.json');
9+
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-' + pkg.version + '.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 + pkg.version + 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 + pkg.version + 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,10 +189,10 @@ function makeBundleInfo(pathObj) {
185189
'',
186190
'| Flavor | URL |',
187191
'| ------ | --- |',
188-
'| Latest | ' + cdnRoot + name + '-latest' + JS + ' |',
189-
'| Latest minified | ' + cdnRoot + name + '-latest' + MINJS + ' |',
190-
'| Tagged | ' + cdnRoot + name + '-' + pkg.version + JS + ' |',
191-
'| Tagged minified | ' + cdnRoot + name + '-' + pkg.version + MINJS + ' |',
192+
'| Latest | ' + cdnRoot + name + '-' + theLatest + JS + ' |',
193+
'| Latest minified | ' + cdnRoot + name + '-' + theLatest + MINJS + ' |',
194+
'| Tagged | ' + cdnRoot + name + '-' + pkgVersion + JS + ' |',
195+
'| Tagged minified | ' + cdnRoot + name + '-' + pkgVersion + MINJS + ' |',
192196
'',
193197
'#### npm package (starting in `v1.39.0`)',
194198
'',

0 commit comments

Comments
 (0)