File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,13 @@ const reservedConfigTransforms = {
58
58
} )
59
59
}
60
60
61
+ const ensureEOL = str => {
62
+ if ( str . charAt ( str . length - 1 ) !== '\n' ) {
63
+ return str + '\n'
64
+ }
65
+ return str
66
+ }
67
+
61
68
module . exports = class Generator {
62
69
constructor ( context , {
63
70
pkg = { } ,
@@ -109,7 +116,7 @@ module.exports = class Generator {
109
116
await this . resolveFiles ( )
110
117
// set package.json
111
118
this . sortPkg ( )
112
- this . files [ 'package.json' ] = JSON . stringify ( this . pkg , null , 2 )
119
+ this . files [ 'package.json' ] = JSON . stringify ( this . pkg , null , 2 ) + '\n'
113
120
// write/update file tree to disk
114
121
await writeFileTree ( this . context , this . files , initialFiles )
115
122
}
@@ -136,7 +143,7 @@ module.exports = class Generator {
136
143
this . context
137
144
)
138
145
const { content, filename } = res
139
- this . files [ filename ] = content
146
+ this . files [ filename ] = ensureEOL ( content )
140
147
delete this . pkg [ key ]
141
148
}
142
149
}
You can’t perform that action at this time.
0 commit comments