Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/plugin-cli-kebab-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@emdash-cms/plugin-cli": patch
Comment thread
ascorbic marked this conversation as resolved.
---

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.
4 changes: 2 additions & 2 deletions packages/plugin-cli/src/build/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand All @@ -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) {
Expand Down
10 changes: 5 additions & 5 deletions packages/plugin-cli/src/bundle/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand All @@ -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.`);
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-cli/src/dev/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -93,7 +93,7 @@ export const devCommand = defineCommand({
try {
await buildPlugin({
dir: args.dir,
outDir: args.outDir,
outDir: args["out-dir"],
logger,
});
} catch (error) {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-cli/tests/bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Comment on lines +18 to 19
*/
describe("bundlePlugin", () => {
Expand Down
Loading