|  | 
| 1 |  | -var fs = require('fs'); | 
| 2 | 1 | var path = require('path'); | 
| 3 | 2 | 
 | 
| 4 | 3 | var pkg = require('../../package.json'); | 
| 5 | 4 | 
 | 
| 6 | 5 | var pathToRoot = path.join(__dirname, '../../'); | 
| 7 |  | -var pathToRootParent = path.join(__dirname, '../../../../'); | 
| 8 | 6 | var pathToSrc = path.join(pathToRoot, 'src/'); | 
| 9 | 7 | var pathToImageTest = path.join(pathToRoot, 'test/image'); | 
| 10 | 8 | var pathToDist = path.join(pathToRoot, 'dist/'); | 
| 11 | 9 | var pathToBuild = path.join(pathToRoot, 'build/'); | 
| 12 | 10 | 
 | 
| 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 | +); | 
| 23 | 14 | 
 | 
| 24 | 15 | module.exports = { | 
| 25 | 16 |     pathToRoot: pathToRoot, | 
| 26 | 17 |     pathToSrc: pathToSrc, | 
| 27 |  | -    pathToMocks: path.join(pathToRoot, 'test/image/mocks'), | 
| 28 | 18 | 
 | 
| 29 | 19 |     pathToPlotlySrc: path.join(pathToSrc, 'index.js'), | 
| 30 | 20 |     pathToPlotlyBuild: path.join(pathToBuild, 'plotly.js'), | 
|  | 
0 commit comments