build: update version bump script; fix minAppVersion in version.json
This commit is contained in:
parent
772be85e67
commit
e015abefd9
|
@ -6,7 +6,7 @@
|
|||
"scripts": {
|
||||
"dev": "node esbuild.config.mjs",
|
||||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
||||
"version": "node version-bump.mjs"
|
||||
"version": "node version-bump.mjs && git add manifest.json versions.json"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
|
|
@ -1,25 +1,14 @@
|
|||
import { readFile as readFile0, writeFile as writeFile0 } from "fs";
|
||||
import { exec as exec0 } from "child_process";
|
||||
import { promisify } from "util";
|
||||
|
||||
const exec = promisify(exec0),
|
||||
readFile = promisify(readFile0),
|
||||
writeFile = promisify(writeFile0);
|
||||
import { readFileSync, writeFileSync } from "fs";
|
||||
|
||||
const targetVersion = process.env.npm_package_version;
|
||||
|
||||
(async () => {
|
||||
// read minAppVersion from manifest.json and bump version to target version
|
||||
let menifest = JSON.parse((await readFile("manifest.json")).toString());
|
||||
const { minAppVersion } = menifest;
|
||||
menifest.version = targetVersion;
|
||||
await writeFile("manifest.json", JSON.stringify(menifest, null, "\t"));
|
||||
// read minAppVersion from manifest.json and bump version to target version
|
||||
let menifest = JSON.parse(readFileSync("manifest.json").toString());
|
||||
const { minAppVersion } = menifest;
|
||||
menifest.version = targetVersion;
|
||||
writeFileSync("manifest.json", JSON.stringify(menifest, null, "\t"));
|
||||
|
||||
// update versions.json with target version and minAppVersion from manifest.json
|
||||
let versions = JSON.parse((await readFile("versions.json")).toString());
|
||||
versions[targetVersion] = minAppVersion;
|
||||
await writeFile("versions.json", JSON.stringify(versions, null, "\t"));
|
||||
|
||||
// save changes in git
|
||||
await exec("git add manifest.json versions.json");
|
||||
})().catch(() => process.exit(1));
|
||||
// update versions.json with target version and minAppVersion from manifest.json
|
||||
let versions = JSON.parse(readFileSync("versions.json").toString());
|
||||
versions[targetVersion] = minAppVersion;
|
||||
writeFileSync("versions.json", JSON.stringify(versions, null, "\t"));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"1.0.0": "0.9.7",
|
||||
"1.0.1": "0.9.12"
|
||||
"1.0.1": "0.12.0"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue