mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-18 05:59:42 +02:00
42 lines
1.6 KiB
Markdown
42 lines
1.6 KiB
Markdown
# @n8n/module-cli
|
|
|
|
Interactive scaffolder for n8n modules.
|
|
|
|
```bash
|
|
pnpm n8n-module-sdk create # prompts for name and stack
|
|
pnpm n8n-module-sdk create my-feature --stack=frontend
|
|
```
|
|
|
|
`create` writes `packages/modules/<name>/<frontend|backend>`.
|
|
|
|
Then read [frontend-module-guide.md](./frontend-module-guide.md). It gives the descriptor
|
|
contract, the import boundaries, the registration points and the problem in each one.
|
|
|
|
## Frontend
|
|
|
|
A real, resolvable workspace package: source-only (`main: "src/index.ts"`, no
|
|
`dist`), consumed by the editor-ui shell through Vite aliases. Scaffolding it
|
|
also makes the four registrations outside the package that a module needs
|
|
before the shell can see it — the `modulePackages` table in
|
|
`@n8n/frontend-vite-config`, editor-ui's dependency entry, editor-ui's tsconfig
|
|
`paths`, and `modules.manifest.ts`. Re-running after a partial failure adds no
|
|
second copy of any of them.
|
|
|
|
Biome runs over the new package and over every edited file at the end, because
|
|
a registration line can be longer than the 100-column limit. Without that step
|
|
the next `format:check` in CI fails on a module nobody touched by hand.
|
|
|
|
## Backend
|
|
|
|
Backend modules can run from a built workspace package at
|
|
`packages/modules/<name>/backend`. Register the package with a lazy import in
|
|
`packages/cli/src/modules/modules.manifest.ts`. The scaffolder does not create
|
|
this package shape yet. Use `@n8n/backend-module-insights` as the current
|
|
example.
|
|
|
|
## No build step
|
|
|
|
Plain ESM, run straight from `src/`. A `dist` would mean building the
|
|
scaffolder before you can scaffold with it, which breaks on day one of a new
|
|
machine.
|