thymer docs
Documentation/Plugins/Developing with the SDK

Developing with the SDK

For anything beyond a few lines, use the Plugin SDK: you write in your own editor with type checking, and every save is pushed into a running Thymer.

The loop

  1. Clone the SDK and run npm install. plugin.js and plugin.json are your plugin; types.d.ts documents the API. The starter plugin.js is an app plugin; for a collection plugin, use the CollectionPlugin example in its comments.
  2. Start Chrome with a debugging port and a separate profile, and open your account in it:
chrome --remote-debugging-port=9222 --user-data-dir=/tmp/thymer-dev --no-first-run https://myaccount.thymer.com

On macOS, Chrome is at /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome. Edge works too.

  1. In that browser, open the Plugins panel from the Command Palette and open your plugin’s code editor. To start with a test plugin, choose Add plugin → Create a Plugin. Select the Developer Tools tab, and click Enable Plugin Hot Reload.
  2. Run npm run dev. The SDK bundles your code and pushes it to the browser on every save. npm run dev:verbose prints the bundle as well.

Hot reload is a preview: the changes are temporary until you save them in Thymer. When you are done, npm run build writes dist/plugin.js, without the source maps the dev loop adds. Paste it into Custom Code and plugin.json into Configuration, then Preview and save.

Share a plugin

To let others install your plugin from its link, publish it in a public GitHub repository with a thymer-plugin.json next to its files. This file describes the package; plugin.json stays the plugin’s configuration.

{
  "id": "yourname.task-timer",
  "name": "Task Timer",
  "author": "Your name",
  "version": "1.0.0",
  "type": "global",
  "description": "Track time on tasks",
  "files": {
    "config": "plugin.json",
    "js": "dist/plugin.js"
  }
}
  • id, name, author, version, type and files.config are required. description, homepage, screenshot, files.js and files.css are optional.
  • type is global for an app plugin or collection for a collection plugin.
  • id stays the same for the life of the plugin. Start it with your name, and use lowercase letters, numbers, dots, hyphens and underscores.
  • version is three numbers, such as 1.2.0, without prerelease or build suffixes. It is your release number, not the configuration’s ver.
  • files.js points to code that runs as it is. Thymer doesn’t build anything, so publish dist/plugin.js from npm run build, even if your repository ignores dist/. Code without import lines, with a Plugin class extending AppPlugin or CollectionPlugin, works as it is.
  • JavaScript is optional: a collection can define its fields and views with configuration alone. Leave out files.css if your JavaScript already injects the CSS.
  • files.config holds defaults only: no personal settings or API keys. custom is an object, such as {}, and fields and views have unique ids.
  • Use paths relative to thymer-plugin.json or full HTTPS URLs in the manifest. Images and other files that your CSS or code loads need full HTTPS links or embedded data.

With thymer-plugin.json at the top of the repository, people can paste the repository link into Install from URL. For a manifest in a subfolder, share the GitHub folder link, the manifest file’s GitHub link, or its Raw link. Any HTTPS host works too if it allows cross-origin requests. The manifest can be up to 256 KiB. JavaScript, CSS and configuration can be up to 5 MiB combined, with a 1 MiB limit each for CSS and configuration.

Installing creates a new global plugin or collection; it doesn’t change an existing collection.

A repository without a manifest can be installed too, if plugin.json and a ready-to-run plugin.js sit at its top, with an optional plugin.css. Those installs get no updates until you publish a thymer-plugin.json. Once you do, they move to it the next time their admins click Check for updates.

New versions

  1. Publish the new files first, or together with the manifest.
  2. Raise version in thymer-plugin.json, also for a change to the CSS or the configuration only.
  3. Keep the manifest’s link, the id and the type the same, and keep field and view ids stable, so people’s settings carry over.

Installed copies see the new version when their admins click Check for updates. Updates are never installed on their own, and Thymer warns before it replaces code that was edited locally. A link to a fixed commit or tag stays on that release.

Thymer checks the link the plugin was installed from, so keep it working. If it stops, installed plugins keep running, but update checks fail.

Get listed in the plugin directory

To have your plugin listed in the Thymer plugin directory, email the link to your thymer-plugin.json to [email protected].

Bundling assets

The SDK bundles small assets that you import:

  • import css from './styles.css?ver=202612011632'; gives the CSS as text, for this.ui.injectCSS(css).
  • import icon from './icon.png'; gives a PNG, SVG or JPG as a data URL, such as background: url(${icon}).

Keep the bundle small: plugin code is stored in your workspace, and hot reload has a limit of a few MB. Host large images, fonts and libraries elsewhere and load them over full HTTPS links.

Examples

The SDK’s examples/ folder has app plugins and collection plugins to start from: a simple list view, buttons on kanban cards, a work-in-progress limit, kanban dependencies, custom choice dropdowns, an organization chart. Most examples come with a thymer-plugin.json: paste that file’s link on GitHub into Install from URL. The SDK repository link alone won’t work, because it holds many plugins. The examples guide in the folder lists them, with what to try after installing. To build on one, copy it into the SDK project, change the field and view ids to yours, and try it on a few real pages.

When something is off

  • Nothing happens: check that the plugin is enabled, then look for errors in the editor and in the browser console.
  • Pasted code fails: in-app code uses class Plugin, without import or export. Those work only in the SDK project; bundle SDK code first.
  • A field or view is missing: it needs both a configuration entry, with "type": "custom" for views, and a matching registration in the code.
  • Hot reload stops: check that npm run dev is running, the browser was started with the debugging port, and hot reload is enabled on this plugin.
  • Thymer gets slow: look for timers and listeners that survive onUnload(), scans of the whole workspace, and views that rebuild the DOM on every refresh.

Disable the plugin while you investigate. If you need help, send a small plugin that reproduces the problem along with your description; see Reporting a bug. For other questions about plugins, email [email protected].