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 = {
5858 } )
5959}
6060
61+ const ensureEOL = str => {
62+ if ( str . charAt ( str . length - 1 ) !== '\n' ) {
63+ return str + '\n'
64+ }
65+ return str
66+ }
67+
6168module . exports = class Generator {
6269 constructor ( context , {
6370 pkg = { } ,
@@ -109,7 +116,7 @@ module.exports = class Generator {
109116 await this . resolveFiles ( )
110117 // set package.json
111118 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'
113120 // write/update file tree to disk
114121 await writeFileTree ( this . context , this . files , initialFiles )
115122 }
@@ -136,7 +143,7 @@ module.exports = class Generator {
136143 this . context
137144 )
138145 const { content, filename } = res
139- this . files [ filename ] = content
146+ this . files [ filename ] = ensureEOL ( content )
140147 delete this . pkg [ key ]
141148 }
142149 }
You can’t perform that action at this time.
0 commit comments