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: #7932 #8038

Merged
merged 8 commits into from
Jan 12, 2024
Merged

fix: #7932 #8038

merged 8 commits into from
Jan 12, 2024

Conversation

eriklangille
Copy link
Contributor

What does this PR do?

Fixes #7932

When updating a package that is used as a peerDependency in one of the installed packages, then old package would be kept as a module within the child package's node_modules. With this fix, the child package uses the root package, as expected.

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

I wrote automated tests

  • I checked the lifetime of memory allocated to verify it's (1) freed and (2) only freed when it should be
  • I included a test for the new code, or an existing test covers it
  • JSValue used outside outside of the stack is either wrapped in a JSC.Strong or is JSValueProtect'ed
  • I wrote TypeScript/JavaScript tests and they pass locally (bun-debug test test/cli/install/registry/bun-install-registry.test.ts)

@dylan-conway
Copy link
Member

This is great. This also fixes a todo test in bun-install-registry.test.ts. If you search for the test it should install in such a way that two identical packages with different peer dependencies are different instances, remove the todo, and change expect(out).toBe("true\ntrue\ntrue\n"); to expect(out).toBe("true\ntrue\nfalse\n");, it should pass. Testing manually with yarn and npm shows that the last boolean in the string should actually be false.

@eriklangille
Copy link
Contributor Author

This is great. This also fixes a todo test in bun-install-registry.test.ts. If you search for the test it should install in such a way that two identical packages with different peer dependencies are different instances, remove the todo, and change expect(out).toBe("true\ntrue\ntrue\n"); to expect(out).toBe("true\ntrue\nfalse\n");, it should pass. Testing manually with yarn and npm shows that the last boolean in the string should actually be false.

Done.

@dylan-conway dylan-conway merged commit 1526366 into oven-sh:main Jan 12, 2024
22 of 29 checks passed
@dylan-conway
Copy link
Member

Thank you

ryoppippi pushed a commit to ryoppippi/bun that referenced this pull request Feb 1, 2024
* updating package with child peerDependency doesn't keep old version

* [autofix.ci] apply automated fixes

* fixed TODO test

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

peerDependencies not resolving properly
2 participants