| 132 | } |
| 133 | |
| 134 | function commandPrepare(nextVersion: string, entriesJson: string): void { |
| 135 | // Bump app/package.json |
| 136 | const pkgPath = join(repoRoot, 'app', 'package.json') |
| 137 | const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) |
| 138 | pkg.version = nextVersion |
| 139 | writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n') |
| 140 | console.log(`✅ Set app/package.json version to ${nextVersion}`) |
| 141 | |
| 142 | // Prepend to changelog.json |
| 143 | const changelogPath = join(repoRoot, 'changelog.json') |
| 144 | const changelog = JSON.parse(readFileSync(changelogPath, 'utf8')) |
| 145 | const entries: ReadonlyArray<string> = JSON.parse(entriesJson) |
| 146 | changelog.releases = { [nextVersion]: entries, ...changelog.releases } |
| 147 | writeFileSync(changelogPath, JSON.stringify(changelog, null, 2) + '\n') |
| 148 | console.log( |
| 149 | `✅ Added ${entries.length} entries to changelog.json under ${nextVersion}` |
| 150 | ) |
| 151 | } |
| 152 | |
| 153 | async function main(): Promise<void> { |
| 154 | const [command, ...args] = process.argv.slice(2) |