Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Comment on lines +118 to +122
Copy link

Copilot AI Jan 7, 2026

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.

Copilot uses AI. Check for mistakes.
const foundEnvs: EnvPolicy[] = [];
for (const component of componentsManifestsMap.values()) {
foundEnvs.push(component.envPolicy);
Expand Down Expand Up @@ -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
Copy link

Copilot AI Jan 7, 2026

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 adding env's tooling dependencies to components lacks test coverage. This is a significant behavioral change that should be tested to ensure components don't receive unwanted tooling dependencies in external PM mode while still getting them in internal mode.

Copilot uses AI. Check for mistakes.
const envPolicy = await this.dependencyResolver.getComponentEnvPolicy(component);
const selfPolicyWithoutLocal = envPolicy.selfPolicy.filter(
(dep) => !packageNamesFromWorkspace.includes(dep.dependencyId)
Expand Down
6 changes: 5 additions & 1 deletion scopes/workspace/install/install.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

The new external package manager logic lacks test coverage. The changes introduce critical conditional behavior that skips adding generator envs to workspace policy when external package manager mode is enabled. This should be covered by tests to ensure it works correctly and doesn't regress in the future.

Copilot uses AI. Check for mistakes.
const componentsAndManifests = await this._getComponentsManifests(installer, mergedRootPolicy, {
dedupe: true,
});
Expand Down
7 changes: 7 additions & 0 deletions scopes/workspace/workspace/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2508,7 +2508,14 @@ the following envs are used in this workspace: ${uniq(availableEnvs).join(', ')}
? Object.entries(dependencies).map(([name, currentRange]) => ({ name, currentRange }))
: await this.getAllDedupedDirectDependencies();
pkgJson.packageJsonObject.dependencies ??= {};
const existingDeps = pkgJson.packageJsonObject.dependencies;
const existingDevDeps = pkgJson.packageJsonObject.devDependencies ?? {};
const existingPeerDeps = pkgJson.packageJsonObject.peerDependencies ?? {};
for (const dep of allDeps) {
// Skip if already exists - don't override user's existing dependency versions
if (existingDeps[dep.name] || existingDevDeps[dep.name] || existingPeerDeps[dep.name]) {
continue;
}
pkgJson.packageJsonObject.dependencies[dep.name] = dep.currentRange;
}
await pkgJson.write();
Expand Down