1+ var fs = require ( 'fs' ) ;
12var path = require ( 'path' ) ;
23
34var pathToRoot = path . join ( __dirname , '../../' ) ;
5+ var pathToRootParent = path . join ( __dirname , '../../../../' ) ;
46var pathToSrc = path . join ( pathToRoot , 'src/' ) ;
57var pathToImageTest = path . join ( pathToRoot , 'test/image' ) ;
68var pathToDist = path . join ( pathToRoot , 'dist/' ) ;
79var 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+
922module . 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