From 9a82df957dd126035e0d5d335d6b92332e47111d Mon Sep 17 00:00:00 2001 From: archmoj Date: Tue, 2 Feb 2021 21:09:58 -0500 Subject: [PATCH 1/3] isolate latest in stats --- tasks/stats.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/stats.js b/tasks/stats.js index 8310b515533..53486f3ad4a 100644 --- a/tasks/stats.js +++ b/tasks/stats.js @@ -74,7 +74,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-' + 'latest' + '.js OR ' + cdnRoot + 'locale-de-ch-' + pkg.version + '.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:', @@ -185,8 +185,8 @@ function makeBundleInfo(pathObj) { '', '| Flavor | URL |', '| ------ | --- |', - '| Latest | ' + cdnRoot + name + '-latest' + JS + ' |', - '| Latest minified | ' + cdnRoot + name + '-latest' + MINJS + ' |', + '| Latest | ' + cdnRoot + name + '-' + 'latest' + JS + ' |', + '| Latest minified | ' + cdnRoot + name + '-' + 'latest' + MINJS + ' |', '| Tagged | ' + cdnRoot + name + '-' + pkg.version + JS + ' |', '| Tagged minified | ' + cdnRoot + name + '-' + pkg.version + MINJS + ' |', '', From 35f9a19abd1c027a83e7d4c9307cf4d506691955 Mon Sep 17 00:00:00 2001 From: archmoj Date: Tue, 2 Feb 2021 21:13:59 -0500 Subject: [PATCH 2/3] pkg.version > pkgVersion --- tasks/stats.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/stats.js b/tasks/stats.js index 53486f3ad4a..01fcb6cc764 100644 --- a/tasks/stats.js +++ b/tasks/stats.js @@ -6,7 +6,7 @@ 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 pathDistREADME = path.join(constants.pathToDist, 'README.md'); var cdnRoot = 'https://cdn.plot.ly/plotly-'; @@ -74,7 +74,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-' + 'latest' + '.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:', @@ -109,12 +109,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 + 'latest' + 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 + 'latest' + JS + ' OR ' + cdnRoot + pkgVersion + JS, '- using CommonJS with `require(\'plotly.js\')`', '', 'If you would like to have access to the attribute meta information ' + @@ -187,8 +187,8 @@ function makeBundleInfo(pathObj) { '| ------ | --- |', '| Latest | ' + cdnRoot + name + '-' + 'latest' + JS + ' |', '| Latest minified | ' + cdnRoot + name + '-' + 'latest' + MINJS + ' |', - '| Tagged | ' + cdnRoot + name + '-' + pkg.version + JS + ' |', - '| Tagged minified | ' + cdnRoot + name + '-' + pkg.version + MINJS + ' |', + '| Tagged | ' + cdnRoot + name + '-' + pkgVersion + JS + ' |', + '| Tagged minified | ' + cdnRoot + name + '-' + pkgVersion + MINJS + ' |', '', '#### npm package (starting in `v1.39.0`)', '', From 4e09afdc88507f7ddd4a8980732500afcbd8444f Mon Sep 17 00:00:00 2001 From: archmoj Date: Tue, 2 Feb 2021 21:18:44 -0500 Subject: [PATCH 3/3] add major version after latest for CDN to leave v1 unchanged --- tasks/stats.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tasks/stats.js b/tasks/stats.js index 01fcb6cc764..31cc04d46e1 100644 --- a/tasks/stats.js +++ b/tasks/stats.js @@ -7,6 +7,10 @@ var prettySize = require('prettysize'); var common = require('./util/common'); var constants = require('./util/constants'); 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-'; @@ -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-' + pkgVersion + '.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:', @@ -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 + pkgVersion + 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 + pkgVersion + 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 ' + @@ -185,8 +189,8 @@ function makeBundleInfo(pathObj) { '', '| Flavor | URL |', '| ------ | --- |', - '| Latest | ' + cdnRoot + name + '-' + 'latest' + JS + ' |', - '| Latest minified | ' + cdnRoot + name + '-' + 'latest' + MINJS + ' |', + '| Latest | ' + cdnRoot + name + '-' + theLatest + JS + ' |', + '| Latest minified | ' + cdnRoot + name + '-' + theLatest + MINJS + ' |', '| Tagged | ' + cdnRoot + name + '-' + pkgVersion + JS + ' |', '| Tagged minified | ' + cdnRoot + name + '-' + pkgVersion + MINJS + ' |', '',