FN-5916: fix CLI bin targets for pnpm install

Use a committed launcher for published CLI bin links to avoid fresh-install warnings.

- point the published fn and fusion bin entries at a committed bin.mjs launcher
- add a launcher that checks for dist/bin.js and forwards execution to the built CLI
- cover bin target invariants across workspace packages and update CLI package config tests
- add a patch changeset for the published @runfusion/fusion package

Files changed:
 .changeset/fn-5916-cli-bin-launcher.md            |  5 ++
 packages/cli/bin.mjs                              | 20 ++++++
 packages/cli/package.json                         |  5 +-
 packages/cli/src/__tests__/bin-targets.test.ts    | 85 +++++++++++++++++++++++
 packages/cli/src/__tests__/package-config.test.ts |  8 ++-
 5 files changed, 118 insertions(+), 5 deletions(-)

Fusion-Task-Id: FN-5916

Fusion-Task-Lineage: 59d40654-ff77-4655-b9ce-3f3421521b2c
This commit is contained in:
gsxdsm
2026-06-02 21:54:07 -07:00
parent a8f91e9cc8
commit e33dadd77a
5 changed files with 118 additions and 5 deletions

20
packages/cli/bin.mjs Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env node
import { constants } from "node:fs";
import { access } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
const packageDir = dirname(fileURLToPath(import.meta.url));
const distEntry = resolve(packageDir, "dist", "bin.js");
try {
await access(distEntry, constants.F_OK);
} catch {
globalThis.console.error(
`Fusion CLI build output is missing at ${distEntry}. Run \`pnpm build\` before invoking this source checkout.`,
);
globalThis.process.exit(1);
}
await import(pathToFileURL(distEntry).href);