1 | 'use strict';
|
2 |
|
3 | var utils = require('./utils');
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | module.exports = function(app, generator, ctx) {
|
14 | var env = generator.env || {};
|
15 | var alias = env.alias;
|
16 |
|
17 |
|
18 | var config = utils.merge({}, ctx || app.cache.config || app.pkg.get(app._name));
|
19 | generator.set('cache.config', config);
|
20 |
|
21 |
|
22 | utils.merge(generator.options, app.options);
|
23 | utils.merge(generator.options, config);
|
24 |
|
25 |
|
26 | if (app.generators.hasOwnProperty('default') && alias !== 'default') {
|
27 | var compose = generator
|
28 | .compose(['default'])
|
29 | .options();
|
30 |
|
31 | if (typeof app.data === 'function') {
|
32 | compose.data();
|
33 | }
|
34 |
|
35 | if (typeof app.pipeline === 'function') {
|
36 | compose.pipeline();
|
37 | }
|
38 |
|
39 | if (typeof app.helper === 'function') {
|
40 | compose.helpers();
|
41 | compose.engines();
|
42 | compose.views();
|
43 | }
|
44 |
|
45 | if (typeof app.question === 'function') {
|
46 | compose.questions();
|
47 | }
|
48 | }
|
49 | };
|