Developer Guide

Everything you need to build, run, and debug the plugin โ€” nothing more.

Install required tools

Install these once per machine.

ToolWhyDownload
Node.js โ‰ฅ 18Runs esbuild and npmnodejs.org โ€” LTS version
GitVersion controlgit-scm.com
VS CodeEditor with TypeScript supportcode.visualstudio.com

Verify in the terminal:

terminal
$ node --version   # must be v18 or higher
$ npm --version
$ git --version

VS Code extensions

Install via Ctrl+Shift+X:

  • dbaeumer.vscode-eslint โ€” ESLint
  • esbenp.prettier-vscode โ€” Prettier
  • usernamehw.errorlens โ€” Error Lens
  • ritwickdey.liveserver โ€” Live Server (for the docs/ HTML files)

Project structure

yaml-path-sync/ โ† repo root
โ”œโ”€โ”€ .github/
โ”‚ โ””โ”€โ”€ workflows/
โ”‚ โ””โ”€โ”€ release.yml โ† GitHub Actions
โ”‚
โ”œโ”€โ”€ docs/ โ† GitHub Pages
โ”‚ โ”œโ”€โ”€ index.html
โ”‚ โ””โ”€โ”€ dev-guide.html
โ”‚
โ”œโ”€โ”€ src/
โ”‚ โ””โ”€โ”€ main.ts โ† only file you edit
โ”‚
โ”œโ”€โ”€ main.js โ† generated by esbuild โ€” never edit
โ”œโ”€โ”€ manifest.json โ† must stay in root (Obsidian)
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ esbuild.config.mjs
โ”œโ”€โ”€ tsconfig.json
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ .gitignore
โš ๏ธ

main.js and manifest.json must stay in the root. Obsidian only looks there. Never move them into a subfolder.

Project setup

Do this once after cloning or creating the project.

  • 1

    Open in VS Code

    terminal
    $ cd ~/Dev/yaml-path-sync
    $ code .
  • 2

    Install dependencies

    terminal
    $ npm install
    added 19 packages in 885ms

    This installs esbuild, TypeScript, and the Obsidian type definitions. Run only once (or after changing package.json).

  • 3

    Enable the plugin in Obsidian

    Settings โ†’ Community Plugins โ†’ disable Restricted Mode โ†’ toggle YAML Path Sync on.

    โ„น๏ธ

    If the plugin doesn't appear, restart Obsidian once after creating the symlink.

Watch mode

Start this at the beginning of every session. Leave it running in the background.

terminal
$ npm run dev
Watching for changes โ€ฆ (Ctrl+C to stop)

Every time you save src/main.ts, esbuild recompiles in under 100 ms and writes a new main.js automatically. Stop with Ctrl+C.

Alternatively press Ctrl+Shift+B in VS Code to run it as a background task.

Reload the plugin in Obsidian

Obsidian doesn't detect file changes automatically. After each rebuild you need to reload.

MethodHowSpeed
Hot Reload (recommended)Install the community plugin "Hot Reload" โ€” it watches main.js and reloads automatically after every rebuild.~1 s โ€” automatic
Toggle off / onSettings โ†’ Community Plugins โ†’ toggle off, then on.~3 s
Restart ObsidianClose and reopen.~10 s

Debug

Open DevTools in Obsidian

  • Windows / Linux: Ctrl + Shift + I
  • macOS: Cmd + Option + I

Chrome DevTools opens โ€” identical to what you see in a browser.

โš ๏ธ

If the shortcut doesn't work, start Obsidian from the terminal:
macOS: open -a Obsidian --args --remote-debugging-port=9229
Windows: obsidian.exe --remote-debugging-port=9229

Console tab

All console.log() calls from the plugin appear here. Filter by typing YAML Path Sync in the filter box.

console
YAML Path Sync: loaded.
YAML Path Sync: "path" set on create โ†’ 02 Areas/C/Pointer C.md
YAML Path Sync: "path" updated โ†’ Archiv/C/Pointer C.md

Add your own debug output anywhere in src/main.ts:

typescriptsrc/main.ts
console.log('content:', content);
console.log('fieldExists:', fieldExists);
console.log('settings:', this.settings);

Breakpoints (Sources tab)

Because watch mode compiles with inline source maps, DevTools shows the original TypeScript โ€” not compiled JS.

  1. Click the Sources tab in DevTools
  2. Find src/main.ts in the file tree
  3. Click a line number to set a breakpoint
  4. Trigger the action in Obsidian (create or move a file)
  5. Execution pauses โ€” hover over any variable to inspect its value

Attach VS Code debugger (optional)

Start Obsidian with the remote debug port, then press F5 in VS Code and select "Attach to Obsidian". Breakpoints set in src/main.ts will pause execution directly inside VS Code.

โ„น๏ธ

Source maps are only included in dev builds (npm run dev). The production build has none โ€” use dev builds when debugging.

Type checking

esbuild skips type checks. Run this explicitly to catch type errors before releasing:

terminal
$ npm run check
# No output = no errors โœ“
src/main.ts(42,5): error TS2322: ...

Production build

terminal
$ npm run build
Build complete.
npm run devnpm run build
Source mapsโœ… InlineโŒ None
MinifiedโŒ Noโœ… Yes
Keeps runningโœ… Watch modeโŒ Exits
Use forDevelopmentReleases
โš ๏ธ

Always run npm run build before releasing. Dev builds contain large inline source maps and must not be shipped.

Release

  • 1

    Bump the version

    Update "version" in both manifest.json and package.json to the new version, e.g. "1.3.1".

  • 2

    Production build + commit

    terminal
    $ npm run build
    $ git add .
    $ git commit -m "Release v1.3.1"
    $ git push
  • 3

    Tag and push โ€” triggers the GitHub Action

    terminal
    $ git tag v1.3.1
    $ git push origin v1.3.1

    The workflow at .github/workflows/release.yml detects the v* tag, builds the plugin, and creates a GitHub release with main.js and manifest.json attached. Watch progress at GitHub โ†’ Actions.

Troubleshooting

ProblemFix
npm: command not foundInstall Node.js from nodejs.org and reopen the terminal
Cannot find module 'obsidian'Run npm install
Plugin not in ObsidianCheck symlink points to correct folder. Restart Obsidian.
Changes not visible after savingConfirm npm run dev is running. Reload the plugin (or use Hot Reload).
DevTools shows compiled JS, not TypeScriptUse npm run dev โ€” source maps are only in dev builds
GitHub Action not triggeredTag must start with v. Use git push origin v1.3.1
Action runs but no release filesWorkflow file must be at .github/workflows/release.yml โ€” not workflows/release.yml