Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(manager/npm): improve handling of grouped updates #31326

Merged
merged 3 commits into from
Sep 13, 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
5 changes: 4 additions & 1 deletion lib/modules/manager/npm/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import upath from 'upath';
import { logger } from '../../../logger';
import { exec } from '../../../util/exec';
import type { ExecOptions } from '../../../util/exec/types';
import { readLocalFile } from '../../../util/fs';
import { readLocalFile, writeLocalFile } from '../../../util/fs';
import { regEx } from '../../../util/regex';
import type { UpdateArtifact, UpdateArtifactsResult } from '../types';
import { getNodeToolConstraint } from './post-update/node-version';
Expand Down Expand Up @@ -37,6 +37,9 @@ export async function updateArtifacts({
return null;
}

// write old updates before executing corepack update so that they are not removed from package file
await writeLocalFile(packageFileName, existingPackageFileContent);

// Asumming that corepack only needs to modify the package.json file in the root folder
// As it should not be regular practice to have different package managers in different workspaces
const pkgFileDir = upath.dirname(packageFileName);
Expand Down