-
Notifications
You must be signed in to change notification settings - Fork 946
fix(deps): prevent env tooling deps from polluting package.json in external PM mode #10146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,6 +115,11 @@ export class WorkspaceManifestFactory { | |
| } | ||
|
|
||
| private getEnvsSelfPeersPolicy(componentsManifestsMap: ComponentsManifestsMap) { | ||
| // When using external package manager, skip collecting env self peers. | ||
| // Users manage their own tooling dependencies. | ||
| if (this.dependencyResolver.config.externalPackageManager) { | ||
| return undefined; | ||
| } | ||
| const foundEnvs: EnvPolicy[] = []; | ||
| for (const component of componentsManifestsMap.values()) { | ||
| foundEnvs.push(component.envPolicy); | ||
|
|
@@ -243,6 +248,12 @@ export class WorkspaceManifestFactory { | |
| component: Component, | ||
| packageNamesFromWorkspace: string[] | ||
| ): Promise<Record<string, string>> { | ||
| // When using external package manager, don't add env's tooling dependencies to components. | ||
| // The user manages their own tooling (eslint, vitest, webpack, etc.) and we should only | ||
| // include the component's actual source code dependencies (detected from imports). | ||
| if (this.dependencyResolver.config.externalPackageManager) { | ||
| return {}; | ||
| } | ||
|
Comment on lines
+251
to
+256
|
||
| const envPolicy = await this.dependencyResolver.getComponentEnvPolicy(component); | ||
| const selfPolicyWithoutLocal = envPolicy.selfPolicy.filter( | ||
| (dep) => !packageNamesFromWorkspace.includes(dep.dependencyId) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,7 +229,11 @@ export class InstallMain { | |
| async writeDependenciesToPackageJson(): Promise<void> { | ||
| const installer = this.dependencyResolver.getInstaller({}); | ||
| const mergedRootPolicy = await this.addConfiguredAspectsToWorkspacePolicy(); | ||
| await this.addConfiguredGeneratorEnvsToWorkspacePolicy(mergedRootPolicy); | ||
| // When using external package manager, don't add the env package itself. | ||
| // Users don't need the env installed - they manage their own tooling. | ||
| if (!this.dependencyResolver.config.externalPackageManager) { | ||
| await this.addConfiguredGeneratorEnvsToWorkspacePolicy(mergedRootPolicy); | ||
| } | ||
|
Comment on lines
+232
to
+236
|
||
| const componentsAndManifests = await this._getComponentsManifests(installer, mergedRootPolicy, { | ||
| dedupe: true, | ||
| }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new conditional logic for external package manager mode that skips collecting env self peers lacks test coverage. This is a critical change that affects which dependencies get included in the workspace manifest, and should have tests to verify correct behavior in both external and internal package manager modes.