Skip to content

Commit

Permalink
fix(manager/npm): improve handling of grouped updates (#31326)
Browse files Browse the repository at this point in the history
  • Loading branch information
RahulGautamSingh authored Sep 13, 2024
1 parent 16ea17a commit 88b0348
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 88b0348

Please # to comment.