-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
59 lines (47 loc) · 1.37 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*!
* common-questions <https://github.com/generate/common-questions>
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
var debug = require('debug')('common-questions');
var questions = require('./lib/questions');
var listener = require('./lib/listener');
var utils = require('./lib/utils');
var hints = require('./lib/hints');
module.exports = function(config) {
config = config || {};
return function(app) {
if (!utils.isValid(app, 'common-questions')) return;
debug('initializing from <%s>', __filename);
var opts = utils.extend({}, app.base.options, app.options, config);
app.cache.answers = app.cache.answers || {};
app.cache.data = app.cache.data || {};
/**
* Plugins
*/
app.use(utils.project());
app.use(utils.pkg());
app.use(utils.questions(opts));
/**
* Default prompt messages.
*
* These can be be overridden in your app
* by creating a new question with the same key. For example, the
* folling will override the `name` question:
*
* ```js
* app.question('name', 'custom message...');
* ```
*/
questions(app, opts);
/**
* Hints for common-questions prompts.
*/
listener(app, opts);
};
};
module.exports.disableHints = hints;
module.exports.questions = questions;
module.exports.listener = listener;