Create your own plugins
Ts.ED is a framework that allows you to create your own plugins to extend its functionality. This guide will help you understand how to create and publish your own plugins.
Create a plugin
To help you create your own plugins, we provide a template that you can use as a starting point:
Features
- Monorepo structure — All plugins are organized under the
packages/directory. - CI/CD ready — GitHub Actions are configured to build and publish packages automatically.
- Code quality tools — Includes pre-configured ESLint, Prettier, and Commitlint to ensure consistency across the codebase.
- Testing — Uses Vitest for unit testing.
- Scalable — Easily add and manage multiple packages in a single repository.
Getting Started
After having checked out the repository, you can start developing your plugins. Install project dependencies:
yarn installAdding a New Plugin
To create a new plugin in the monorepo:
Use the following command to create a new workspace:
bashyarn workspace create @tsed/my-pluginOr manually create a folder under
packages/:bashmkdir packages/my-plugin cd packages/my-plugin yarn init -yCopy files from the
packages/plugin-example/directory to your new plugin directory. The structure should look like this`:packages/ └── my-plugin/ ├── src/ │ └── index.ts ├── test/ │ └── integration.spec.ts (optional) ├── .gitignore ├── .npmignore ├── package.json ├── readme.md ├── tsconfig.esm.json └── vitest.config.mtsRun
yarn build:referencesto generate the paths intsconfig.*.jsonfiles.Build your plugin:
bashyarn build
Build
To build all packages in the monorepo and generate their respective dist/ folders, run:
yarn buildPublishing Workflow
Package publishing is automated via GitHub Actions.
- Each plugin has its own version defined in its
package.jsonbut monorepo tools update all package version with the same version number. - On each push to the
mainbranch:- The
build.ymlworkflow is triggered. - It uses semantic release to increment the version based on commit messages.
- All packages are automatically published to the NPM registry.
- The
You have to configure your GitHub secrets with the following variables:
- NPM_TOKEN: Your NPM token
Go to your GitHub repository settings, then to the "Secrets and variables" section, and add a new secret with the name NPM_TOKEN and the value of your NPM token.
Adding your plugin on the Ts.ED marketplace
Ts.ED marketplace scans regularly the NPM registry to find new plugins.
To appear on the Ts.ED marketplace, you have to publish your plugin on the NPM registry with one of the following name patterns:
tsed-plugin-*in the name of your scope and package (recommanded)tsed-*or@tsed*/in the name of your package,- or adding
Ts.EDin your description package.json field.
Thats it! Your plugin will be automatically listed on the Ts.ED marketplace.