Skip to content

Commit

Permalink
chore: updated versions script
Browse files Browse the repository at this point in the history
refs: #9
  • Loading branch information
aaronczichon committed Apr 23, 2024
1 parent 64f4685 commit 6350af2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
"version": "node version-bump.mjs && git add manifest.json versions.json",
"version": "node version-bump.mjs && git add manifest.json versions.json package.json",
"prepare": "husky",
"prettier": "prettier --write .",
"check": "prettier --check ."
Expand Down
13 changes: 9 additions & 4 deletions version-bump.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ import { readFileSync, writeFileSync } from "fs";
const targetVersion = process.env.npm_package_version;

// read minAppVersion from manifest.json and bump version to target version
let manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
const { minAppVersion } = manifest;
manifest.version = targetVersion;
writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t"));
let packageJson = JSON.parse(readFileSync("manifest.json", "utf8"));
const { minAppVersion } = packageJson;
packageJson.version = targetVersion;
writeFileSync("manifest.json", JSON.stringify(packageJson, null, "\t"));

// update versions.json with target version and minAppVersion from manifest.json
let versions = JSON.parse(readFileSync("versions.json", "utf8"));
versions[targetVersion] = minAppVersion;
writeFileSync("versions.json", JSON.stringify(versions, null, "\t"));

// update package.json with version update
let packageJson = JSON.parse(readFileSync("package.json", "utf8"));
packageJson.version = targetVersion;
writeFileSync("package.json", JSON.stringify(packageJson, null, "\t"));

0 comments on commit 6350af2

Please sign in to comment.