chore: mirror versions.json to repo root and add .nvmrc

Obsidian's community plugin registry validator may look for
versions.json at the repo root alongside manifest.json. The
bump-version script and npm version lifecycle hook now sync
both root mirrors (manifest.json + versions.json) automatically,
and version-check CI asserts they stay in sync.

Also adds .nvmrc (Node 20) to pin the development runtime,
matching the engines field in plugin/package.json.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Souta 2026-04-30 20:53:15 +09:00
parent 738883f92e
commit ff93c72e67
5 changed files with 113 additions and 5 deletions

View file

@ -79,6 +79,15 @@ jobs:
exit 1
fi
- name: Root versions.json mirror must match plugin/versions.json
run: |
if ! diff -q plugin/versions.json versions.json > /dev/null; then
echo "::error::versions.json content differs from plugin/versions.json."\
" Re-run 'cd plugin && npm version <same>' or copy manually."
diff plugin/versions.json versions.json || true
exit 1
fi
- name: PR version must be strictly greater than base
run: |
# Pure-shell semver compare: strip pre-release suffix, split,

1
.nvmrc Normal file
View file

@ -0,0 +1 @@
20

View file

@ -19,7 +19,7 @@
"sshd:start": "node scripts/start-test-sshd.mjs",
"sshd:stop": "node scripts/stop-test-sshd.mjs",
"lint": "eslint \"src/**/*.ts\"",
"version": "node scripts/bump-version.mjs && git add manifest.json versions.json"
"version": "node scripts/bump-version.mjs && git add manifest.json versions.json ../manifest.json ../versions.json"
},
"keywords": [
"obsidian",

View file

@ -1,6 +1,6 @@
// Sync `plugin/manifest.json`, the repo-root mirror `manifest.json`,
// and `plugin/versions.json` with the version that npm has just
// written into `plugin/package.json`.
// Sync `plugin/manifest.json`, the repo-root mirrors `manifest.json`
// and `versions.json`, and `plugin/versions.json` with the version
// that npm has just written into `plugin/package.json`.
//
// Wired into `package.json`'s `"version"` lifecycle script so
// `npm version <X.Y.Z>` (run from `plugin/`) updates all four
@ -32,6 +32,7 @@ const packagePath = path.join(pluginRoot, 'package.json');
const manifestPath = path.join(pluginRoot, 'manifest.json');
const versionsPath = path.join(pluginRoot, 'versions.json');
const rootManifestPath = path.join(repoRoot, 'manifest.json');
const rootVersionsPath = path.join(repoRoot, 'versions.json');
const pkg = readJson(packagePath);
const manifest = readJson(manifestPath);
@ -49,9 +50,10 @@ versions[newVersion] = manifest.minAppVersion;
writeJson(manifestPath, manifest);
writeJson(versionsPath, versions);
writeJson(rootManifestPath, manifest);
writeJson(rootVersionsPath, versions);
console.log(
`bump-version: synced plugin/manifest.json + manifest.json + versions.json to ${newVersion} `
`bump-version: synced plugin/manifest.json + manifest.json + versions.json (plugin + root) to ${newVersion} `
+ `(minAppVersion ${manifest.minAppVersion})`,
);

96
versions.json Normal file
View file

@ -0,0 +1,96 @@
{
"0.1.0": "1.4.0",
"0.2.0": "1.4.0",
"0.3.0": "1.4.0",
"0.3.1": "1.4.0",
"0.3.2": "1.4.0",
"0.4.0": "1.4.0",
"0.4.1": "1.4.0",
"0.4.2": "1.4.0",
"0.4.3": "1.4.0",
"0.4.4": "1.4.0",
"0.4.5": "1.4.0",
"0.4.6": "1.4.0",
"0.4.7": "1.4.0",
"0.4.8": "1.4.0",
"0.4.9": "1.4.0",
"0.4.10": "1.4.0",
"0.4.11": "1.4.0",
"0.4.12": "1.4.0",
"0.4.13": "1.4.0",
"0.4.14": "1.4.0",
"0.4.15": "1.4.0",
"0.4.16": "1.4.0",
"0.4.17": "1.4.0",
"0.4.18": "1.4.0",
"0.4.19": "1.4.0",
"0.4.20": "1.4.0",
"0.4.21": "1.4.0",
"0.4.22": "1.4.0",
"0.4.23": "1.4.0",
"0.4.24": "1.4.0",
"0.4.25": "1.4.0",
"0.4.26": "1.4.0",
"0.4.27": "1.4.0",
"0.4.28": "1.4.0",
"0.4.29": "1.4.0",
"0.4.30": "1.4.0",
"0.4.31": "1.4.0",
"0.4.32": "1.4.0",
"0.4.33": "1.4.0",
"0.4.34": "1.4.0",
"0.4.35": "1.4.0",
"0.4.36": "1.4.0",
"0.4.37": "1.4.0",
"0.4.38": "1.4.0",
"0.4.39": "1.4.0",
"0.4.40": "1.4.0",
"0.4.41": "1.4.0",
"0.4.42": "1.4.0",
"0.4.43": "1.4.0",
"0.4.44": "1.4.0",
"0.4.45": "1.4.0",
"0.4.46": "1.4.0",
"0.4.47": "1.4.0",
"0.4.48": "1.4.0",
"0.4.49": "1.4.0",
"0.4.50": "1.4.0",
"0.4.51": "1.4.0",
"0.4.52": "1.4.0",
"0.4.53": "1.4.0",
"0.4.54": "1.4.0",
"0.4.55": "1.4.0",
"0.4.56": "1.4.0",
"0.4.57": "1.4.0",
"0.4.58": "1.4.0",
"0.4.59": "1.4.0",
"0.4.60": "1.4.0",
"0.4.61": "1.4.0",
"0.4.62": "1.4.0",
"0.4.63": "1.4.0",
"0.4.64": "1.4.0",
"0.4.65": "1.4.0",
"0.4.66": "1.4.0",
"0.4.67": "1.4.0",
"0.4.68": "1.4.0",
"0.4.69": "1.4.0",
"0.4.70": "1.4.0",
"0.4.71": "1.4.0",
"0.4.72": "1.4.0",
"0.4.73": "1.4.0",
"0.4.74": "1.4.0",
"0.4.75": "1.4.0",
"0.4.76": "1.4.0",
"0.4.77": "1.4.0",
"0.4.78": "1.4.0",
"0.4.79": "1.4.0",
"0.4.80": "1.4.0",
"0.4.81": "1.4.0",
"0.4.82": "1.4.0",
"0.4.83": "1.4.0",
"0.4.84": "1.4.0",
"0.4.85": "1.4.0",
"0.4.86": "1.4.0",
"0.4.87": "1.4.0",
"0.4.88": "1.4.0"
}