hesprs_obsidian-webdav-sync/scripts/version-bump.ts
2026-06-26 18:22:26 +08:00

22 lines
898 B
TypeScript

import pkg from '../packages/plugin/package.json' with { type: 'json' };
const targetVersion = pkg.version;
// 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 {};