Skip to content
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

fix: never install @teambit/legacy as a dependency #8694

Merged
merged 1 commit into from
Mar 25, 2024
Merged
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
15 changes: 15 additions & 0 deletions scopes/dependencies/pnpm/lynx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export async function install(
);
readPackage.push(readPackageHook as ReadPackageHook);
}
readPackage.push(removeLegacyFromDeps as ReadPackageHook);
if (!manifestsByPaths[rootDir].dependenciesMeta) {
manifestsByPaths = {
...manifestsByPaths,
Expand Down Expand Up @@ -378,6 +379,20 @@ function readPackageHookForCapsules(pkg: PackageManifest, workspaceDir?: string)
return readDependencyPackageHook(pkg);
}

/**
* @teambit/legacy should never be installed as a dependency.
* It is linked from bvm.
*/
function removeLegacyFromDeps(pkg: PackageManifest): PackageManifest {
if (pkg.dependencies?.['@teambit/legacy'] && !pkg.dependencies['@teambit/legacy'].startsWith('link:')) {
delete pkg.dependencies['@teambit/legacy'];
}
if (pkg.peerDependencies?.['@teambit/legacy']) {
delete pkg.peerDependencies['@teambit/legacy'];
}
return pkg;
}

/**
* This hook is used when installation happens in a Bit workspace.
* We need a different hook for this case because unlike in a capsule, in a workspace,
Expand Down