dylanarmstrong_obsidian-pre.../version-bump.mjs

16 lines
703 B
JavaScript
Raw Permalink Normal View History

2025-04-04 07:28:09 +00:00
import process from 'node:process';
import { readFileSync, writeFileSync } from 'node:fs';
2022-01-22 21:13:50 +00:00
const targetVersion = process.env.npm_package_version;
// read minAppVersion from manifest.json and bump version to target version
2025-04-04 07:28:09 +00:00
const manifest = JSON.parse(readFileSync('manifest.json', 'utf8'));
2022-01-22 21:13:50 +00:00
const { minAppVersion } = manifest;
manifest.version = targetVersion;
2025-04-04 07:28:09 +00:00
writeFileSync('manifest.json', JSON.stringify(manifest, undefined, '\t'));
2022-01-22 21:13:50 +00:00
// update versions.json with target version and minAppVersion from manifest.json
2025-04-04 07:28:09 +00:00
const versions = JSON.parse(readFileSync('versions.json', 'utf8'));
2022-01-22 21:13:50 +00:00
versions[targetVersion] = minAppVersion;
2025-04-04 07:28:09 +00:00
writeFileSync('versions.json', JSON.stringify(versions, undefined, '\t'));