@@ -12,34 +12,38 @@ var createConfigurator = require('../lib/create-configurator'),
1212 */
1313function release ( options ) {
1414 var composition = listCompositions ( options . appDir ) [ 0 ] ;
15-
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 )
29- . addConditionals ( {
30- TEST : false ,
31- DEBUG : false ,
32- RELEASE : true
15+ if ( composition ) {
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' )
3324 } )
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- } ) ;
25+ . addBrowserSync ( options . releaseDir , options . port )
26+ . addClean ( options . releaseDir )
27+ . addComposition ( composition )
28+ . addCommon ( path . resolve ( __dirname , '..' , 'node_modules' ) , options )
29+ . addConditionals ( {
30+ TEST : false ,
31+ DEBUG : false ,
32+ RELEASE : true
33+ } )
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+ } ) ;
43+ }
44+ else {
45+ throw new Error ( 'there are no compositions in the app directory' ) ;
46+ }
4347}
4448
4549module . exports = release ;
0 commit comments