-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion-bump.mjs
More file actions
20 lines (15 loc) · 814 Bytes
/
version-bump.mjs
File metadata and controls
20 lines (15 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { readFileSync, writeFileSync } from "fs";
const targetVersion = process.argv[2];
const minAppVersion = process.argv[3];
// Read minAppVersion from existing manifest.json if not provided
let manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
const { minAppVersion: currentMinAppVersion } = manifest;
// Write updated manifest.json
manifest.version = targetVersion;
manifest.minAppVersion = minAppVersion ?? currentMinAppVersion;
writeFileSync("manifest.json", JSON.stringify(manifest, null, 2));
// Update versions.json with the new version
let versions = JSON.parse(readFileSync("versions.json", "utf8"));
versions[targetVersion] = minAppVersion ?? currentMinAppVersion;
writeFileSync("versions.json", JSON.stringify(versions, null, 2));
console.log(`Updated to version ${targetVersion}`);