Skip to content

Commit 84aab1e

Browse files
author
benholloway
committed
fix crash in test mode when no compositions exist, bump patch version
1 parent b39548f commit 84aab1e

File tree

3 files changed

+41
-31
lines changed

3 files changed

+41
-31
lines changed

config/release.js

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,38 @@ var createConfigurator = require('../lib/create-configurator'),
1212
*/
1313
function 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

4549
module.exports = release;

index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ function configFactory(options) {
2929

3030
// create and return the instance
3131
var instance = {
32-
app : require('./config/app')(opt),
33-
test : require('./config/test')(opt),
34-
release: require('./config/release')(opt),
32+
get app() {
33+
return require('./config/app')(opt);
34+
},
35+
get test() {
36+
return require('./config/test')(opt);
37+
},
38+
get release() {
39+
return require('./config/release')(opt);
40+
},
3541
resolve: resolve
3642
};
3743
return instance;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack-angularity-solution",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"description": "Requisite configuration and modules to build Angularity projects with Webpack",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)