hesprs_obsidian-webdav-sync/scripts/version-bump.ts
Hēsperus 8690e03fe4
refactor(all): shift to bun (#153)
* refactor(all): shift to bun

* fix(lint): run lint

* fix(test): organize mocks

* fix(mock): restore mocks after declaration

* fix(mock): reverse mock what is mocked
2026-06-07 17:36:49 +08:00

20 lines
851 B
TypeScript

const targetVersion = Bun.env.npm_package_version ?? '1.0.0';
// Read minAppVersion from manifest.json and bump version to target version
const manifest = JSON.parse(await Bun.file('manifest.json').text()) as {
minAppVersion: string;
version?: string;
};
const { minAppVersion } = manifest;
manifest.version = targetVersion;
await Bun.write('manifest.json', JSON.stringify(manifest, undefined, '\t'));
// Update versions.json with target version and minAppVersion from manifest.json
const versions = JSON.parse(await Bun.file('versions.json').text()) as Record<string, string>;
versions[targetVersion] = minAppVersion;
await Bun.write('versions.json', JSON.stringify(versions, undefined, '\t'));
Bun.spawnSync({ cmd: ['bun', 'oxfmt', 'versions.json', 'manifest.json'] });
// oxlint-disable-next-line unicorn/require-module-specifiers
export {};