diff --git a/examples/plugins/hello-netcatty/README.md b/examples/plugins/hello-netcatty/README.md index 3f4f74d68..ab475d524 100644 --- a/examples/plugins/hello-netcatty/README.md +++ b/examples/plugins/hello-netcatty/README.md @@ -7,7 +7,7 @@ not load or execute it inside Netcatty; the isolated host runtime arrives in PR From the repository root: ```bash -npm run build --workspace @netcatty/example-hello-plugin -npm exec --workspace @netcatty/plugin-cli -- netcatty-plugin validate examples/plugins/hello-netcatty -npm exec --workspace @netcatty/plugin-cli -- netcatty-plugin compatibility examples/plugins/hello-netcatty --netcatty 0.0.0 +npm run build:plugin-packages +npm exec -- netcatty-plugin validate examples/plugins/hello-netcatty +npm exec -- netcatty-plugin compatibility examples/plugins/hello-netcatty --netcatty 0.0.0 ``` diff --git a/packages/plugin-cli/src/cli.test.ts b/packages/plugin-cli/src/cli.test.ts index 8da989600..9726eb402 100644 --- a/packages/plugin-cli/src/cli.test.ts +++ b/packages/plugin-cli/src/cli.test.ts @@ -34,6 +34,7 @@ import { assertSafePackagePath, PackagePathRegistry } from "./packagePath.ts"; const execFileAsync = promisify(execFile); const cliPath = fileURLToPath(new URL("./cli.ts", import.meta.url)); +const repositoryRoot = fileURLToPath(new URL("../../../", import.meta.url)); function crc32(contents: Buffer): number { let crc = 0xffffffff; @@ -388,6 +389,24 @@ test("compatibility CLI checks a validated plugin target", async (context) => { ); }); +test("example README commands use repository-root CLI paths", async () => { + const readme = await readFile( + path.join(repositoryRoot, "examples/plugins/hello-netcatty/README.md"), + "utf8", + ); + + assert.match(readme, /npm run build:plugin-packages/); + assert.match( + readme, + /npm exec -- netcatty-plugin validate examples\/plugins\/hello-netcatty/, + ); + assert.match( + readme, + /npm exec -- netcatty-plugin compatibility examples\/plugins\/hello-netcatty --netcatty 0\.0\.0/, + ); + assert.doesNotMatch(readme, /npm exec --workspace @netcatty\/plugin-cli/); +}); + test("init creates a valid TypeScript plugin skeleton", async (context) => { const root = await mkdtemp(path.join(tmpdir(), "netcatty-plugin-init-")); context.after(() => rm(root, { recursive: true, force: true }));