Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit d0e545c

Browse files
fix: use empty content if file does not exist
1 parent 4eb7b01 commit d0e545c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

generator/helpers.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ module.exports = function (api) {
4141
},
4242

4343
updateFile (file, callback) {
44-
let content = fs.readFileSync(file, { encoding: 'utf8' })
44+
let content = fs.existsSync(file)
45+
? fs.readFileSync(file, { encoding: 'utf8' })
46+
: ''
4547

4648
content = callback(content.split(/\r?\n/g)).join('\n')
4749

0 commit comments

Comments
 (0)