Skip to content

Commit a820620

Browse files
authored
fix: Replace the carriage return in the source with a newline. (vuejs#31)
1 parent a21514f commit a820620

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/vue-codemod.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function processTransformation(
136136
debug(`Processing ${p}…`)
137137
const fileInfo = {
138138
path: p,
139-
source: fs.readFileSync(p).toString()
139+
source: fs.readFileSync(p).toString().split('\r\n').join('\n'),
140140
}
141141
const extension = (/\.([^.]*)$/.exec(fileInfo.path) || [])[0]
142142
if (!extensions.includes(extension)) {
@@ -151,7 +151,7 @@ function processTransformation(
151151
params as object
152152
)
153153

154-
if (fs.readFileSync(p).toString() != result) {
154+
if (fileInfo.source != result) {
155155
fs.writeFileSync(p, result)
156156
if (util.inspect(processFilePath).indexOf(util.inspect(p)) == -1) {
157157
processFilePath.push(p)

0 commit comments

Comments
 (0)