Skip to content

fix(cli): report failed installs, approve swc builds for pnpm 11 and default to Node.js + Vite - #629

Merged
Romakita merged 3 commits into
masterfrom
fix/cli-ts-morph-common-pnpm
Nov 1, 2026
Merged

Romakita merged 3 commits into
masterfrom
fix/cli-ts-morph-common-pnpm

Conversation

@Romakita

@Romakita Romakita commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What

  1. Unhandled rejection when a spawned command fails (cli-core): streamToObservable (used by CliExeca.run) called awaited.then(resolve) without a rejection handler. It's now awaited.then(resolve, reject).
  2. pnpm 11 build approval (cli-core): PNpmManager.init now approves @swc/core in pnpm-workspace.yaml. It writes allowBuilds for pnpm >= 11 and onlyBuiltDependencies for pnpm 10, keeps the file's existing settings, and does nothing for pnpm < 10.
  3. Default runtime (cli): tsed init now proposes Node.js + Vite by default instead of Node.js + SWC. This covers both the schema default and the checked choice of the interactive prompt.

Why

  1. When tsed init failed during pnpm install, Node crashed on the unhandled rejection while CliStats.$onFinish was still sending the failed init report. The stats API never received these failures. The API side was checked: the payload passes CliStatPayload validation and the cli_install_stats columns accept it.
  2. pnpm 11 fails the install with ERR_PNPM_IGNORED_BUILDS when a dependency has unapproved build scripts. @tsed/cli depends on @swc/core (tsed run uses @swc-node/register), so any pnpm 11 init failed while adding the dependencies, whatever the runtime.

Notes for reviewers

  • RuntimesModule.get() still falls back to node when a project has no runtime preference. I left it as-is so existing projects keep their behavior.
  • The pnpm version is read with pnpm --version in the project folder. If that fails, the CLI writes allowBuilds (the current pnpm format).

Tests

  • New streamToObservable.spec.ts: fails without fix 1 (unhandled rejection), passes with it.
  • PNpmManager.spec.ts: pnpm 11, pnpm 10, pnpm 9, unreadable version, and merging with an existing pnpm-workspace.yaml.
  • getFeaturesPrompt.spec.ts snapshot updated for the new default.
  • cli-core package managers: 36/36. cli init commands: 23/23.

🤖 Generated with Claude Code

When a command run through CliExeca (e.g. `pnpm install`) failed after its
stream ended, streamToObservable left a rejected promise without handler.
Node then crashed the process before CliStats could send the failed init
report to the stats API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T11:20:25.837939Z 61e431a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Romakita and others added 2 commits November 1, 2026 12:26
pnpm 11 fails the install with ERR_PNPM_IGNORED_BUILDS when a dependency
has unapproved build scripts. @tsed/cli depends on @swc/core, so every
`tsed init` using pnpm 11 failed while adding the dependencies.

PNpmManager.init now approves @swc/core in pnpm-workspace.yaml:
`allowBuilds` for pnpm >= 11, `onlyBuiltDependencies` for pnpm 10. The
existing settings of the file are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Romakita Romakita changed the title fix(cli-core): prevent unhandled rejection when a spawned command fails fix(cli): report failed installs, approve swc builds for pnpm 11 and default to Node.js + Vite Nov 1, 2026
@Romakita
Romakita merged commit 9f36756 into master Nov 1, 2026
15 checks passed
@Romakita

Romakita commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 7.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant