feat: allow explicit package-manager selection and inject resolved PM into init pipeline#4005
Closed
youaresoyoung wants to merge 4 commits intoelectron:mainfrom
Closed
feat: allow explicit package-manager selection and inject resolved PM into init pipeline#4005youaresoyoung wants to merge 4 commits intoelectron:mainfrom
youaresoyoung wants to merge 4 commits intoelectron:mainfrom
Conversation
…nv/lockfile fallback
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summarize your changes:
ref
Summary
This PR improves support for alternative package managers (pnpm, Yarn Berry) during project initialization.
Previously,
npx create-electron-appresolved tonpmat init time (because lockfiles don’t exist yet and npx sets the npm user agent). As a result, templates depending on pnpm/yarn–specific setup were silently misconfigured.This change allows users to explicitly choose a package manager via CLI prompt or
--package-managerflag, and ensures that decision is consistently propagated through the init pipeline.Problem
pnpm install) did not re-run template logic (e.g..npmrc,pnpm.onlyBuiltDependencies).resolvePackageManager()relied on user-agent or existing lockfile. Neither works at init time.Solution
--package-managerflag (non-interactive / CI)resolvePackageManager()to accept and cache an explicit argument.Alternatives Considered
FORGE_PACKAGE_MANAGER): simple, but too implicit.Explicit selection + propagation was chosen for clarity and determinism.
Impact
Result / Outcome
npmrcfilepnpm.onlyBuiltDependenciesconfiguration.yarnrcfileThis allows users to run Electron Forge out-of-the-box with their chosen package manager, without requiring any manual configuration.
Document