You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailchat/website/docs/plugins/guide/init-env.md

1.4 KiB

sidebar_position title
1 Init Plugin Develop Env

Before developing a plugin, we need to create a plugin development environment. This environment can be the environment where the official source code of Tailchat is directly reused (https://github.com/msgbyte/tailchat/tree/master/client/web/plugins), It can also be an independent project

Here we mainly teach you how to create an independent plugin development environment

frontend plugin development environment

It is very simple to create a plugin. Before that, if we did not initialize the plugin environment, we need to initialize the development environment first

Let's just find a place to build a project folder:

mkdir tailchat-plugin-test && cd tailchat-plugin-test

Execute in the root directory:

npm init -y
npm install mini-star

Create the configuration file of the mini-star in the root directory which named .ministarrc.js, the content is as follows:

// .ministarrc.js
const path = require('path');

module.exports = {
  externalDeps: [
    'react',
    'react-router',
    'axios',
    'styled-components',
    'zustand',
    'zustand/middleware/immer',
  ],
};

Write a compilation script in package.json

{
  //...
  "scripts": {
    // ...
    "plugins:all": "ministar buildPlugin all",
    "plugins:watch": "ministar watchPlugin all",
    // ...
  }
  //...
}

backend plugin development environment

TODO