# Developing Whereabouts ## Requirements - Node 18+ and npm - Linux/macOS/Windows for building; the end-to-end suite is written for Linux (it needs `xvfb-run`) - Joplin desktop **3.7 or newer** to run against ## Build ```bash npm install # also runs `npm run dist` via the `prepare` script npm run dist ``` `npm run dist` produces: - `dist/` — the unpacked plugin (`index.js`, `contentScripts/titleChip.js`, `manifest.json`, `whereabouts.css`) - `publish/io.github.pmslava.whereabouts.jpl` — the installable plugin archive - `publish/io.github.pmslava.whereabouts.json` — the plugin-info file used by the Joplin plugin repository ### Version numbers The version lives in **four** places and a CI check fails the build unless all four agree: `package.json` `"version"`, `src/manifest.json` `"version"`, `package-lock.json` top-level `.version`, and `package-lock.json` `.packages[""].version`. `npm run updateVersion` does **not** sync them. It INCREMENTS the last component of each of the first two files independently and then warns if the results differ (`webpack.config.js`, `increaseVersion` / `updateVersion`), so it is only useful for a patch bump from an already-matching pair — and it never touches the lockfile. For anything else, and for a minor or major bump, set `package.json` and `src/manifest.json` to the intended version by hand. Either way, finish with: ```bash npm install --package-lock-only # rewrites the lockfile's two version fields ``` See [PUBLISHING.md](PUBLISHING.md#version-bump). ## Installing a local build **Joplin caches plugin code for the lifetime of the process, so a rebuild is not picked up by a running Joplin.** Install and then fully quit and relaunch — do not use a window reload. 1. `npm run dist` 2. Joplin → **Tools → Options → Plugins → gear icon → Install from file** → `publish/io.github.pmslava.whereabouts.jpl` 3. **Quit Joplin completely** (not just close the window) and start it again. For a faster loop, point Joplin at `dist/` as a development plugin instead: **Tools → Options → Plugins → Advanced → Development plugins**, set it to the absolute path of this repo's `dist` folder, then quit and relaunch after each `npm run dist`. ## How it is put together | File | Role | | --- | --- | | `src/index.ts` | Plugin main process: settings, chrome CSS, content-script registration, the state builder (notebook path + guards), the three click actions, and the focus hand-off that lets a secondary window's chip navigate the main window. | | `src/contentScripts/titleChip.ts` | The chip itself. Runs in the renderer, injects into Joplin's note title bar, and posts actions back. | | `src/common.ts` | Types and constants shared by both bundles. Must not import `joplin` or CodeMirror. | | `src/whereabouts.css` | Chip styling (all `--joplin-*` theme variables) plus the native-pill hide rule. | Five things in the source look odd and are deliberate. Each is commented in place; read the comment before changing them: 1. **The chip is delivered by a CodeMirror content script even though it never touches the note body.** There is no plugin API that reaches Joplin's title bar. A `CodeMirrorPlugin` content script is loaded as a plain `