fix(plugin): the review's smaller findings
CI / installer (macos-14) (pull_request) Successful in 4s
CI / check (pull_request) Failing after 29s
CI / starter (bun) (pull_request) Successful in 32s
CI / starter (deno) (pull_request) Successful in 33s
CI / starter (edge) (pull_request) Successful in 37s
CI / core-freshness (pull_request) Has been skipped
CI / installer (ubuntu-latest) (pull_request) Successful in 11s
CI / starter (node) (pull_request) Successful in 34s

- `--package` takes a directory only as `--package=DIR`, so
  `create plugin --package algo` names the plugin instead of writing
  into ./algo.
- A NAME passed on the command line is checked before any question.
- The package directory is named in its errors, a file there is
  reported as a file, and a failed write lists what was already written.
- An in-app plugin folder is removed again if the entry cannot be
  written, so the rerun does not stop on "already exists".
- `--folder .` and `./plugins/` give clean import paths.
- Flags for the other mode are named as ignored; plugin flags on
  another create kind are an error.
- Array elements are read from the parse tree, so `algo({ a, b })` is
  one element when checking for a duplicate.
- Scopes follow JSR's rule: 2 to 20 characters, no leading hyphen.
- Packages ship a LICENSE (MIT, which the README says to change), the
  license field in both manifests, and @types/node for the test file.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-09-24 13:26:29 -05:00
1 parent 4358091d07
commit ecdc46cac3
8 files changed
+460 -86

No files matched your search

+7 -6
View File
@@ -119,18 +119,19 @@ An in-app plugin by default, or a package of its own.
```sh
matcha create plugin "Plugin Algo" # plugins/plugin-algo/, registered in createApp
matcha create plugin algo --folder lib/plugins
matcha create plugin algo --package ./algo --scope acme # a JSR package
matcha create plugin algo --package ./algo --scope acme --registry both # JSR + npm, ESM only
matcha create plugin algo --package=./algo --scope acme # a JSR package
matcha create plugin algo --package=./algo --scope acme --registry both # JSR + npm, ESM only
```
In-app, each plugin gets a folder of its own under `plugins/` (or `--folder`, relative to the
project root) and is registered in `createApp({ plugins })`. It lives in a folder so it can become
a package later without being pulled out of the app.
`--package [DIR]` writes a package into `DIR`, or into the current directory, and either one has to
be empty. JSR is the default, because it records which runtimes a package supports.
`--registry both` adds npm with a `tsc` build to ESM only, and suggests the
`@scope/green-tea-<name>` name without requiring it. The package passes `deno test`, `node --test`,
`--package` writes a package into the current directory, or `--package=DIR` into `DIR`, and either
one has to be empty. The `=` is required, so a word after a bare `--package` is the plugin's
name. JSR is the default, because it records which runtimes a package supports. `--registry both`
adds npm with a `tsc` build to ESM only, and suggests the `@scope/green-tea-<name>` name without
requiring it. The package passes `deno test`, `node --test`,
`bun test` and `deno publish --dry-run` as generated.
At a terminal it asks for whatever the flags leave out. Without a terminal (CI, a pipe) it takes the