11var path = require ( 'path' ) ;
22var fs = require ( 'fs' ) ;
3+ var spawn = require ( 'child_process' ) . spawn ;
34
45var falafel = require ( 'falafel' ) ;
56var gzipSize = require ( 'gzip-size' ) ;
@@ -10,6 +11,7 @@ var constants = require('./util/constants');
1011var pkg = require ( '../package.json' ) ;
1112
1213var pathDistREADME = path . join ( constants . pathToDist , 'README.md' ) ;
14+ var pathDistNpmLs = path . join ( constants . pathToDist , 'npm-ls.json' ) ;
1315var cdnRoot = 'https://cdn.plot.ly/plotly-' ;
1416var coreModules = [ 'scatter' ] ;
1517
@@ -18,15 +20,25 @@ var JS = '.js';
1820var MINJS = '.min.js' ;
1921
2022// main
21- var content = getContent ( ) ;
22- common . writeFile ( pathDistREADME , content . join ( '\n' ) ) ;
23+ writeNpmLs ( ) ;
24+ common . writeFile ( pathDistREADME , getReadMeContent ( ) ) ;
2325
24- function getContent ( ) {
26+ function writeNpmLs ( ) {
27+ if ( common . doesFileExist ( pathDistNpmLs ) ) fs . unlinkSync ( pathDistNpmLs ) ;
28+
29+ var ws = fs . createWriteStream ( pathDistNpmLs , { flags : 'a' } ) ;
30+ var proc = spawn ( 'npm' , [ 'ls' , '--json' , '--only' , 'prod' ] ) ;
31+
32+ proc . stdout . pipe ( ws ) ;
33+ }
34+
35+ function getReadMeContent ( ) {
2536 return [ ]
2637 . concat ( getInfoContent ( ) )
2738 . concat ( getMainBundleInfo ( ) )
2839 . concat ( getPartialBundleInfo ( ) )
29- . concat ( getFooter ( ) ) ;
40+ . concat ( getFooter ( ) )
41+ . join ( '\n' ) ;
3042}
3143
3244// general info about distributed files
0 commit comments