Migrate Obsidian plugins between API versions and handle breaking changes.
Use when upgrading to new Obsidian versions, handling API deprecations,
or migrating plugin code to new patterns.
Trigger with phrases like "obsidian upgrade", "obsidian migration",
"obsidian API changes", "update obsidian plugin".
!npm list 2>/dev/null | head -20
!cat manifest.json 2>/dev/null || echo 'No manifest.json in cwd'
Overview
Upgrade an Obsidian plugin between versions: migrate persisted settings with version checks, replace deprecated API calls, update manifest.jsonminAppVersion, and test across Obsidian releases.
# Clean build
rm -rf dist node_modules/.cache
npm install
npm run build
# Check for type errors
npx tsc --noEmit
# Check bundle for leftover deprecated calls
grep -rn 'cm\.getValue\|processFrontMatter.*sync\|vault\.modify.*string' src/ || echo "No deprecated patterns found"
Manual testing checklist:
Install plugin on the minAppVersion you declared -- confirm it loads without errors
Install on latest Obsidian -- confirm full functionality
Test settings migration: copy a data.json from an older version into the plugin directory, reload, verify settings are preserved and upgraded
Open Developer Console (Ctrl+Shift+I) and check for deprecation warnings
Step 7: Handle the Release
# Update version in package.json and manifest.json
npm version major # or minor/patch
# Ensure versions.json includes the new mapping
python3 -c "
import json
v = json.load(open('versions.json'))
m = json.load(open('manifest.json'))
v[m['version']] = m['minAppVersion']
json.dump(v, open('versions.json', 'w'), indent=2)
print(f\"Added {m['version']} -> {m['minAppVersion']}\")
"
# Build the release artifacts
npm run build
Output
Updated manifest.json with correct minAppVersion
Updated versions.json with new version mapping
Settings migration code that handles all previous schema versions
All deprecated API calls replaced with current equivalents
Clean tsc --noEmit with no type errors
Tested on minimum and latest Obsidian versions
Error Handling
Error
Cause
Solution
Property does not exist on type 'Plugin'
API removed in newer obsidian types
Check changelog for replacement API
Cannot find module 'obsidian'
Types not installed
npm install obsidian@latest --save-dev
Settings lost after upgrade
No migration logic for _version jump
Add migration step for each version gap
TypeError: x is not a function at runtime
API exists in types but not in user's Obsidian
Lower minAppVersion or add runtime version check
Plugin loads but features missing
Feature flag not migrated
Check settings migration covers all paths
Examples
Simple version bump: Plugin works fine on new Obsidian, just need to update minAppVersion. Run Step 1 to audit, Step 5 to update manifest, Step 6 to verify.
CodeMirror 5 to 6 migration: Plugin uses editor.cm for custom decorations. Replace CM5 Decoration with CM6 EditorView extensions per Step 4. This is the most common large migration.
Settings schema change: Plugin v2 renamed darkMode: boolean to theme: 'light' | 'dark' | 'system'. Add migration in Step 3 that maps the old boolean to the new enum, preserving user preference.