-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (38 loc) · 1.07 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
const Generator = require('yeoman-generator')
module.exports = class extends Generator {
async prompting () {
const answers = await this.prompt({
type: 'boolean',
name: 'appname',
message: 'Is here your project?',
default: true
})
this.appname = answers.appname
}
writing () {
if (this.appname) {
// Iniciar un git init
this.spawnCommandSync('git', ['init'])
this.spawnCommandSync('git', ['add', '.'])
this.spawnCommandSync('git', ['commit', '-m', '"Initial commit"'])
}
}
async questions () {
if (!this.appname) {
const answers = await this.prompt({
type: 'input',
name: 'directory',
message: 'What is your project name?',
default: 'my-project'
})
this.appnameChange = answers.directory
changeDirectory()
}
}
changeDirectory () {
this.destinationRoot(this.appnameChange)
this.spawnCommandSync('git', ['init'])
this.spawnCommandSync('git', ['add', '.'])
this.spawnCommandSync('git', ['commit', '-m', '"Initial commit"'])
}
}