Skip to content

Conversation

@fzxen
Copy link
Contributor

@fzxen fzxen commented Dec 23, 2024

Summary

Fixes #5053

After I set the preventManualShrinkwrapChanges field in the pnpm-config.json file to true, I successfully reproduced this problem.

Details

The following code logic will result in the lockfile object having nullish value, so the yamlModule.safeDump method will throw an exception.

const dependencies: ResolvedDependencies | undefined =
from.dependencies == null ? from.dependencies : moveSpecifiers(from.dependencies);
const devDependencies: ResolvedDependencies | undefined =
from.devDependencies == null ? from.devDependencies : moveSpecifiers(from.devDependencies);
const optionalDependencies: ResolvedDependencies | undefined =
from.optionalDependencies == null ? from.optionalDependencies : moveSpecifiers(from.optionalDependencies);
return {
...from,
specifiers,
dependencies,
devDependencies,
optionalDependencies
};

How it was tested

I have added some unit tests to ensure that the importers field in the lockfile will not contain nullish values.

@fzxen fzxen marked this pull request as ready for review December 23, 2024 09:00
@iclanton iclanton changed the title Fixed the issue where the lockfile object has an nullish value causing yaml.dump to report an error [rush] Fixed the issue where the lockfile object has an nullish value causing yaml.dump to report an error Jan 6, 2025
@iclanton iclanton enabled auto-merge (squash) January 6, 2025 19:29
@iclanton iclanton merged commit 03ffcbb into microsoft:main Jan 6, 2025
5 checks passed
@octogonz
Copy link
Collaborator

octogonz commented Jan 7, 2025

@fzxen thanks for making this fix! It's been published with Rush 5.147.2 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

[rush] ERROR: unacceptable kind of an object to dump (undefined)

3 participants