Skip to content

Commit

Permalink
chore: update version bump script. Clean up versions.json
Browse files Browse the repository at this point in the history
  • Loading branch information
bandantonio committed Mar 1, 2024
1 parent a0cd9e6 commit c3d2e61
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 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"
},
"keywords": [
"obsidian",
Expand Down
21 changes: 10 additions & 11 deletions version-bump.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { readFileSync, writeFileSync } from "fs";
#!/usr/bin/env node

const targetVersion = process.env.npm_package_version;
import { readFileSync, writeFileSync } from 'fs';

// 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 targetVersion = process.argv[2];

let packageJson = JSON.parse(readFileSync('package.json', 'utf8'));
packageJson.version = targetVersion;
writeFileSync('package.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"));
let manifest = JSON.parse(readFileSync('manifest.json', 'utf8'));
manifest.version = targetVersion;
writeFileSync('manifest.json', JSON.stringify(manifest, null, '\t'));

0 comments on commit c3d2e61

Please sign in to comment.