@@ -7,20 +7,28 @@ const _ = require('lodash');
7
7
const shelljs = require ( 'shelljs' ) ;
8
8
9
9
module . exports = Generator . extend ( {
10
- initializing : function ( ) {
10
+ initializing : function ( ) {
11
11
const done = this . async ( ) ;
12
12
13
13
// Have Yeoman greet the user.
14
- this . log ( yosay (
15
- 'Welcome to the minimal ' + chalk . red ( 'Node TypeScript' ) + ' generator!'
16
- ) ) ;
17
-
18
14
this . log (
19
- chalk . cyan ( 'I simply get down to business of generating, no questions asked!' )
20
- + '\n'
21
- + chalk . yellow ( 'Libraries you ask? I use npm as task runner and jest for testing.' )
22
- + '\n'
23
- + chalk . gray ( 'Can you change these? Of course, it\'s your code. I get out of the way after scaffolding.' )
15
+ yosay (
16
+ 'Welcome to the minimal ' + chalk . red ( 'Node TypeScript' ) + ' generator!'
17
+ )
18
+ ) ;
19
+
20
+ this . log (
21
+ chalk . cyan (
22
+ 'I simply get down to business of generating, no questions asked!'
23
+ ) +
24
+ '\n' +
25
+ chalk . yellow (
26
+ 'Libraries you ask? I use npm as task runner and jest for testing.'
27
+ ) +
28
+ '\n' +
29
+ chalk . gray (
30
+ 'Can you change these? Of course, it\'s your code. I get out of the way after scaffolding.'
31
+ )
24
32
) ;
25
33
26
34
this . composeWith (
@@ -36,8 +44,7 @@ module.exports = Generator.extend({
36
44
} ,
37
45
38
46
writing : {
39
-
40
- vsCodeFiles : function ( ) {
47
+ vsCodeFiles : function ( ) {
41
48
this . fs . copy (
42
49
this . templatePath ( '_vscode/tasks.json' ) ,
43
50
this . destinationPath ( '.vscode/tasks.json' )
@@ -46,18 +53,20 @@ module.exports = Generator.extend({
46
53
this . templatePath ( '_vscode/settings.json' ) ,
47
54
this . destinationPath ( '.vscode/settings.json' )
48
55
) ;
49
- if ( ! ( this . options . mocha || this . options . ava ) ) { // copy launch.json only for default jest configuration
56
+ if ( ! ( this . options . mocha || this . options . ava ) ) {
57
+ // copy launch.json only for default jest configuration
50
58
this . fs . copy (
51
59
this . templatePath ( '_vscode/launch.json' ) ,
52
60
this . destinationPath ( '.vscode/launch.json' )
53
61
) ;
54
62
}
55
63
} ,
56
64
57
- rootFiles : function ( ) {
65
+ rootFiles : function ( ) {
58
66
const today = new Date ( ) ;
59
67
60
- if ( this . options . mocha ) { // copy mocha files
68
+ if ( this . options . mocha ) {
69
+ // copy mocha files
61
70
this . fs . copyTpl (
62
71
this . templatePath ( '_package_mocha.json' ) ,
63
72
this . destinationPath ( 'package.json' ) ,
@@ -67,7 +76,8 @@ module.exports = Generator.extend({
67
76
this . templatePath ( 'travis_mocha.yml' ) ,
68
77
this . destinationPath ( '.travis.yml' )
69
78
) ;
70
- } else if ( this . options . ava ) { // copy ava files
79
+ } else if ( this . options . ava ) {
80
+ // copy ava files
71
81
this . fs . copyTpl (
72
82
this . templatePath ( '_package_ava.json' ) ,
73
83
this . destinationPath ( 'package.json' ) ,
@@ -81,7 +91,8 @@ module.exports = Generator.extend({
81
91
this . templatePath ( '_tsconfig.test.json' ) ,
82
92
this . destinationPath ( 'tsconfig.test.json' )
83
93
) ;
84
- } else { // copy files for default jest configuration
94
+ } else {
95
+ // copy files for default jest configuration
85
96
this . fs . copyTpl (
86
97
this . templatePath ( '_package.json' ) ,
87
98
this . destinationPath ( 'package.json' ) ,
@@ -113,6 +124,10 @@ module.exports = Generator.extend({
113
124
this . templatePath ( 'gitignore' ) ,
114
125
this . destinationPath ( '.gitignore' )
115
126
) ;
127
+ this . fs . copy (
128
+ this . templatePath ( 'npmignore' ) ,
129
+ this . destinationPath ( '.npmignore' )
130
+ ) ;
116
131
this . fs . copyTpl (
117
132
this . templatePath ( 'LICENSE' ) ,
118
133
this . destinationPath ( 'LICENSE' ) ,
@@ -122,12 +137,14 @@ module.exports = Generator.extend({
122
137
} ,
123
138
124
139
install : {
125
- npmInstall : function ( ) {
140
+ npmInstall : function ( ) {
126
141
const generator = this ;
127
142
if ( shelljs . which ( 'yarn' ) ) {
128
143
generator . yarnInstall ( ) ;
129
144
} else {
130
- generator . npmInstall ( null , { skipInstall : this . options [ 'skip-install' ] } ) ;
145
+ generator . npmInstall ( null , {
146
+ skipInstall : this . options [ 'skip-install' ]
147
+ } ) ;
131
148
}
132
149
}
133
150
}
0 commit comments