@livetiles/create-reach-plugin

0.4.2 • Public • Published

@livetiles/create-reach-plugin

Prerequisites

To develop your plugin, you need a Reach subscription. Preferably one where you're an owner (else you won't be able to publish your plugin).

If you don't have a subscription yet, you can create one for free.

Getting started

To create your custom plugin run the following command:

$ npx @livetiles/create-reach-plugin <plugin-directory-name>

Please note that the target directory must be empty. This will generate all files necessary to start developing your plugin.

To start the development server:

$ cd <plugin-directory-name>
$ npm run dev

This will open a new tab in your browser where a new navigation node "Custom plugin" will be inserted into the left-side navigation of Reach. A page refresh might be needed for the changes to be applied. This node shows the contents of the HelloWorld.tsx file in <plugin-directory-name>/src

You can checkout the parameters set within the definitions.json file. Some of the notable things you can change here are:

  • the location and type of the plugin
  • the component that is rendered for the plugin
  • the plugin route

If you make any changes to the HelloWorld.tsx file, these will be rendered in the browser but you will need to manually reload the page to see the changes.

The dev command ensures that any changes you make are only visible to you. Additional steps are needed to publish the changes.

Publishing your plugin

If you're happy with the state of your plugin you can stop the development server and proceed to publish the plugin.

You can publish the plugin in one of two ways:

  • run $ npm run publish-web

This will open a new tab where a notification toast allows you to review the plugin. If you have the appropriate permissions, you will also be able to publish it. Publishing the plugin will automatically write the changes to the dB, making the plugin available for all users within the subscription.

  • run $ npm run publish

This command requires an access token and will also write the changes to the dB and make the plugin accessible for all users.

You can see a list of all published plugins by navigating to /admin/plugins. Here you can edit and remove any published plugins. If you edit and save, the changes will be available to all users immediately.

Generating a notification Api Key for your plugin

You will need a special Api Key to send notifications. You can generate this key by running the following command:

  • run $ npm run generate-api-key

This command will open a dialog inside Reach where you will have to provide at least a Display name and optionally an expiry date. Make sure you save this token as you won't be able to get it back if you close the dialog.

Readme

Keywords

none

Package Sidebar

Install

npm i @livetiles/create-reach-plugin

Weekly Downloads

1

Version

0.4.2

License

ISC

Unpacked Size

15.3 kB

Total Files

18

Last publish

Collaborators

  • cycl