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(pnpm): Revert "feat(manager/npm): ignore scripts for pnpmDedupe" #25208

Merged
merged 1 commit into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2973,7 +2973,7 @@ Table with options:
| `gomodUpdateImportPaths` | Update source import paths on major module updates, using [mod](https://github.com/marwan-at-work/mod). |
| `helmUpdateSubChartArchives` | Update subchart archives in the `/charts` folder. |
| `npmDedupe` | Run `npm dedupe` after `package-lock.json` updates. |
| `pnpmDedupe` | Run `pnpm dedupe --ignore-scripts` after `pnpm-lock.yaml` updates. |
| `pnpmDedupe` | Run `pnpm dedupe` after `pnpm-lock.yaml` updates. |
| `yarnDedupeFewer` | Run `yarn-deduplicate --strategy fewer` after `yarn.lock` updates. |
| `yarnDedupeHighest` | Run `yarn-deduplicate --strategy highest` (`yarn dedupe --strategy highest` for Yarn >=2.2.0) after `yarn.lock` updates. |

Expand Down

This file was deleted.

26 changes: 1 addition & 25 deletions lib/modules/manager/npm/post-update/pnpm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('modules/manager/npm/post-update/pnpm', () => {
{},
{ ...config, postUpdateOptions }
);
expect(fs.readLocalFile).toHaveBeenCalledTimes(2);
expect(fs.readLocalFile).toHaveBeenCalledTimes(1);
expect(res.lockFile).toBe('package-lock-contents');
expect(execSnapshots).toMatchObject([
{
Expand All @@ -89,30 +89,6 @@ describe('modules/manager/npm/post-update/pnpm', () => {
]);
});

it('performs dedupe --ignore-scripts for pnpm >= 8.8.0', async () => {
const execSnapshots = mockExecAll();
const fileContent = Fixtures.get('dedupe-ignore-scripts/package.json');
fs.readLocalFile
.mockResolvedValueOnce(fileContent)
.mockResolvedValue('package-lock-contents');
const postUpdateOptions = ['pnpmDedupe'];
const res = await pnpmHelper.generateLockFile(
'some-dir',
{},
{ ...config, postUpdateOptions }
);
expect(fs.readLocalFile).toHaveBeenCalledTimes(2);
expect(res.lockFile).toBe('package-lock-contents');
expect(execSnapshots).toMatchObject([
{
cmd: 'pnpm install --recursive --lockfile-only --ignore-scripts --ignore-pnpmfile',
},
{
cmd: 'pnpm dedupe --ignore-scripts',
},
]);
});

it('uses the new version if packageManager is updated', async () => {
const execSnapshots = mockExecAll();
fs.readLocalFile.mockResolvedValue('package-lock-contents');
Expand Down
17 changes: 2 additions & 15 deletions lib/modules/manager/npm/post-update/pnpm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import is from '@sindresorhus/is';
import { load } from 'js-yaml';
import semver from 'semver';
import upath from 'upath';
import { GlobalConfig } from '../../../../config/global';
import { TEMPORARY_ERROR } from '../../../../constants/error-messages';
Expand Down Expand Up @@ -40,7 +39,6 @@ export async function generateLockFile(
let cmd = 'pnpm';
try {
const lazyPgkJson = lazyLoadPackageJson(lockFileDir);

const pnpmToolConstraint: ToolConstraint = {
toolName: 'pnpm',
constraint:
Expand Down Expand Up @@ -81,19 +79,8 @@ export async function generateLockFile(

// postUpdateOptions
if (config.postUpdateOptions?.includes('pnpmDedupe')) {
const pnpmVersionFromPackageJson = getPackageManagerVersion(
'pnpm',
await lazyPgkJson.getValue()
);

if (
pnpmVersionFromPackageJson &&
semver.gte(pnpmVersionFromPackageJson, '8.8.0')
) {
commands.push('pnpm dedupe --ignore-scripts');
} else {
commands.push('pnpm dedupe');
}
logger.debug('Performing pnpm dedupe');
commands.push('pnpm dedupe');
}

if (upgrades.find((upgrade) => upgrade.isLockFileMaintenance)) {
Expand Down