The CLI
There are two tools, both on npm. Both need Node 20.12 or later.
create-flare-pluginscaffolds a new plugin. Run it withnpm create flare-plugin@latest.flare-plugin, from@flare/plugin-cli, runs, builds, checks, packs and publishes a plugin. New plugins depend on it and have a script for each command.
create-flare-plugin
npm create flare-plugin@latest [folder] [options]pnpm create flare-plugin [folder] [options]bun create flare-plugin [folder] [options]Without options, it asks questions. It writes the plugin into folder, which must be new or empty. If you leave folder out, it's named after the title. It then runs Flare's manifest checks on what it wrote, so the result always installs.
| Option | What it does |
|---|---|
--title <title> | The plugin's name, as people see it. |
--id <id> | Its id, such as flare.stripe-lookup. Defaults to one built from the author and title. |
--author <name> | The author. |
--starters <list> | What to start with, comma separated. See starters. |
--dir <folder> | Where to write it. |
--yes, -y | Use the defaults for anything not given, and ask nothing. |
--help, -h | Lists the options. |
With npm, put -- before the options so npm passes them through:
npm create flare-plugin@latest -- --title "Orders" --id flare.orders --author Flare \
--starters widget,cell,row-action,command,result-view --dir orders --yesStarters
| Starter | What it writes |
|---|---|
widget | A dashboard widget that counts a table, with a container setting. |
cell | A cell formatter that shows https addresses in fields ending in _url as links. |
row-action | A bulk row action that copies rows as JSON, with the clipboard permission. |
command | A command that asks for a name and opens a view that greets it. |
result-view | A result view that charts the first numeric column of a query's results. |
theme | A dark and a light colour theme. Colours only, no code. |
The defaults are widget, cell and command. A themes only plugin gets no source, no build and no dependencies to type check.
flare-plugin
flare-plugin <command> [options]| Command | What it does |
|---|---|
dev | Serves the plugin to Flare, with hot reload and logs in the terminal. |
build | Checks the manifest, then bundles dist/plugin.js and dist/plugin.css. |
validate | Checks the manifest in package.json against src/index.ts. |
pack | Builds, then writes <name>-<version>.tgz to install in Flare or share. |
publish | Builds, packs and sends the plugin to the store. See below. |
login | Keeps a publishing token for publish. |
logout | Removes the kept token. |
whoami | Shows which Flare account you publish as. |
| Option | For | What it does |
|---|---|---|
--dir <path> | all | The plugin's folder. Defaults to the current one. |
--port <port> | dev | The port to serve on. Defaults to 5199. |
--host <host> | dev | The address to listen on. Defaults to localhost. |
--token <token> | login | The token, instead of being asked for it. |
--help, -h | all | Lists the commands and options. |
flare-plugin dev
Starts a Vite dev server with Vue and Tailwind on port 5199. While Developer mode is on, Flare checks for it every two seconds. It serves:
/__flare/plugin.json, the plugin'spackage.json, reread on every request;/__flare/frame.html, the page both kinds of frame load, with Vite's hot reload client.
Changing a component updates it in place and keeps its state. Changing src/index.ts, or a file it imports that no component imports, reloads the logic frame so setup runs again. package.json is checked on every save. Console output and uncaught errors from every frame print with the time and the frame. See The dev loop.
If the port is taken, it stops and suggests the next one, --port 5200. Add that port in Flare, under Settings, Plugins, Developer.
flare-plugin build
Validates, then bundles in Vite's library mode:
dist/plugin.js, an ES module whose default export is the definition.dist/plugin.css, the plugin's<style>blocks and Tailwind classes, compiled with Flare's theme. Always written, even when empty.
vue, @flare/plugin and @flare/plugin/vue aren't bundled. Their imports become /__flare/vue.js, /__flare/sdk.js and /__flare/sdk-vue.js, Flare's shared runtime on the plugin's own origin. If you import something from @flare/plugin that the runtime doesn't provide, the build stops and names it. A themes only plugin has nothing to bundle.
flare-plugin validate
Runs Flare's manifest checks, prints each problem with its path, and exits with 1 if there are any. It also prints warnings, which don't fail the run:
- ids declared in
package.jsonbut missing from the objectsrc/index.tspasses todefinePlugin(read without running it); - ids in that object that aren't declared;
- theme colours below WCAG contrast.
flare-plugin pack
Builds, then writes <name>-<version>.tgz in the plugin's folder, in npm pack format with every file under package/. The archive holds package.json, dist/, the README, a licence and changelog if present, and the icon the manifest names. @flare/stripe at 1.0.0 becomes flare-stripe-1.0.0.tgz. Install it in Flare from Settings, Plugins, Install plugin, From a file.
Publishing to the store
npx flare-plugin login
npx flare-plugin publishflare-plugin login
Asks for a publishing token, checks it with the store, and keeps it in your user's config folder (~/.config/flare/credentials.json on Linux, ~/Library/Application Support/flare on macOS, %APPDATA%\flare on Windows), readable only by you. Make a token in Flare under Settings, Plugins, Developer. --token passes it without the prompt.
flare-plugin whoami
Prints the account the token publishes as, and whether it's a verified Flare account.
flare-plugin publish
Validates, lists the scopes and whether a person will review them, builds, packs and uploads. Then it prints every check the store ran and where the version stands: live, in review or failed. It exits with 1 when the version failed.
flare-plugin logout
Removes the kept token. The token still works until you revoke it in Flare.
| Variable | What it does |
|---|---|
FLARE_TOKEN | A publishing token, used before the kept one. For CI. |
FLARE_API_URL | The store's API. Defaults to https://api.flare.tools. |
Publishing covers the checks, review and updates.