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

+17 -1
View File
@@ -47,7 +47,23 @@ fn main() {
registry,
npm_name,
} => {
let result = if kind == "plugin" {
let stray: Vec<&str> = [
("--package", package.is_some()),
("--folder", folder.is_some()),
("--scope", scope.is_some()),
("--registry", registry.is_some()),
("--npm-name", npm_name.is_some()),
]
.into_iter()
.filter(|(_, on)| *on)
.map(|(flag, _)| flag)
.collect();
let result = if kind != "plugin" && !stray.is_empty() {
Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!("{} only apply to create plugin", stray.join(", ")),
))
} else if kind == "plugin" {
cmd_plugin::run(cmd_plugin::Opts {
name,
package,