Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 734f75f

Browse filesBrowse files
committed
Merge pull request plotly#12 from justinwoo/fix-npm3-install
fix installation from npm3
2 parents d508db7 + 0e78905 commit 734f75f
Copy full SHA for 734f75f

File tree

1 file changed

+14
-1
lines changed
Filter options

1 file changed

+14
-1
lines changed

‎tasks/util/constants.js

Copy file name to clipboardExpand all lines: tasks/util/constants.js
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1+
var fs = require('fs');
12
var path = require('path');
23

34
var pathToRoot = path.join(__dirname, '../../');
5+
var pathToRootParent = path.join(__dirname, '../../../../');
46
var pathToSrc = path.join(pathToRoot, 'src/');
57
var pathToImageTest = path.join(pathToRoot, 'test/image');
68
var pathToDist = path.join(pathToRoot, 'dist/');
79
var pathToBuild = path.join(pathToRoot, 'build/');
810

11+
var pathToTopojsonSrc;
12+
13+
// npm3 flattens modules, so they won't be accessible through the old nested npm2 paths
14+
// attempt a synchronous filestat check, and on error, use the npm3 path
15+
try {
16+
pathToTopojsonSrc = path.join(pathToRoot, 'node_modules/sane-topojson/dist/');
17+
fs.statSync(pathToTopojsonSrc);
18+
} catch (e) {
19+
pathToTopojsonSrc = path.join(pathToRootParent, 'node_modules/sane-topojson/dist/');
20+
}
21+
922
module.exports = {
1023
pathToRoot: pathToRoot,
1124
pathToSrc: pathToSrc,
@@ -17,7 +30,7 @@ module.exports = {
1730
pathToPlotlyDistMin: path.join(pathToDist, 'plotly.min.js'),
1831
pathToPlotlyDistWithMeta: path.join(pathToDist, 'plotly-with-meta.js'),
1932

20-
pathToTopojsonSrc: path.join(pathToRoot, 'node_modules/sane-topojson/dist/'),
33+
pathToTopojsonSrc: pathToTopojsonSrc,
2134
pathToTopojsonDist: path.join(pathToDist, 'topojson/'),
2235
pathToPlotlyGeoAssetsSrc: path.join(pathToSrc, 'assets/geo_assets.js'),
2336
pathToPlotlyGeoAssetsDist: path.join(pathToDist, 'plotly-geo-assets.js'),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.