@@ -5,38 +5,41 @@ var path = require('path');
55var createConfigurator = require ( '../lib/create-configurator' ) ,
66 listCompositions = require ( '../lib/list-compositions' ) ;
77
8- // TODO doctag
8+ /**
9+ * Create a single webpack configurator for release.
10+ * @param {{appDir:string, releaseDir:string, globals:object, unminified:boolean, port:number} } options An options hash
11+ * @returns {Config } A webpack configurator
12+ */
913function release ( options ) {
1014 var composition = listCompositions ( options . appDir ) [ 0 ] ;
1115
12- return [
13- createConfigurator ( {
14- addBrowserSync : require ( './add/browser-sync' ) ,
15- addClean : require ( './add/clean' ) ,
16- addCommon : require ( './add/common' ) ,
17- addComposition : require ( './add/composition' ) ,
18- addConditionals : require ( './add/conditionals' ) ,
19- addExternalChunkManifest : require ( './add/external-chunk-manifest' ) ,
20- addMinification : require ( './add/minification' )
16+ return createConfigurator ( {
17+ addBrowserSync : require ( './add/browser-sync' ) ,
18+ addClean : require ( './add/clean' ) ,
19+ addCommon : require ( './add/common' ) ,
20+ addComposition : require ( './add/composition' ) ,
21+ addConditionals : require ( './add/conditionals' ) ,
22+ addExternalChunkManifest : require ( './add/external-chunk-manifest' ) ,
23+ addMinification : require ( './add/minification' )
24+ } )
25+ . addBrowserSync ( options . releaseDir , options . port )
26+ . addClean ( options . releaseDir )
27+ . addComposition ( composition )
28+ . addCommon ( path . resolve ( __dirname , '..' , 'node_modules' ) , options . globals )
29+ . addConditionals ( {
30+ TEST : false ,
31+ DEBUG : false ,
32+ RELEASE : true
2133 } )
22- . addBrowserSync ( options . releaseDir , options . port )
23- . addClean ( options . releaseDir )
24- . addComposition ( composition )
25- . addCommon ( path . resolve ( __dirname , '..' , 'node_modules' ) , options . globals )
26- . addConditionals ( {
27- TEST : false ,
28- DEBUG : false ,
29- RELEASE : true
30- } )
31- . addExternalChunkManifest ( )
32- . addMinification ( ! options . unminified )
33- . merge ( {
34- output : {
35- path : path . resolve ( options . releaseDir ) ,
36- publicPath : options . publicPath
37- }
38- } )
39- ] ;
34+ . addExternalChunkManifest ( )
35+ . addMinification ( ! options . unminified )
36+ . merge ( {
37+ name : 'release' ,
38+ output : {
39+ path : path . resolve ( options . releaseDir ) ,
40+ publicPath : options . publicPath
41+ }
42+ } ) ;
4043}
4144
4245module . exports = release ;
0 commit comments