@@ -86,6 +86,7 @@ GruntpluginGenerator.prototype.askFor = function askFor() {
86
86
this . slugname = this . _ . slugify ( props . name ) ;
87
87
88
88
this . shortName = props . name . replace ( / ^ g r u n t [ \- _ ] ? / , '' ) . replace ( / [ \W _ ] + / g, '_' ) . replace ( / ^ ( \d ) / , '_$1' ) ;
89
+ this . authorOriginalName = props . authorName ;
89
90
this . authorName = props . authorName . replace ( / [ \\ " ' ] / g, '\\$&' ) . replace ( / \u0000 / g, '\\0' ) ;
90
91
91
92
if ( ! props . homepage ) {
@@ -115,5 +116,48 @@ GruntpluginGenerator.prototype.projectfiles = function projectfiles() {
115
116
116
117
this . template ( '_README.md' , 'README.md' ) ;
117
118
this . template ( '_Gruntfile.js' , 'Gruntfile.js' ) ;
118
- this . template ( '_package.json' , 'package.json' ) ;
119
+ } ;
120
+
121
+ GruntpluginGenerator . prototype . packageFile = function packageFile ( ) {
122
+ var pkgFile = {
123
+ name : this . slugname ,
124
+ version : this . props . version ,
125
+ description : this . props . description ,
126
+ homepage : this . props . homepage ,
127
+ repository : this . props . repository ,
128
+ bugs : this . props . repository + 'issues' ,
129
+ author : {
130
+ name : this . authorOriginalName ,
131
+ email : this . props . authorEmail
132
+ } ,
133
+ keywords : [
134
+ 'gruntplugin'
135
+ ] ,
136
+ main : 'Gruntfile.js' ,
137
+ engines : {
138
+ node : this . props . nodeVersion
139
+ } ,
140
+ licenses : [
141
+ {
142
+ type : this . props . license
143
+ }
144
+ ] ,
145
+ devDependencies : {
146
+ 'grunt-contrib-clean' : '~0.4.0' ,
147
+ 'grunt-contrib-jshint' : '~0.2.0' ,
148
+ 'grunt-contrib-nodeunit' : '~0.1.2' ,
149
+ 'grunt' : this . props . gruntVersion ,
150
+ 'jshint-stylish' : '~0.1.3' ,
151
+ 'load-grunt-tasks' : '~0.2.0'
152
+ } ,
153
+ scripts : {
154
+ test : 'grunt test'
155
+ }
156
+ } ;
157
+
158
+ if ( this . props . authorUrl ) {
159
+ pkgFile . author . url = this . props . authorUrl ;
160
+ }
161
+
162
+ this . writeFileFromString ( JSON . stringify ( pkgFile , null , 2 ) , 'package.json' ) ;
119
163
} ;
0 commit comments