Skip to content
Merged
5 changes: 5 additions & 0 deletions .changeset/migrate-board-cli-directory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ankhorage/board": patch
---

Move the standalone CLI entrypoint into `src/cli/` and update the published binary path.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
```
Expand Down
1 change: 1 addition & 0 deletions knip.config.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"paradox"
],
"bin": {
"ankhorage-board": "./dist/cli.js"
"ankhorage-board": "./dist/cli/index.js"
},
"ankh": {
"category": "board",
Expand Down
6 changes: 3 additions & 3 deletions src/cli.ts → src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion src/readme-usage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runCli } from "./cli.js";
import { runCli } from "./cli/index.js";

/***
* Website-source boarding
Expand Down
18 changes: 12 additions & 6 deletions test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: {
Expand All @@ -213,15 +213,15 @@ 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,
ANKHORAGE_BOARD_TEST_WEB_FIXTURE_RESPONSE_URL: "https://example.com/",
};

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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
".": {
Expand Down
2 changes: 1 addition & 1 deletion test/testSupport.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Loading