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] New commands "rush link-package" and "rush bridge-package" #5123

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

L-Qun
Copy link
Contributor

@L-Qun L-Qun commented Feb 22, 2025

Summary

Since the relevant background has already been introduced in the Design Proposal, this section will mainly focus on some implementation details.

Details

rush link-package

rush link-package will create a symbolic link of the target package to the node_modules directory of the current package.

image

Usage:

rush link-package --path /path/to/repo/target-library
rush link-package --path /path/to/repo/target-library --project my-project --project framework

rush bridge-package

Since rush link-package cannot resolve issues caused by peerDependencies, we provide rush bridge-package to address this problem, which is based on hard links and symbolic links.

It is based on pnpm-sync behind the scenes, which means it will automatically help me with synchronization during the build.

At the same time, we should have the concept that we cannot fully equate this with installing third-party dependencies, nor should we attempt to implement this capability.

Let's say the target-package includes react as a peerDependency, the current dependency model is:

image

Usage:

rush bridge-package --path /path/to/repo/target-library
rush bridge-package --path /path/to/repo/target-library --project my-project --project framework

We also offer a way to directly replace the artifacts, backed by pnpm-sync behind the scenes.

image

Usage:

rush bridge-package --path /path/to/repo/target-library --replace
rush bridge-package --path /path/to/repo/target-library --project my-project --project framework --replace

rush-link-state.json

rush-link-state.json used to store information about packages connected via rush link-package and rush bridge-package commands.

common/temp/rush-link-state.json

Thus, it can be avoided from being skipped when running rush install.

How it was tested

The target package can be correctly accessed under the current package.

@L-Qun L-Qun force-pushed the feat/link-bridge-package branch from f6b8a25 to b85b48d Compare March 6, 2025 12:44
@L-Qun L-Qun force-pushed the feat/link-bridge-package branch from a70e0b9 to c77d997 Compare March 6, 2025 15:07
@octogonz octogonz changed the title [rush]: An improved alternative to "rush-pnpm link" [rush] New commands "rush link-package" and "rush bridge-package" Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

1 participant