-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Migrate 'latest-version' version to 7.0.0 and fit it with ESM.
Migrating 'latest-version' from 5.1.0 to 7.0.0. New version uses ESM instead of CommonJS. A new script has been added to allow 'latest-version' to be updated. Ref: #5464
- Loading branch information
benny.taccardi
committed
Mar 25, 2023
1 parent
98070cd
commit cee6d03
Showing
2 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const fs = require('fs'); | ||
|
||
// Read the file content | ||
const filePath = 'dist/release/tasks/get-packages.js'; | ||
|
||
fs.readFile(filePath, 'utf-8', (err, fileContent) => { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
// Replace the statement with a new one | ||
const newContent = fileContent.replace(/const latest_version_1 = require\("latest-version"\);/, /const latest_version_1 = await require\("latest-version"\);/); | ||
|
||
// Write the updated content back to the file | ||
fs.writeFile(filePath, newContent, 'utf-8', (err) => { | ||
if (err) { | ||
throw err; | ||
} | ||
console.log('File updated successfully!'); | ||
}); | ||
}); |