@@ -20,16 +20,19 @@ module.exports = class extends Generator {
20
20
)
21
21
) ;
22
22
23
- const prompts = [ {
23
+ const prompts = [
24
+ {
24
25
type : "input" ,
25
26
name : "toolNameComputer" ,
26
- message : "Computer package name? This is a computer name with no capital letters or special characters apart from the - dash." ,
27
+ message :
28
+ "Computer package name? This is a computer name with no capital letters or special characters apart from the - dash." ,
27
29
default : "biojs-webcomponent-tool-name-here"
28
30
} ,
29
31
{
30
32
type : "input" ,
31
33
name : "toolNameHuman" ,
32
- message : 'Thanks! Now, give me a human name for the project - e.g. "Genome Browser"' ,
34
+ message :
35
+ 'Thanks! Now, give me a human name for the project - e.g. "Genome Browser"' ,
33
36
default : "BioJS component"
34
37
}
35
38
] ;
@@ -43,28 +46,32 @@ module.exports = class extends Generator {
43
46
writing ( ) {
44
47
this . fs . copyTpl (
45
48
this . templatePath ( "examples/index.html" ) ,
46
- this . destinationPath ( "examples/index.html" ) , {
49
+ this . destinationPath ( "examples/index.html" ) ,
50
+ {
47
51
title : this . props . toolNameHuman ,
48
52
toolNameComputer : this . props . toolNameComputer
49
53
}
50
54
) ;
51
55
this . fs . copyTpl (
52
56
this . templatePath ( "index.html" ) ,
53
- this . destinationPath ( "index.html" ) , {
57
+ this . destinationPath ( "index.html" ) ,
58
+ {
54
59
title : this . props . toolNameHuman ,
55
60
toolNameComputer : this . props . toolNameComputer
56
61
}
57
62
) ;
58
63
this . fs . copyTpl (
59
64
this . templatePath ( "webpack.config.js" ) ,
60
- this . destinationPath ( "webpack.config.js" ) , {
65
+ this . destinationPath ( "webpack.config.js" ) ,
66
+ {
61
67
toolNameCamel : this . props . toolNameCamel
62
68
}
63
69
) ;
64
70
65
71
this . fs . copyTpl (
66
72
this . templatePath ( "package.json" ) ,
67
- this . destinationPath ( "package.json" ) , {
73
+ this . destinationPath ( "package.json" ) ,
74
+ {
68
75
author : this . props . author ,
69
76
homepage : this . props . homepage ,
70
77
toolNameHuman : this . props . toolNameHuman ,
@@ -75,7 +82,8 @@ module.exports = class extends Generator {
75
82
76
83
this . fs . copyTpl (
77
84
this . templatePath ( "README.md" ) ,
78
- this . destinationPath ( "README.md" ) , {
85
+ this . destinationPath ( "README.md" ) ,
86
+ {
79
87
author : this . props . author ,
80
88
toolNameHuman : this . props . toolNameHuman ,
81
89
toolNameComputer : this . props . toolNameComputer ,
@@ -85,31 +93,35 @@ module.exports = class extends Generator {
85
93
86
94
this . fs . copyTpl (
87
95
this . templatePath ( "src/style.less" ) ,
88
- this . destinationPath ( "src/style.less" ) , {
96
+ this . destinationPath ( "src/style.less" ) ,
97
+ {
89
98
toolNameCamel : this . props . toolNameCamel
90
99
}
91
100
) ;
92
101
93
102
this . fs . copyTpl (
94
103
this . templatePath ( "src/index.js" ) ,
95
- this . destinationPath ( "src/index.js" ) , {
104
+ this . destinationPath ( "src/index.js" ) ,
105
+ {
96
106
toolNameComputer : this . props . toolNameComputer ,
97
107
toolNameCamel : this . props . toolNameCamel
98
108
}
99
109
) ;
100
110
101
111
this . fs . copyTpl (
102
112
this . templatePath ( "dev/serve.js" ) ,
103
- this . destinationPath ( "dev/serve.js" ) ) ;
113
+ this . destinationPath ( "dev/serve.js" )
114
+ ) ;
104
115
105
116
this . fs . copyTpl (
106
117
this . templatePath ( "_gitignore" ) ,
107
- this . destinationPath ( ".gitignore" ) ) ;
118
+ this . destinationPath ( ".gitignore" )
119
+ ) ;
108
120
109
121
this . fs . copyTpl (
110
122
this . templatePath ( "img/favicon.png" ) ,
111
- this . destinationPath ( "img/favicon.png" ) ) ;
112
-
123
+ this . destinationPath ( "img/favicon.png" )
124
+ ) ;
113
125
}
114
126
115
127
install ( ) {
@@ -121,16 +133,19 @@ module.exports = class extends Generator {
121
133
}
122
134
} ;
123
135
124
-
125
136
/**
126
137
* Converts human friendly strings to camelcased space-free strings
138
+ * @param {string } aString a prop taken in by yeoman's wizard
139
+ * @return {aString }, but with spaces removed and camelCased.
127
140
**/
128
141
function toCamelCase ( aString ) {
129
- var tokens = aString . split ( " " ) ,
130
- camelString = "" ;
142
+ var tokens = aString . split ( " " ) ;
143
+
144
+ var camelString = "" ;
131
145
tokens . map ( function ( token ) {
132
146
camelString += token [ 0 ] . toUpperCase ( ) ;
133
- camelString += token . substring ( 1 , token . length )
147
+ camelString += token . substring ( 1 , token . length ) ;
148
+ return true ;
134
149
} ) ;
135
150
return camelString ;
136
151
}
0 commit comments