Skip to content

Commit 6a8ac65

Browse files
committed
create version.js to easily get version number without circularity
1 parent b2eb326 commit 6a8ac65

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

src/assets/geo_assets.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
var saneTopojson = require('sane-topojson');
1212

1313

14-
// package version injected by `npm run preprocess`
15-
exports.version = '1.52.2';
14+
exports.version = require('../version').version;
1615

1716
exports.topojson = saneTopojson;

src/core.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
'use strict';
1010

11-
// package version injected by `npm run preprocess`
12-
exports.version = '1.52.2';
11+
exports.version = require('./version').version;
1312

1413
// inject promise polyfill
1514
require('es6-promise').polyfill();

src/plot_api/to_image.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var Lib = require('../lib');
1717
var helpers = require('../snapshot/helpers');
1818
var toSVG = require('../snapshot/tosvg');
1919
var svgToImg = require('../snapshot/svgtoimg');
20-
var version = require('../core').version;
20+
var version = require('../version').version;
2121

2222
var attrs = {
2323
format: {

src/version.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Copyright 2012-2020, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
// package version injected by `npm run preprocess`
12+
exports.version = '1.52.2';

tasks/preprocess.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ var updateVersion = require('./util/update_version');
99
// main
1010
makeBuildCSS();
1111
copyTopojsonFiles();
12-
updateVersion(constants.pathToPlotlyCore);
13-
updateVersion(constants.pathToPlotlyGeoAssetsSrc);
12+
updateVersion(constants.pathToPlotlyVersion);
1413

1514
// convert scss to css to js
1615
function makeBuildCSS() {

tasks/util/constants.js

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ module.exports = {
4747

4848
pathToPlotlyIndex: path.join(pathToLib, 'index.js'),
4949
pathToPlotlyCore: path.join(pathToSrc, 'core.js'),
50+
pathToPlotlyVersion: path.join(pathToSrc, 'version.js'),
5051
pathToPlotlyBuild: path.join(pathToBuild, 'plotly.js'),
5152
pathToPlotlyDist: path.join(pathToDist, 'plotly.js'),
5253
pathToPlotlyDistMin: path.join(pathToDist, 'plotly.min.js'),

0 commit comments

Comments
 (0)