This repository was archived by the owner on Nov 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
66 lines (58 loc) · 1.53 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
60
61
62
63
64
65
66
const path = require('path');
const generator = require('yeoman-generator');
module.exports = generator.Base.extend({
constructor: function() {
generator.Base.apply(this, arguments);
this.argument('name', { type: String, required: true });
},
configuring: function() {
this.fs.copy(
this.templatePath('_flowconfig'),
this.destinationPath('.flowconfig')
);
this.fs.copy(
this.templatePath('_gitignore'),
this.destinationPath('.gitignore')
);
this.fs.copy(
this.templatePath('_watchmanconfig'),
this.destinationPath('.watchmanconfig')
);
this.fs.copy(
this.templatePath('_buckconfig'),
this.destinationPath('.buckconfig')
);
},
writing: function() {
if (this.options.upgrade) {
// never upgrade index.*.js files
return;
}
this.fs.copyTpl(
this.templatePath('package.json'),
this.destinationPath('package.json'),
{name: this.name}
);
if (!this.options['skip-ios']) {
this.fs.copyTpl(
this.templatePath('index.ios.js'),
this.destinationPath('index.ios.js'),
{name: this.name}
);
}
if (!this.options['skip-android']) {
this.fs.copyTpl(
this.templatePath('index.android.js'),
this.destinationPath('index.android.js'),
{name: this.name}
);
}
},
install: function() {
if (this.options.upgrade) {
return;
}
this.spawnCommandSync('git', ['init'], { cwd: this.destinationPath() });
this.npmInstall();
}
});