Getting started with plugins
Create and load your first Nuclear plugin and verify the SDK works end-to-end.
Spin up a bare plugin, load it in Nuclear, and poke the Plugin SDK to make sure everything is wired.
Usage
Create a folder anywhere on your machine, e.g. ~/nuclear-plugins/hello-plugin.
Run npm init inside.
{
"name": "hello-plugin",
"version": "0.1.0",
"description": "Minimal Nuclear plugin",
"author": "Your Name",
"main": "index.ts",
"nuclear": {
"displayName": "Hello Plugin",
"categories": ["other"]
}
}const CATEGORY = "Examples";
module.exports = {
async onLoad(api) {
await api.Settings.register([
{
id: "hello",
title: "Hello world",
category: CATEGORY,
kind: "boolean",
default: true
}
]);
const v = await api.Settings.get("hello");
await api.Settings.set("hello", !v);
},
async onEnable(api) {
api.Settings.subscribe("hello", () => {});
}
};The app compiles TS on the fly. No additional setup is needed.
Load it in the app
Open Nuclear → Preference → Plugins (from the left sidebar).
Click Add Plugin and select your plugin folder.
Toggle it on.
onLoadruns at import time;onEnableruns when you enable.
Verify the SDK
Open Settings and find the "Examples" section. You should see "Hello world" with a toggle.
Flip it. The value persists to disk and updates subscribers.
Plugin shape
package.json keys used by the loader:
name,version,description,authormain(optional). If missing, the app triesindex.js,index.ts,index.tsx, thendist/index.*.nuclear.displayName(optional UI name)nuclear.categories(shown in the Plugins list)nuclear.iconandnuclear.permissions(optional; unknown permissions get a warning)
Last updated
