From 6350af2df0898abbef5875a7c50273e3beabacd1 Mon Sep 17 00:00:00 2001 From: Aaron Czichon Date: Tue, 23 Apr 2024 10:20:00 -0300 Subject: [PATCH] chore: updated versions script refs: #9 --- package.json | 2 +- version-bump.mjs | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index abdbacc..15e66b2 100644 --- a/package.json +++ b/package.json @@ -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 ." diff --git a/version-bump.mjs b/version-bump.mjs index d409fa0..e16b0b1 100644 --- a/version-bump.mjs +++ b/version-bump.mjs @@ -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"));