annotate version-bump.mjs @ 37:8be02002ed66

Use Obsidian's view APIs for scrolling state Obsidian does some asynchronous formatting upon opening a file which can affect the vertical positioning of things, especially when there are tables for instance. Setting the scrolling position via the CM6 APIs gets invalidated by this, so we're using the Obsidian view API instead even if it only allows getting/setting vertical scrolling (not horizontal).
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 14 Aug 2023 10:44:55 -0700
parents 2a9e941c96ee
children 712761e7625b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
1 import { readFileSync, writeFileSync } from "fs";
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
2
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
3 const targetVersion = process.env.npm_package_version;
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
4
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
5 // read minAppVersion from manifest.json and bump version to target version
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
6 let manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
7 const { minAppVersion } = manifest;
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
8 manifest.version = targetVersion;
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
9 writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t"));
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
10
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
11 // update versions.json with target version and minAppVersion from manifest.json
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
12 let versions = JSON.parse(readFileSync("versions.json", "utf8"));
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
13 versions[targetVersion] = minAppVersion;
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
14 writeFileSync("versions.json", JSON.stringify(versions, null, "\t"));
2a9e941c96ee Bring new build tools from the sample plugin project
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
15