Skip to content

Fix pnpm installs in cf init Worker projects - #136

Merged
penalosa merged 2 commits into
mainfrom
investigate/issue-92
Oct 2, 2026
Merged

penalosa merged 2 commits into
mainfrom
investigate/issue-92

Conversation

@penalosa

Copy link
Copy Markdown
Collaborator

Summary

  • Generate pnpm-workspace.yaml for new Worker projects when pnpm is selected, approving the esbuild and workerd build scripts before installation.
  • Keep the approvals in projects created with --no-install so a later pnpm install works.
  • Cover the generated file and its timing in the cf init tests, and add a patch changeset.

This applies the build approval policy from cloudflare/workers-sdk#14193 to the cf init scaffold.

Validation

  • pnpm test src/__tests__/commands/init.test.ts (27 passed)
  • pnpm --filter cf check:type
  • pnpm check:lint
  • pnpm exec oxfmt --check on changed files

Closes #92

@penalosa
penalosa marked this pull request as draft September 30, 2026 19:02
@pkg-pr-new

pkg-pr-new Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@136

commit: e3a9d5f

@ask-bonk

ask-bonk Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 329.4 ms 4.3 ms 323.7 ms 342.1 ms
base 331.7 ms 8.1 ms 324.8 ms 359.0 ms

Δ (PR vs base): ↓ -2.3 ms (-0.7%)

Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.

@penalosa
penalosa marked this pull request as ready for review October 2, 2026 12:22
Comment thread packages/cli/src/__tests__/commands/init.test.ts Outdated

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: I'd update the helper to make the tests cleaner when we don't care about the pm in use.

Also, when running cf init in an existing directory, I think we delegate to auto-config. Does this already handle adding in this workspace directory?

@penalosa
penalosa force-pushed the investigate/issue-92 branch from a74441d to e3a9d5f Compare October 2, 2026 18:35
@penalosa
penalosa enabled auto-merge October 2, 2026 18:35
@ask-bonk

ask-bonk Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@penalosa
penalosa added this pull request to the merge queue Oct 2, 2026
Merged via the queue into main with commit f1ac89b Oct 2, 2026
10 checks passed
@penalosa
penalosa deleted the investigate/issue-92 branch October 2, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cf init with pnpm fails due to unapproved build scripts

2 participants