Context
Follow-up from PR #3097 review (comment).
The generated CI workflow at .github/workflows/ci.yml uses pnpm/action-setup@v4 without specifying a version:
- name: Set up pnpm
uses: pnpm/action-setup@v4
Per the action's README, version is only optional when package.json contains a packageManager field. Otherwise it is required, and the step fails immediately.
Failure path
GeneratorMessages.detect_package_manager can select pnpm from pnpm-lock.yaml alone (priority 3 in the detection pipeline), without a packageManager field being present. This happens in existing apps where Shakapacker is already configured and the seeding path is skipped.
In that scenario, the scaffolded CI run fails in the pnpm setup step before dependency install or tests run.
Possible fixes
- Emit
with: version: <N> in the template when the generator can't confirm packageManager is set in package.json
- Make the generator add a
packageManager field to package.json whenever pnpm is detected via lockfile only
- Add a comment in the generated workflow warning users that the pnpm step may need a
version: key
Any of these would close the gap. Needs a design call on the right trade-off between "scaffold Just Works" and minimising template noise.
Related
Context
Follow-up from PR #3097 review (comment).
The generated CI workflow at
.github/workflows/ci.ymlusespnpm/action-setup@v4without specifying aversion:Per the action's README,
versionis only optional whenpackage.jsoncontains apackageManagerfield. Otherwise it is required, and the step fails immediately.Failure path
GeneratorMessages.detect_package_managercan selectpnpmfrompnpm-lock.yamlalone (priority 3 in the detection pipeline), without apackageManagerfield being present. This happens in existing apps where Shakapacker is already configured and the seeding path is skipped.In that scenario, the scaffolded CI run fails in the pnpm setup step before dependency install or tests run.
Possible fixes
with: version: <N>in the template when the generator can't confirmpackageManageris set inpackage.jsonpackageManagerfield topackage.jsonwhenever pnpm is detected via lockfile onlyversion:keyAny of these would close the gap. Needs a design call on the right trade-off between "scaffold Just Works" and minimising template noise.
Related
react_on_rails/lib/generators/react_on_rails/templates/base/base/.github/workflows/ci.yml.ttreact_on_rails/lib/generators/react_on_rails/generator_messages/package_manager_detection.rb