Files
semaphore/scripts/remove-stable-version-field.ts
2024-10-23 10:50:46 +01:00

27 lines
766 B
TypeScript
Executable File

#!/usr/bin/env ts-node
import { readFileSync, readdirSync, writeFileSync } from "node:fs"
const folderName = "packages"
async function main() {
const filePaths = readdirSync(folderName, { withFileTypes: true })
.filter((file) => file.isDirectory())
.map((dir) => (dir.name === "contracts" ? `${dir.name}/contracts` : dir.name))
.map((name) => `${folderName}/${name}/package.json`)
for (const filePath of filePaths) {
const content = JSON.parse(readFileSync(filePath, "utf8"))
if (content.stableVersion) {
delete content.stableVersion
}
writeFileSync(filePath, JSON.stringify(content, null, 4), "utf8")
}
}
main().catch((error) => {
console.error(error)
process.exit(1)
})