diff --git a/.changeset/migrate-board-cli-directory.md b/.changeset/migrate-board-cli-directory.md new file mode 100644 index 0000000..9219302 --- /dev/null +++ b/.changeset/migrate-board-cli-directory.md @@ -0,0 +1,5 @@ +--- +"@ankhorage/board": patch +--- + +Move the standalone CLI entrypoint into `src/cli/` and update the published binary path. diff --git a/README.md b/README.md index 6a2e1d0..248c766 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ deferred. Source: `src/readme-usage.ts` ```ts -import { runCli } from "./cli.js"; +import { runCli } from "./cli/index.js"; await runCli(["--help"]); ``` diff --git a/knip.config.ts b/knip.config.ts index fe2b27b..0f466cb 100644 --- a/knip.config.ts +++ b/knip.config.ts @@ -1,6 +1,7 @@ import { createKnipConfig } from "@ankhorage/devtools/knip"; export default createKnipConfig({ + entry: ["src/index.ts", "src/ankh.provider.ts", "src/cli/index.ts"], ignoreFiles: [ "eslint.config.mjs", "paradox.config.ts", diff --git a/package.json b/package.json index 6b3af94..e971a81 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "paradox" ], "bin": { - "ankhorage-board": "./dist/cli.js" + "ankhorage-board": "./dist/cli/index.js" }, "ankh": { "category": "board", diff --git a/src/cli.ts b/src/cli/index.ts similarity index 94% rename from src/cli.ts rename to src/cli/index.ts index 3961510..f652958 100644 --- a/src/cli.ts +++ b/src/cli/index.ts @@ -1,11 +1,11 @@ #!/usr/bin/env bun -import packageJson from "../package.json"; -import { resolveBoardCommand, runBoardCommand } from "./commands.js"; +import packageJson from "../../package.json"; +import { resolveBoardCommand, runBoardCommand } from "../commands.js"; import { type BoardCommandServices, createDefaultBoardCommandServices, -} from "./commandServices.js"; +} from "../commandServices.js"; export interface BoardCliContext { readonly cwd: string; diff --git a/src/commands.ts b/src/commands.ts index c7f60fe..349f537 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -3,7 +3,7 @@ import type { AnkhCommandDescriptor, } from "@ankhorage/contracts/cli"; -import type { BoardCliContext, BoardCliRunResult } from "./cli.js"; +import type { BoardCliContext, BoardCliRunResult } from "./cli/index.js"; import { createDefaultBoardCommandServices } from "./commandServices.js"; import { renderWebBoardingPlan } from "./webInspection.js"; diff --git a/src/readme-usage.ts b/src/readme-usage.ts index b0679fe..3d7bdd7 100644 --- a/src/readme-usage.ts +++ b/src/readme-usage.ts @@ -1,4 +1,4 @@ -import { runCli } from "./cli.js"; +import { runCli } from "./cli/index.js"; /*** * Website-source boarding diff --git a/test/cli.test.ts b/test/cli.test.ts index 89d6a66..c4d280b 100644 --- a/test/cli.test.ts +++ b/test/cli.test.ts @@ -3,7 +3,7 @@ import { join } from "node:path"; import { describe, expect, it } from "bun:test"; import packageJson from "../package.json"; -import { runCli } from "../src/cli.js"; +import { runCli } from "../src/cli/index.js"; import { createBufferedContext, createStubBoardCommandServices, @@ -192,9 +192,9 @@ describe("package-scoped CLI commands", () => { const fixturePath = join(import.meta.dir, "fixtures", "example-com.html"); const cwd = import.meta.dir.replace(/\/test$/, ""); - it("covers `bun src/cli.ts web https://example.com`", () => { + it("covers `bun src/cli/index.ts web https://example.com`", () => { const result = Bun.spawnSync( - [process.execPath, "src/cli.ts", "web", "https://example.com"], + [process.execPath, "src/cli/index.ts", "web", "https://example.com"], { cwd, env: { @@ -213,7 +213,7 @@ describe("package-scoped CLI commands", () => { expect(stdout).toContain('"url": "https://example.com/"'); }); - it("covers `bun src/cli.ts web https://example.com --plan` and keeps output identical", () => { + it("covers `bun src/cli/index.ts web https://example.com --plan` and keeps output identical", () => { const env = { ...process.env, ANKHORAGE_BOARD_TEST_WEB_FIXTURE_PATH: fixturePath, @@ -221,7 +221,7 @@ describe("package-scoped CLI commands", () => { }; const withoutPlan = Bun.spawnSync( - [process.execPath, "src/cli.ts", "web", "https://example.com"], + [process.execPath, "src/cli/index.ts", "web", "https://example.com"], { cwd, env, @@ -230,7 +230,13 @@ describe("package-scoped CLI commands", () => { }, ); const withPlan = Bun.spawnSync( - [process.execPath, "src/cli.ts", "web", "https://example.com", "--plan"], + [ + process.execPath, + "src/cli/index.ts", + "web", + "https://example.com", + "--plan", + ], { cwd, env, diff --git a/test/package.test.ts b/test/package.test.ts index 29d28ea..901297d 100644 --- a/test/package.test.ts +++ b/test/package.test.ts @@ -8,7 +8,7 @@ describe("package metadata", () => { expect(packageJson.name).toBe("@ankhorage/board"); expect(packageJson.type).toBe("module"); expect(packageJson.bin).toEqual({ - "ankhorage-board": "./dist/cli.js", + "ankhorage-board": "./dist/cli/index.js", }); expect(packageJson.exports).toEqual({ ".": { diff --git a/test/testSupport.ts b/test/testSupport.ts index 5dd186a..e0618f2 100644 --- a/test/testSupport.ts +++ b/test/testSupport.ts @@ -1,4 +1,4 @@ -import type { BoardCliContext } from "../src/cli.js"; +import type { BoardCliContext } from "../src/cli/index.js"; import type { BoardCommandServices } from "../src/commandServices.js"; export interface BufferedContext extends BoardCliContext {