-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion-bump.mjs
25 lines (17 loc) · 992 Bytes
/
version-bump.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { readFileSync, writeFileSync } from "fs";
// Define paths to the files to update
const packagePath = 'package.json';
const manifestPath = 'manifest.json';
const versionsPath = 'versions.json';
const packageJson = JSON.parse(readFileSync(packagePath, 'utf-8'));
const manifestJson = JSON.parse(readFileSync(manifestPath, 'utf-8'));
const versionsJson = JSON.parse(readFileSync(versionsPath, 'utf-8'));
const newVersion = packageJson.version;
const minAppVersion = manifestJson.minAppVersion;
console.log(`New Version: ${newVersion}\nMinimum App Version: ${minAppVersion}\n`);
manifestJson.version = newVersion;
writeFileSync(manifestPath, JSON.stringify(manifestJson, null, 4));
console.log(`Changed manifest.json version to ${manifestJson.version}\n`);
versionsJson[newVersion] = minAppVersion;
writeFileSync(versionsPath, JSON.stringify(versionsJson, null, 4));
console.log(`Added "${newVersion}: ${minAppVersion}" versions.json:\n${JSON.stringify(versionsJson, null, 4)}`);