aurelienstebe_Gladdis/version-bump.js
Aurélien Stébé 54d8975cfd
build: adapt conf to publish as an Obsidian plugin
- add a "live" ESbuild and "prod" Rollup configs to bundle the "main.js"
- add "manifest.json" and version-bump script, adapt the "package.json"
2023-09-20 16:00:07 -04:00

17 lines
718 B
JavaScript
Executable file

import fs from 'fs-extra'
import process from 'process'
const targetVersion = process.argv[2] ?? process.env.npm_package_version
// read minAppVersion from manifest.json and bump version to target version
const manifest = JSON.parse(fs.readFileSync('manifest.json', 'utf-8'))
const { minAppVersion } = manifest
manifest.version = targetVersion
fs.writeFileSync('manifest.json', JSON.stringify(manifest, null, ' ') + '\n')
// update versions.json with target version and minAppVersion from manifest.json
const versions = JSON.parse(fs.readFileSync('versions.json', 'utf-8'))
versions[targetVersion] = minAppVersion
fs.writeFileSync('versions.json', JSON.stringify(versions, null, ' ') + '\n')
process.exit(0)