-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
52 lines (45 loc) · 1.44 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
'use strict';
const Generator = require('@ngx-rocket/core');
const chalk = require('chalk');
const pkg = require('../../package.json');
class ExampleGenerator extends Generator {
// DO NOT add a constructor, it won't be called.
// Use initializing() method instead.
//
// See Yeoman's doc run loop priorities for the list of specific tasks:
// http://yeoman.io/authoring/running-context.html
initializing() {
// Setting version allows Yeoman to notify the user of updates
this.version = pkg.version;
this.log(`Using ${chalk.cyan('ngx-rocket')} addon example ${chalk.green(this.version)}`);
}
beforeWriting() {
// Augment this generator's properties with shared properties so it can be
// used in templates
Object.assign(this.props, this.sharedProps);
}
}
module.exports = Generator.make({
// Base directory of your templates
baseDir: __dirname,
// Your generator (optional, you can use only templates)
generator: ExampleGenerator,
// Your generator prompts (optional)
// See https://github.com/sboudrias/Inquirer.js#objects for details
prompts: [
{
type: 'confirm',
name: 'sayHello',
message: 'Shall we say hello?',
default: true
},
{
type: 'input',
name: 'helloName',
message: 'To whom shall we say hello?',
default: 'world',
// Only ask this one when "yes" is replied to the sayHello prompt
when: props => props.sayHello
}
]
});