From ff93c72e672f4e6a66e9958e87e4eed238bd1f89 Mon Sep 17 00:00:00 2001 From: Souta Date: Thu, 30 Apr 2026 20:53:15 +0900 Subject: [PATCH] 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) --- .github/workflows/version-check.yml | 9 +++ .nvmrc | 1 + plugin/package.json | 2 +- plugin/scripts/bump-version.mjs | 10 +-- versions.json | 96 +++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 .nvmrc create mode 100644 versions.json diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml index 4aa876e..618b24f 100644 --- a/.github/workflows/version-check.yml +++ b/.github/workflows/version-check.yml @@ -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 ' 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, diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +20 diff --git a/plugin/package.json b/plugin/package.json index a773272..1baefa2 100644 --- a/plugin/package.json +++ b/plugin/package.json @@ -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", diff --git a/plugin/scripts/bump-version.mjs b/plugin/scripts/bump-version.mjs index a405b0d..61cf705 100644 --- a/plugin/scripts/bump-version.mjs +++ b/plugin/scripts/bump-version.mjs @@ -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 ` (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})`, ); diff --git a/versions.json b/versions.json new file mode 100644 index 0000000..8871d8f --- /dev/null +++ b/versions.json @@ -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" +}