Skip to content

Commit

Permalink
chore: update remove stable version script
Browse files Browse the repository at this point in the history
  • Loading branch information
vplasencia committed Apr 18, 2024
1 parent 9dc5372 commit 416a7f7
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions scripts/remove-stable-version-field.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import { readFileSync, readdirSync, writeFileSync } from "node:fs"

const folderName = "packages"
import { readFileSync, writeFileSync } from "node:fs"

async function main() {
const filePaths = readdirSync(folderName, { withFileTypes: true })
.filter((file) => file.isDirectory())
.map((name) => `${folderName}/${name}/package.json`)
const projectDirectory = `packages/${process.argv[2]}`

for (const filePath of filePaths) {
const content = JSON.parse(readFileSync(filePath, "utf8"))
const filePath = `${projectDirectory}/package.json`

if (content.stableVersion) {
delete content.stableVersion
}
const content = JSON.parse(readFileSync(filePath, "utf8"))

writeFileSync(filePath, JSON.stringify(content, null, 4), "utf8")
if (content.stableVersion) {
delete content.stableVersion
}

writeFileSync(filePath, JSON.stringify(content, null, 4), "utf8")
}

main()
Expand Down

0 comments on commit 416a7f7

Please sign in to comment.