-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
41 additions
and
5 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
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
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,34 @@ | ||
const fs = require("node:fs/promises"); | ||
const path = require("path"); | ||
|
||
const {version} = require("../package.json"); | ||
|
||
const readJson = file => { | ||
return fs.readFile(file, "utf8") | ||
.then(data => JSON.parse(data)); | ||
}; | ||
|
||
const writeJson = (file, content) => { | ||
return fs.writeFile(file, JSON.stringify(content, null, " "), "utf8"); | ||
}; | ||
|
||
// Prepare next release | ||
const main = async () => { | ||
console.log("[release] Prepare release for packages in './packages' folder"); | ||
const packagesFolder = path.join(process.cwd(), "packages"); | ||
const packagesList = await fs.readdir(packagesFolder); | ||
console.log(`[release] Found ${packagesList.length} packages to prepare`); | ||
// Prepare each package in ./packages folder | ||
for (let i = 0; i < packagesList.length; i++) { | ||
const name = packagesList[i]; | ||
console.log(`[release] Preparing package '${name}'...`); | ||
const packagePath = path.join(packagesFolder, name, "package.json"); | ||
const currentPkg = await readJson(packagePath); | ||
currentPkg.version = version; | ||
await writeJson(packagePath, currentPkg); | ||
} | ||
// Finish release prepare script | ||
console.log("[release] Release ready"); | ||
}; | ||
|
||
main(); |