Skip to content

fix(init): give pnpm/action-setup a version in the deploy workflow - #1068

Open
morinokami wants to merge 1 commit into
voidzero-dev:mainfrom
morinokami:fix/init-workflow-pnpm-version
Open

morinokami wants to merge 1 commit into
voidzero-dev:mainfrom
morinokami:fix/init-workflow-pnpm-version

Conversation

@morinokami

Copy link
Copy Markdown
Collaborator

The workflow that void init --github writes for a pnpm project sets up pnpm with a bare - uses: pnpm/action-setup@v5. The action takes the version from its version input or from packageManager in package.json, and stops with "No pnpm version is specified" when it has neither. A new Vite+ project from void init has neither: 328c186 (#406) removed the packageManager pin that #93 had added for this workflow, and left the workflow as it was. Its deploy workflow therefore stops at the second step.

Fix

The step is now pnpm/action-setup@v6, and it gets a version when package.json declares no pnpm version:

- uses: pnpm/action-setup@v6
  with:
    version: 12
  • The value is the major of the pnpm that installed the project, which pnpm records in node_modules/.modules.yaml, or latest before an install. The major matters: pnpm 11 and later refuse a locked package published within the last day, and pnpm 10 locks such packages. A lockfile that pnpm 10.28.0 wrote for a new starter failed pnpm install --frozen-lockfile under 11.29.0 and 12.26.0 with ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION, for the 2 of its 464 packages that were under a day old.
  • No version when package.json has packageManager: "pnpm@…", or a devEngines.packageManager with a version. The action reads both, and rejects a version input that differs from packageManager.
  • v6, because pnpm 12 support arrived in v6.1.0.
  • The wizard writes the workflow before its install, so it sets the version after the install, and only in a workflow that it has just created.

package.json still gets no pnpm version, so #406 stays fixed. The deployment guide says where the version comes from and when to change it, and the pull request preview example in the Cloudflare guide uses v6.

Tests

packages/void/test/unit/init.test.ts has 9 new cases: the version from both formats of .modules.yaml and without one, no version for each declaration in package.json, the array form of devEngines.packageManager (which the action does not read), the wizard's update after its install, and an existing workflow that stays as it is. 8 fail with main's init.ts; the last one fails without the check that the wizard created the workflow.

Verification

  • vpr test:all: builds the packages and playgrounds, runs vp check and check:types, and runs the platform, unit and integration groups; 271/271 tasks pass.
  • By hand, in a new static React starter (Vite+), void init --github from this branch writes version: latest before an install, version: 12 after an install with pnpm 12.26.0, version: 10 after one with pnpm 10.28.0, and no version once packageManager is set.
  • Not run: GitHub Actions. That the old step stops and the new one installs pnpm rests on the source and README of pnpm/action-setup (v5 at fc06bc1, v6.1.1).

🤖 Generated with Claude Code

The workflow that `void init --github` writes for a pnpm project ran
`pnpm/action-setup@v5` without a version. The action stops there when
package.json declares none, and init writes none for a new Vite+
project, so the workflow failed before it installed anything.

The step now uses `pnpm/action-setup@v6` and sets `version` when
package.json declares no pnpm version: the major of the pnpm that
installed the project, read from node_modules/.modules.yaml, or `latest`
before an install. pnpm 11 and later refuse a locked package published
within the last day, which pnpm 10 locks, so the major has to match the
pnpm that wrote the lockfile. A project that declares a version keeps
the bare step, because the action rejects a `version` input that differs
from `packageManager`.

The wizard writes the workflow before its install, so it sets the
version after the install, and only in a workflow that it has just
created.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant