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

[rush] Design proposal: Make the current local package accessible in another location #5085

Open
L-Qun opened this issue Jan 23, 2025 · 0 comments

Comments

@L-Qun
Copy link
Contributor

L-Qun commented Jan 23, 2025

Summary

From the description of pnpm link, its functionality is very straightforward—it simply links the target package to the node_modules directory.

Image

However, pnpm performs more complex checks. For example, if a package's package.json includes workspace dependencies, pnpm will sequentially check whether the current workspace contains that package. If it doesn't, pnpm will throw an error.

Image

It seems that this issue has been resolved in pnpm@10. But it will automatically make some configuration changes for me.

Image

But we don't need these, right? Because the target path is uncertain, if we accidentally commit the changes, it will cause problems. At the same time, it creates symbolic links in the root node_modules directory, which means that the rush-pnpm link command will no longer work in pnpm@10.

We need two additional Rush commands to address this issue.

Image

Details

  1. rush link-package
cd my-project && rush link-package /path/to/repo/the-library
rush link-package /path/to/repo/the-library --project my-project --project framework
  1. rush bridge-package
rush bridge-package /path/to/repo/the-library

The first one works similarly to pnpm link, but it prevents issues arising from version differences in pnpm. However, it still cannot address problems with peerDependencies.

Image

The second approach is similar to installing a package normally, but with symbolic links, changes are automatically synchronized. The current dependency relationships are as follows:

Image

The dependencies of this package should also be synchronized. For example, when both the dependent package and the dependency package rely on React, it can be correctly resolved. The current dependency relationships are as follows:

Image

I think both of these commands are essential. The first one is simple and intuitive, while the second may require additional configuration.

@github-project-automation github-project-automation bot moved this to Needs triage in Bug Triage Jan 23, 2025
@iclanton iclanton moved this from Needs triage to General Discussions in Bug Triage Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: General Discussions
Development

No branches or pull requests

1 participant