Skip to content

build: dependencies duplicated when deploying snapshots #25152

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

Merged
merged 1 commit into from
Jun 24, 2022
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
16 changes: 3 additions & 13 deletions scripts/docs-deploy/install-built-packages.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,13 @@ import {getPackageJsonOfProject} from './utils.mjs';
export async function installBuiltPackagesInRepo(repoPath: string, builtPackages: BuiltPackage[]) {
const {parsed: packageJson, path: packageJsonPath} = await getPackageJsonOfProject(repoPath);

// We will use Yarn resolutions to install the built packages.
if (packageJson.resolutions === undefined) {
packageJson.resolutions = {};
}

for (const builtPackage of builtPackages) {
const pkgName = builtPackage.name;
const destinationUrl = url.pathToFileURL(builtPackage.outputPath);

// Add resolutions for each package in the format "**/{PACKAGE}" so that all
// nested versions of that specific package will have the same version.
packageJson.resolutions[`**/${pkgName}`] = destinationUrl;

// Since the resolutions only control the version of all nested installs, we also need
// to explicitly set the version for the package listed in the project "package.json".
// e.g. the resolution above ensures transitive installs of `@angular/cdk` are updated,
// while the `dependencies` field overrides the workspace install of `@angular/cdk`.
// Override the dependencies to point to the local files instead of the version on npm.
// Note that we don't want to change the `resolutions` to point to the same files, because it
// can cause duplicated dependencies (see #24992).
packageJson.dependencies[pkgName] = destinationUrl;

// In case this dependency was previously a dev dependency, just remove it because we
Expand Down