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] Customize default installation #4976

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

Conversation

pedro-gomes-92
Copy link
Contributor

@pedro-gomes-92 pedro-gomes-92 commented Oct 17, 2024

Summary

Provide a solution for package maintainers to configure how their project should be installed: as a local package or as an external module.
This PR proposes 2 new parameters on rush.json:

  • installRemotely: Forces remote installation, even if the package is local (default: false)
  • versionRange: Specifies the version range when installing the package (only works if installRemotely = true)

Details

In some cases, developers prefer their dependents to consume their packages using a fixed NPM version, even though the package source is part of the same monorepo. While they continue iterating on their code, they think it is not their responsibility to keep all the dependent projects updated and verified.
rush add will always update the current package.json with "workspace:*" if this module exists in the current workspace. This should be configured by the package maintainer.

rush add -p <package> // always adds dependency { "<package>": "workspace:*" }

Package maintainers should be able to flag their project, as a local or remote project (new parameter: installRemotely). Optionally, it should be possible to explicitly specify the version number, using version range (new parameter: versionRange).

// rush.json
{
    ...
    "projects": [
    {
      "packageName": "<package>",
      "projectFolder": "libs/<package>",
      "installRemotely": true, 
      "versionRange": ">=0.10.3 <15"
    },
  ]
}

"versionRange" will be ignored if the package is locally installed, i.e. "installRemotely" is false.

How it was tested

Tested manually in a local demo repository: https://github.com/pedro-gomes-92/rushstack-playground

Impacted documentation

https://api.rushstack.io/pages/rush-lib.rushconfiguration/#rushconfiguration-class

@pedro-gomes-92
Copy link
Contributor Author

pedro-gomes-92 commented Oct 17, 2024

@microsoft-github-policy-service agree company="TikTok"

@pedro-gomes-92 pedro-gomes-92 changed the title [rush] Support default installation parameters [rush] Customize default installation Oct 17, 2024
@pedro-gomes-92 pedro-gomes-92 force-pushed the pedrogomes/support-default-install branch from e4fc4a3 to a762ba6 Compare October 17, 2024 23:10
@pedro-gomes-92 pedro-gomes-92 marked this pull request as ready for review October 22, 2024 02:44
@iclanton
Copy link
Member

This would normally be accomplished by listing the package as in the decoupledLocalDependencies field of all of its consumers. Why doesn't that work?

@pedro-gomes-92 pedro-gomes-92 force-pushed the pedrogomes/support-default-install branch from a762ba6 to 77f5c20 Compare November 21, 2024 08:41
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.

2 participants