Skip to content

Commit

Permalink
chore: fix logging in update examples script
Browse files Browse the repository at this point in the history
  • Loading branch information
guansss committed Nov 9, 2023
1 parent f3ea296 commit 2ee09a9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions scripts/update-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ async function updateWithRemote() {
rewriteFile(file, (content) => {
let originalVersion = ""

const result = content.replace(/"webpack-monkey": "([^"]+)"/, function (_, v) {
const result = content.replace(/"webpack-monkey": ".*?(\d.+)"/, function (match, v) {
originalVersion = v
return `"webpack-monkey": "^${latestVersion}"`
return match.replace(v, latestVersion)
})

console.log(
`${path.basename(path.dirname(file))}:`,
originalVersion || `***not found***`,
originalVersion ? `-> ^${latestVersion}` : "(unchanged)",
)
if (originalVersion) {
console.log(
`${path.basename(path.dirname(file))}:`,
originalVersion,
originalVersion !== latestVersion ? `-> ${latestVersion}` : "(unchanged)",
)
} else {
console.log(`${path.basename(path.dirname(file))}:`, `***not found***`)
}

return result
})
Expand Down

0 comments on commit 2ee09a9

Please sign in to comment.