Change to a Python file for version bumping
This commit is contained in:
parent
45927a5dcb
commit
1f9f9f88bb
2 changed files with 30 additions and 14 deletions
|
|
@ -1,14 +0,0 @@
|
|||
import { readFileSync, writeFileSync } from "fs";
|
||||
|
||||
const targetVersion = process.env.npm_package_version;
|
||||
|
||||
// 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"));
|
||||
|
||||
// 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"));
|
||||
30
version-bump.py
Normal file
30
version-bump.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import json
|
||||
|
||||
plugin_version = None
|
||||
obsidian_version = None
|
||||
|
||||
|
||||
# Load the versions from the manifest
|
||||
with open("manifest.json", "r") as file:
|
||||
data = json.load(file)
|
||||
obsidian_version = data["minAppVersion"]
|
||||
plugin_version = data["version"]
|
||||
|
||||
|
||||
# Update the package.json
|
||||
with open("package.json", "r") as file:
|
||||
package = json.load(file)
|
||||
if plugin_version:
|
||||
package["version"] = plugin_version
|
||||
|
||||
with open("versions.json", "r") as file:
|
||||
versions = json.load(file)
|
||||
if plugin_version and obsidian_version:
|
||||
versions[plugin_version] = obsidian_version
|
||||
|
||||
|
||||
with open("package.json", "w") as file:
|
||||
json.dump(package, file, indent=2)
|
||||
|
||||
with open("versions.json", "w") as file:
|
||||
json.dump(versions, file, indent=2)
|
||||
Loading…
Add table
Add a link
Reference in a new issue