Skip to content

Commit 5b97840

Browse files
committed
use require.resolve to find path to sane-topojson dist/
1 parent c88fb5a commit 5b97840

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

tasks/util/constants.js

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
1-
var fs = require('fs');
21
var path = require('path');
32

43
var pkg = require('../../package.json');
54

65
var pathToRoot = path.join(__dirname, '../../');
7-
var pathToRootParent = path.join(__dirname, '../../../../');
86
var pathToSrc = path.join(pathToRoot, 'src/');
97
var pathToImageTest = path.join(pathToRoot, 'test/image');
108
var pathToDist = path.join(pathToRoot, 'dist/');
119
var pathToBuild = path.join(pathToRoot, 'build/');
1210

13-
var pathToTopojsonSrc;
14-
15-
// npm3 flattens modules, so they won't be accessible through the old nested npm2 paths
16-
// attempt a synchronous filestat check, and on error, use the npm3 path
17-
try {
18-
pathToTopojsonSrc = path.join(pathToRoot, 'node_modules/sane-topojson/dist/');
19-
fs.statSync(pathToTopojsonSrc);
20-
} catch (e) {
21-
pathToTopojsonSrc = path.join(pathToRootParent, 'node_modules/sane-topojson/dist/');
22-
}
11+
var pathToTopojsonSrc = path.join(
12+
path.dirname(require.resolve('sane-topojson')), 'dist/'
13+
);
2314

2415
module.exports = {
2516
pathToRoot: pathToRoot,

0 commit comments

Comments
 (0)