Add apply version script, bump everything to 0.3.0

This commit is contained in:
Jon Staab
2025-05-15 14:33:59 -07:00
parent cc4575666f
commit 593a8c7401
17 changed files with 185 additions and 13 deletions
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
set -e
# Run the TypeScript script using ts-node
pnpm exec ts-node scripts/apply_version.ts
+37
View File
@@ -0,0 +1,37 @@
import {readFileSync, writeFileSync, readdirSync} from "fs"
import {join} from "path"
// Read the root package.json to get the version
const rootPackage = JSON.parse(readFileSync("package.json", "utf8"))
const version = rootPackage.version
if (!version) {
console.error("No version found in root package.json")
process.exit(1)
}
// Get all directories in packages/
const packagesDir = "packages"
const packages = readdirSync(packagesDir, {withFileTypes: true})
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name)
// Update each package.json
for (const pkg of packages) {
const packageJsonPath = join(packagesDir, pkg, "package.json")
try {
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"))
// Update the package version
packageJson.version = version
// Write back to file with proper formatting
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n")
console.log(`Updated ${packageJsonPath}`)
} catch (error) {
console.error(`Error processing ${packageJsonPath}:`, error)
}
}
console.log("Version update complete!")
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "esnext",
"sourceMap": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"types": ["node"],
"noEmit": true
},
"include": [
"./**/*"
]
}