Repository navigation
fix(cli): resolve Node 22 TS entrypoint incompatibility #1325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -170,3 +170,4 @@ docs/superpowers/ | |
| # GitNexus local index | ||
| .gitnexus | ||
| .worktrees | ||
| bin/omniroute.mjs | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -372,6 +372,24 @@ if (existsSync(mcpSrcFile)) { | |
| } | ||
| } | ||
|
|
||
| // ── Step 8.7: Bundle CLI Entrypoint ────────────────────────── | ||
| const cliSrcFile = join(ROOT, "bin", "omniroute.ts"); | ||
| const cliDestFile = join(ROOT, "bin", "omniroute.mjs"); | ||
|
|
||
| if (existsSync(cliSrcFile)) { | ||
| console.log(" 🔨 Bundling CLI Entrypoint (TypeScript → JavaScript)..."); | ||
| try { | ||
| execSync( | ||
| `npx esbuild bin/omniroute.ts --bundle --platform=node --packages=external --format=esm --outfile=bin/omniroute.mjs`, | ||
| { cwd: ROOT, stdio: "inherit" } | ||
| ); | ||
| execSync(`chmod +x bin/omniroute.mjs`, { cwd: ROOT }); | ||
| console.log(" ✅ CLI Entrypoint bundled to bin/omniroute.mjs"); | ||
| } catch (err: any) { | ||
| console.warn(" ⚠️ CLI bundle error:", err.message); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If Useful? React with 👍 / 👎. |
||
| } | ||
|
Comment on lines
+381
to
+390
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bundling of the CLI entrypoint is a critical build step for the package to function correctly. There are several issues with the current implementation:
Additionally, it is highly recommended to add try {
execSync(
`npx esbuild bin/omniroute.ts --bundle --platform=node --packages=external --format=esm --outfile=bin/omniroute.mjs`,
{ cwd: ROOT, stdio: "inherit" }
);
if (process.platform !== "win32") {
execSync(`chmod +x bin/omniroute.mjs`, { cwd: ROOT });
}
console.log(" ✅ CLI Entrypoint bundled to bin/omniroute.mjs");
} catch (err: any) {
console.error(" ❌ CLI bundle error:", err.message);
process.exit(1);
} |
||
| } | ||
|
|
||
| // ── Step 9: Copy shared utilities needed at runtime ──────── | ||
| const sharedApiKey = join(ROOT, "src", "shared", "utils", "apiKey.js"); | ||
| const sharedApiKeyDest = join(APP_DIR, "src", "shared", "utils"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This build step now writes
bin/omniroute.mjs, but the pack policy still only allows/requiresbin/omniroute.tsinscripts/pack-artifact-policy.ts(PACK_ARTIFACT_ROOT_ALLOWED_EXACT_PATHSandPACK_ARTIFACT_REQUIRED_PATHS). BecauseprepublishOnlyrunsbuild:clibeforecheck:pack-artifact, the generated.mjsis treated as an unexpected artifact and the publish gate fails even when bundling succeeds.Useful? React with 👍 / 👎.