Skip to content

Commit 315baa4

Browse files
authored
feat: add processed files statistic and output (vuejs#15)
1 parent e584cba commit 315baa4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

bin/vue-codemod.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ async function main() {
9696
}
9797
}
9898
packageTransform()
99+
processFilePath.push('package.json')
99100
}
100101
const processFilePathList = processFilePath.join('\n')
101102
console.log(`--------------------------------------------------`)
@@ -133,9 +134,12 @@ function processTransformation(
133134
transformationModule,
134135
params as object
135136
)
136-
fs.writeFileSync(p, result)
137-
if (util.inspect(processFilePath).indexOf(util.inspect(p)) == -1) {
138-
processFilePath.push(p)
137+
138+
if (fs.readFileSync(p).toString() != result) {
139+
fs.writeFileSync(p, result)
140+
if (util.inspect(processFilePath).indexOf(util.inspect(p)) == -1) {
141+
processFilePath.push(p)
142+
}
139143
}
140144
} catch (e) {
141145
console.error(e)

0 commit comments

Comments
 (0)