Repository navigation
Lower minAppVersion to 1.11.0 with runtime compatibility guards - #46
Merged
Merged
Conversation
Release 1.2.0 raised minAppVersion to 1.13.0, pushing users still on Obsidian 1.11/1.12 back to the older 1.1.2 build via versions.json. Only three 1.13-era APIs were in use; two were already runtime-guarded, but ButtonComponent.setDestructive() would throw on older Obsidian. - Guard setDestructive() behind applyDestructiveStyle() (no-ops on < 1.13). - Declare SettingDefinitionItem locally and read update() via a cast so the forward-compatible settings code type-checks against 1.11 typings. - Ship 1.2.1 with minAppVersion 1.11.0 (manifest.json + versions.json). - Add tsconfig.compat.json and `npm run typecheck:compat` to type-check src against the 1.11 API, plus regression tests for applyDestructiveStyle. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SSikT9ZAfQF8K4SE3DatD3
The 1.11 compatibility gate previously hardcoded the target Obsidian version in two places (an obsidian-1_11 alias devDependency and a static tsconfig.compat.json), so bumping minAppVersion would silently leave the check pinned to the old version. Replace both with scripts/typecheck-compat.mjs, which reads the target from versions.json (the entry for the current manifest version, falling back to manifest.minAppVersion), installs the matching Obsidian typings into a git-ignored cache on demand, and type-checks src against them. The gate now follows minAppVersion automatically with no code changes. Also fold `typecheck:compat` into `npm run build` so it runs wherever the build runs (the husky pre-commit hook and any CI step that builds). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SSikT9ZAfQF8K4SE3DatD3
The repository has CodeQL "default setup" enabled, which rejects SARIF
uploads from an advanced workflow ("CodeQL analyses from advanced
configurations cannot be processed when the default setup is enabled"),
failing the Analyze check on every PR to main. Drop the advanced
.github/workflows/codeql.yml and let GitHub's default setup handle
CodeQL scanning.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSikT9ZAfQF8K4SE3DatD3
|
Member
Author
|
🎉 This PR is included in version 1.2.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Extends plugin compatibility to Obsidian 1.11.0 (from 1.13.0) by adding runtime guards for APIs that were introduced in later versions. This allows the plugin to run on older Obsidian installations while maintaining type safety through a new compatibility type-checking script.
Key Changes
ButtonComponent.setDestructive()(added in 1.13) — wrapped inapplyDestructiveStyle()helper that safely calls the method only if presentPluginSettingTab.update()(added in 1.13) — checked at runtime before calling; falls back to manual re-render on older versionsSettingDefinitionItemtype — declared locally since it doesn't exist in 1.11 typings;getSettingDefinitions()is only called by versions that understand itscripts/typecheck-compat.mjs):npm run buildnow runstypecheck:compatbefore esbuildapplyDestructiveStyle()compatibility helper, verifying it works on both old and new Obsidian versionsImplementation Details
The compatibility type-checking approach is dynamic and version-agnostic: bumping minAppVersion automatically re-points the check to the new target typings without code changes. The script caches typings per version to avoid repeated downloads. All runtime guards use defensive checks (
typeof x === 'function') to gracefully degrade on older versions rather than throwing errors.https://claude.ai/code/session_01SSikT9ZAfQF8K4SE3DatD3