Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention major versions other than v1 after latest on CDN #5462

Merged
merged 3 commits into from
Feb 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions tasks/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ var prettySize = require('prettysize');

var common = require('./util/common');
var constants = require('./util/constants');
var pkg = require('../package.json');
var pkgVersion = require('../package.json').version;
var majorVersion = pkgVersion.split('.')[0];
var theLatest = 'latest' + (
(majorVersion === '1') ? '' : ('-v' + majorVersion)
);

var pathDistREADME = path.join(constants.pathToDist, 'README.md');
var cdnRoot = 'https://cdn.plot.ly/plotly-';
Expand Down Expand Up @@ -74,7 +78,7 @@ function getInfoContent() {
'Plotly.js defaults to US English (en-US) and includes British English (en) in the standard bundle.',
'Many other localizations are available - here is an example using Swiss-German (de-CH),',
'see the contents of this directory for the full list.',
'They are also available on our CDN as ' + cdnRoot + 'locale-de-ch-latest.js OR ' + cdnRoot + 'locale-de-ch-' + pkg.version + '.js',
'They are also available on our CDN as ' + cdnRoot + 'locale-de-ch-' + theLatest + '.js OR ' + cdnRoot + 'locale-de-ch-' + pkgVersion + '.js',
'Note that the file names are all lowercase, even though the region is uppercase when you apply a locale.',
'',
'*After* the plotly.js script tag, add:',
Expand Down Expand Up @@ -109,12 +113,12 @@ function getMainBundleInfo() {
'',
'It be can imported as minified javascript',
'- using dist file `dist/plotly.min.js`',
'- using CDN URL ' + cdnRoot + 'latest' + MINJS + ' OR ' + cdnRoot + pkg.version + MINJS,
'- using CDN URL ' + cdnRoot + theLatest + MINJS + ' OR ' + cdnRoot + pkgVersion + MINJS,
'',
'or as raw javascript:',
'- using the `plotly.js-dist` npm package (starting in `v1.39.0`)',
'- using dist file `dist/plotly.js`',
'- using CDN URL ' + cdnRoot + 'latest' + JS + ' OR ' + cdnRoot + pkg.version + JS,
'- using CDN URL ' + cdnRoot + theLatest + JS + ' OR ' + cdnRoot + pkgVersion + JS,
'- using CommonJS with `require(\'plotly.js\')`',
'',
'If you would like to have access to the attribute meta information ' +
Expand Down Expand Up @@ -185,10 +189,10 @@ function makeBundleInfo(pathObj) {
'',
'| Flavor | URL |',
'| ------ | --- |',
'| Latest | ' + cdnRoot + name + '-latest' + JS + ' |',
'| Latest minified | ' + cdnRoot + name + '-latest' + MINJS + ' |',
'| Tagged | ' + cdnRoot + name + '-' + pkg.version + JS + ' |',
'| Tagged minified | ' + cdnRoot + name + '-' + pkg.version + MINJS + ' |',
'| Latest | ' + cdnRoot + name + '-' + theLatest + JS + ' |',
'| Latest minified | ' + cdnRoot + name + '-' + theLatest + MINJS + ' |',
'| Tagged | ' + cdnRoot + name + '-' + pkgVersion + JS + ' |',
'| Tagged minified | ' + cdnRoot + name + '-' + pkgVersion + MINJS + ' |',
'',
'#### npm package (starting in `v1.39.0`)',
'',
Expand Down