diff --git a/.changeset/plugin-cli-kebab-flags.md b/.changeset/plugin-cli-kebab-flags.md new file mode 100644 index 000000000..0db1e90b2 --- /dev/null +++ b/.changeset/plugin-cli-kebab-flags.md @@ -0,0 +1,10 @@ +--- +"@emdash-cms/plugin-cli": patch +--- + +Renames the multi-word flags on `build`, `dev`, and `bundle` from camelCase to kebab-case for consistency with `publish` and standard Unix CLI convention. + +- `--outDir` -> `--out-dir` +- `--validateOnly` -> `--validate-only` + +The short alias `-o` for `--out-dir` is unchanged. diff --git a/packages/plugin-cli/src/build/command.ts b/packages/plugin-cli/src/build/command.ts index 342f64677..c6b93be22 100644 --- a/packages/plugin-cli/src/build/command.ts +++ b/packages/plugin-cli/src/build/command.ts @@ -30,7 +30,7 @@ export const buildCommand = defineCommand({ description: "Plugin directory (default: current directory)", default: process.cwd(), }, - outDir: { + "out-dir": { type: "string", alias: "o", description: "Output directory (default: ./dist)", @@ -49,7 +49,7 @@ export const buildCommand = defineCommand({ try { result = await buildPlugin({ dir: args.dir, - outDir: args.outDir, + outDir: args["out-dir"], logger, }); } catch (error) { diff --git a/packages/plugin-cli/src/bundle/command.ts b/packages/plugin-cli/src/bundle/command.ts index 382e95177..d76c3920b 100644 --- a/packages/plugin-cli/src/bundle/command.ts +++ b/packages/plugin-cli/src/bundle/command.ts @@ -26,13 +26,13 @@ export const bundleCommand = defineCommand({ description: "Plugin directory (default: current directory)", default: process.cwd(), }, - outDir: { + "out-dir": { type: "string", alias: "o", description: "Output directory for the tarball (default: ./dist)", default: "dist", }, - validateOnly: { + "validate-only": { type: "boolean", description: "Run validation only, skip tarball creation", default: false, @@ -50,8 +50,8 @@ export const bundleCommand = defineCommand({ try { result = await bundlePlugin({ dir: args.dir, - outDir: args.outDir, - validateOnly: args.validateOnly, + outDir: args["out-dir"], + validateOnly: args["validate-only"], logger, }); } catch (error) { @@ -67,7 +67,7 @@ export const bundleCommand = defineCommand({ // hosts the artifact (GitHub release asset, R2, S3, their own server) // and the registry indexes the URL. Spell out the next step so users // don't have to dig for it. - if (!args.validateOnly && result.tarballPath) { + if (!args["validate-only"] && result.tarballPath) { console.log(); consola.info("Next steps:"); console.log(` 1. Upload ${pc.cyan(result.tarballPath)} to a public URL.`); diff --git a/packages/plugin-cli/src/dev/command.ts b/packages/plugin-cli/src/dev/command.ts index 4e1e002e5..6335abcae 100644 --- a/packages/plugin-cli/src/dev/command.ts +++ b/packages/plugin-cli/src/dev/command.ts @@ -58,7 +58,7 @@ export const devCommand = defineCommand({ description: "Plugin directory (default: current directory)", default: process.cwd(), }, - outDir: { + "out-dir": { type: "string", alias: "o", description: "Output directory (default: ./dist)", @@ -93,7 +93,7 @@ export const devCommand = defineCommand({ try { await buildPlugin({ dir: args.dir, - outDir: args.outDir, + outDir: args["out-dir"], logger, }); } catch (error) { @@ -146,10 +146,10 @@ export const devCommand = defineCommand({ await runBuild("initial build"); // Resolve outDir relative to the plugin dir so the ignore - // pattern matches whatever the user passed for `--outDir`. + // pattern matches whatever the user passed for `--out-dir`. // chokidar wants forward-slash globs even on Windows, so // normalise the platform separator (path.sep) to "/". - const resolvedOutDir = resolve(args.dir, args.outDir); + const resolvedOutDir = resolve(args.dir, args["out-dir"]); const cwdAbs = resolve(args.dir); const outDirRel = relative(cwdAbs, resolvedOutDir); // `outDirGlob` is the ignore pattern only when outDir is diff --git a/packages/plugin-cli/tests/bundle.test.ts b/packages/plugin-cli/tests/bundle.test.ts index 632e8c8c1..ca11f255b 100644 --- a/packages/plugin-cli/tests/bundle.test.ts +++ b/packages/plugin-cli/tests/bundle.test.ts @@ -15,7 +15,7 @@ const BAD_FIXTURE = fileURLToPath(new URL("./fixtures/bad-plugin", import.meta.u * directory, assert the resulting tarball + manifest match expectations. * * Each test runs the bundler at a different `outDir` under a fresh tempdir so - * concurrent runs don't collide, and so `--outDir` resolution works as + * concurrent runs don't collide, and so `--out-dir` resolution works as * advertised (it can be either absolute or relative to `dir`). */ describe("bundlePlugin", () => {