@@ -9,9 +9,10 @@ var tc = require("./template-common");
99var formatOutput = require ( "../lib/formatOutput" ) ;
1010var createFilenameShortener = require ( "../lib/createFilenameShortener" ) ;
1111var webpackGraph = require ( "webpack-graph" ) ;
12+ var fs = require ( "fs" ) ;
1213
1314var extraArgs = "" ;
14- if ( require ( "fs" ) . existsSync ( require ( "path" ) . join ( process . cwd ( ) , "webpackOptions.js" ) ) )
15+ if ( fs . existsSync ( require ( "path" ) . join ( process . cwd ( ) , "webpackOptions.js" ) ) )
1516 extraArgs += "--options webpackOptions.js " ;
1617
1718cp . exec ( "node ../../bin/webpack.js --verbose --min " + extraArgs + " example.js js/output.js" , function ( error , stdout , stderr ) {
@@ -21,6 +22,9 @@ cp.exec("node ../../bin/webpack.js --verbose --min "+extraArgs+" example.js js/o
2122 console . log ( error ) ;
2223 var readme = tc ( require ( "raw!" + require ( "path" ) . join ( process . cwd ( ) , "template.md" ) ) , require . context ( "raw!" + process . cwd ( ) ) , stdout . replace ( / [ \r \n ] * $ / , "" ) , "min" ) ;
2324 cp . exec ( "node ../../bin/webpack.js --filenames --verbose " + extraArgs + " example.js js/output.js --json" , function ( error , stdout , stderr ) {
25+ clean ( require . contentCache ) ;
26+ clean ( require . sourceCache ) ;
27+ clean ( require . cache ) ;
2428 if ( stderr )
2529 console . log ( stderr ) ;
2630 if ( error !== null )
@@ -31,13 +35,19 @@ cp.exec("node ../../bin/webpack.js --verbose --min "+extraArgs+" example.js js/o
3135 verbose : true
3236 } ) ;
3337 var filenameShortener = createFilenameShortener ( process . cwd ( ) ) ;
34- readme = tc ( readme , require . context ( "raw!val!raw! " + process . cwd ( ) ) , formatedStats . replace ( / [ \r \n ] * $ / , "" ) ) ;
38+ readme = tc ( readme , require . context ( "raw!" + process . cwd ( ) ) , formatedStats . replace ( / [ \r \n ] * $ / , "" ) ) ;
3539 readme = readme . replace ( / \r \n / g, "\n" ) . replace ( / \r / g, "\n" ) ;
36- require ( "fs" ) . writeFile ( "README.md" , readme , "utf-8" , function ( ) { } ) ;
37- require ( "fs" ) . writeFile ( "graph.svg" , webpackGraph ( stats , {
40+ fs . writeFile ( "README.md" , readme , "utf-8" , function ( ) { } ) ;
41+ fs . writeFile ( "graph.svg" , webpackGraph ( stats , {
3842 nameShortener : filenameShortener ,
3943 width : 500 ,
4044 height : 300
4145 } ) , "utf-8" , function ( ) { } ) ;
4246 } ) ;
4347} ) ;
48+
49+ function clean ( obj ) {
50+ for ( var name in obj ) {
51+ delete obj [ name ] ;
52+ }
53+ }
0 commit comments