Build, pack, and install a plugin¶
This page covers building, packaging, and installing a Lore Desktop plugin with the lore-plugin CLI.
1. Check your tools¶
The plugin SDK, @lore-vcs/desktop-plugins-sdk, is not published to npm yet. It lives in this repository under packages/plugin-sdk, so you build plugins inside a checkout of Lore Desktop.
You need the Node.js version pinned in .nvmrc and pnpm 10. Follow the setup in the README, then build the SDK once:
2. Run the CLI¶
The package has a single executable, lore-plugin. From the repository root, run it through Node:
The help lists create, build, dev, and pack. Inside a plugin folder in the workspace, pnpm exec lore-plugin <command> runs the same binary. The examples below use that form.
3. Scaffold the plugin¶
From the repository root, run the interactive scaffold:
Enter the plugin id, shape, and slot. Use a plugin id such as @scope/name. The plugin is written to packages/plugins/@<scope>/<name>.
The scaffold creates the manifest, the source entries (src/main.ts, src/contract.ts, and for plugins with a slot, src/renderer.tsx, a slot component and optionally a page), a README.md and the TypeScript configuration. The manifest depends on the SDK as workspace:^. The folder has no scripts, so run the commands below with pnpm exec lore-plugin <command> from the plugin folder.
Link the new plugin into the workspace from the repository root:
4. Build the plugin¶
From the plugin directory, run:
To build another directory:
The default directory is ..
The build creates:
dist/main.js: a CommonJS Node bundle; the SDK root andelectronremain external.dist/renderer.js: created whensrc/renderer.tsx(orsrc/renderer.ts) exists, with any split chunks underdist/chunks/.dist/pages/<name>.js: built fromsrc/pages/*.dist/resources copied fromresources/**.dist/vendor/files copied fromvendor/**.
Before bundling, the command loads tsconfig.json and type-checks src/ with noEmit forced on. It prints tsc-style diagnostics to stderr, including the file, line, column, and TSxxxx code. If any check fails, it exits 1 without writing anything to dist/. Use --no-typecheck to skip the check and bundle anyway.
The command also refuses before writing when engines.lore is not a valid semver range or when plugin.main or plugin.renderer do not point at dist/main.js or dist/renderer.js.
Each build replaces only the outputs it owns (dist/main.js, dist/renderer.js, their .js.map files, dist/pages/ and dist/chunks/), so a bundle whose source you renamed or deleted does not linger. Other files in dist/ are kept. The tiers are built into a staging folder beside dist/ and merged in only when every tier has succeeded, so a failure part-way leaves dist/ as it was.
TypeScript 5.x is required for the check. The scaffold adds it as a devDependency. TypeScript 7 has no compiler API; the build refuses it with a message naming the resolved version and --no-typecheck.
If @epicgames/eds-react is not installed locally, the build prints a warning about unverified EDS icon imports and continues. An incorrect icon name fails when the plugin loads in the app.
For how the build works in detail, see Build and tsconfig.
4b. Develop with a linked folder¶
Build the plugin once (section 4), then from the plugin directory run:
The command builds, then watches src/, package.json, tsconfig.json, resources/, and vendor/. It runs the same type check before every rebuild, and its bundles are not minified. A failing rebuild prints the error and leaves dist/ as it was. Press Ctrl-C to stop it.
In Lore Desktop, click the settings cog, select Plugins, select Add plugin, then select Link a plugin folder (development) and choose the plugin folder. Linking checks four things: the folder's package.json is a valid plugin manifest, its engines.lore matches the app, the folder is not inside the app or the installed-plugins folder, and the entry files the manifest names (dist/main.js, and dist/renderer.js if declared) exist. A folder that has not been built is refused with Build the plugin first (missing dist/main.js). A folder whose entry file, or dist/ itself, is a symlink resolving outside the plugin folder is refused too, so keep build output as real files inside the folder. The backend entry of a plugin passed with --plugin-dev-path must also resolve inside its folder.
The plugin appears with a Development tag and is active immediately, including its UI. No restart is needed. Lore Desktop watches the linked folder's dist/ and package.json. When dev writes a new build, the app reloads the plugin in place, on both the main side and the UI, within a couple of seconds. The UI is swapped in one step; there is no empty frame between the old and the new.
The app watches dist/, not src/. If dev is not running, saving source files changes nothing in the app, and the linked plugin keeps running the last build. The link survives app restarts, so run pnpm exec lore-plugin dev again the next day before editing.
A build error, such as a type error or manifest refusal, appears in the terminal only. The app keeps the previous build. A bundle that builds but fails when the app loads it is different: an import exception, a bad EDS icon name, or a register() that throws is not shown in the terminal. For the UI side, the previous UI stays on screen; the plugin row in the Plugins screen shows Renderer failed to load (…): message with a Restart to apply tag, and a banner appears if the Plugins screen is closed. The next good build swaps the UI in and clears both. For the main-process side, a bundle that fails to load leaves the backend down until the next good build; the error is on the row.
Use Unlink from the row menu or detail pane to remove the registration. The folder is left untouched. Linking a folder whose plugin id is already installed from a zip or bundled with the app is refused; uninstall the zip-installed plugin first. The reverse is refused too: installing a zip whose plugin id is linked as a development folder fails before any replace prompt, with @scope/name is linked as a development folder; unlink it from the Plugins screen, then install the zip. Unlink the plugin, then install the zip. Nothing is unlinked for you, so your development setup never changes behind your back.
Keep dev running in a visible terminal next to the app. If the UI stops updating after a save, check the plugin row before checking the code.
5. Pack the plugin¶
After a successful build, run:
Or specify a directory:
The command requires dist/ and writes <scope>-<name>-<version>.zip in the plugin directory. For example, @acme/foo version 1.2.3 becomes:
The archive contains:
package.jsondist/**, without.js.mapfilesREADME.md, when present
It does not include src/, node_modules/, or anything else. The manifest is validated first; invalid manifests fail with the validator's message. The files the manifest names (plugin.main, and plugin.renderer if declared) must exist in dist/. The zip is written to a temporary file and renamed into place on success, so a failed pack leaves no partial archive behind.
pack does not build. Run pnpm exec lore-plugin build and then pack. Build again before you pack if you used dev, so the zip doesn't carry the unminified dist/ that dev leaves behind.
6. Install the plugin in Lore Desktop¶
- Open Lore Desktop.
- Click the settings cog.
- Select Plugins.
- Select Add plugin, then click browse.
- Choose the plugin zip.
You can also drag one or more zip files onto the Add plugin dialog. Files install one at a time, with progress shown for each file. A failed file stays listed with its error until you remove it. Lore Desktop asks you to confirm each dragged file in a system dialog that names the plugin, its version and the zip.
The plugin appears at the top of the list and is selected.
The zip must contain package.json at its root. Archives with the manifest inside a folder, such as macOS Compress output, are rejected. The host also checks engines.lore against the app version.
Reinstalling the same plugin id asks for confirmation in a system dialog that shows the installed and incoming versions. A dragged zip that replaces an installed plugin asks once.
Only zip-installed plugins can be replaced this way. A zip whose id matches a linked development plugin is refused (see section 4b). A zip whose id matches a plugin bundled with the app is refused because bundled plugins cannot be replaced; give your plugin a different id.
7. Apply and manage the plugin¶
The plugin's main-process side and UI are live immediately after install, replacement, enabling, or a development reload. The Restart to apply tag appears only in edge cases: the renderer bundle failed to load, or the import timed out. It clears on the next successful load. Disabling a plugin removes its UI immediately; enabling it brings the UI back.
Use the row menu or detail pane to disable, enable, or uninstall a plugin. Uninstalling asks for confirmation and removes the plugin's folder. Browse plugin in the row menu or detail pane opens the plugin's folder in Finder or Explorer for installed, bundled, and linked plugins. For the user-facing steps, see Manage plugins.
Installed plugins live under:
On macOS, {appData} is ~/Library/Application Support, so the full path is:
Do not copy files there by hand. Install plugins through the Plugins screen.
Troubleshooting¶
packages/plugin-sdk/src is newer than its build: runpnpm build:sdk.[Plugin failed]in the app after a successful build: usually a bad import name in the renderer bundle, such as an EDS icon that does not exist.- I saved a file and nothing happened in the app:
devis not running; the app watchesdist/, notsrc/. The rebuild may also have failed. Look at the terminal. - The UI did not change after a save but
devprintedrebuilt: the new bundle threw while loading and the previous UI was kept. Open Plugins and read the error on the plugin row. lore-plugin: command not found: the CLI is not a command on your PATH. Runpnpm exec lore-plugin <command>inside a workspace plugin folder, ornode packages/plugin-sdk/bin/lore-plugin.mjs <command> <dir>from the repository root. Runpnpm installfirst if the plugin is new.- Linking a plugin folder is refused:
Build the plugin first (missing dist/main.js)means the folder has not been built; runpnpm exec lore-plugin buildand link again. Otherwise the folder has nopackage.jsonwith a validpluginmanifest,engines.loredoes not match the app, or the folder is inside the app or the installed-plugins directory. - Installing a zip says the plugin is linked as a development folder: the same id is linked from the Plugins screen. Unlink it from the row menu or detail pane, then install the zip.
- You run Lore Desktop from a checkout (
pnpm dev) and the linked plugin's UI fails to import: the folder must be under one of the roots inLORE_PLUGIN_DEV_ROOTS. See Getting started. The packaged app has no such restriction.
Related¶
- Build and tsconfig for the build in detail
- Getting started and the rest of the plugin authoring pages