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] Adds support for a separate rush-projects.json configuration file #4881

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

Conversation

william2958
Copy link
Contributor

@william2958 william2958 commented Aug 12, 2024

Summary

This MR adds the optional rush-projects.json file that allows the rush projects to be defined in a separate, dedicated file. This is useful in situations where repo permissions are managed at a file-level, allowing more developers to add or remove projects without admin repo level permissions.

Details

This change will change the way rush looks for projects. It will first look for a rush-projects.json file, then if it does not exist it will look within the rush.json file, same as before. It prevents projects from being defined in both places, and also ensures that the projects are defined in one of the two locations.

How it was tested

Tested locally on a rush repo.

Impacted documentation

https://rushjs.io/pages/configs/rush_json/

@william2958 william2958 marked this pull request as ready for review August 12, 2024 23:36
@iclanton iclanton changed the title Adds support for a seperate rush-projects.json configuration file [rush] Adds support for a separate rush-projects.json configuration file Aug 14, 2024
common/reviews/api/rush-lib.api.md Outdated Show resolved Hide resolved
libraries/rush-lib/src/api/RushConfiguration.ts Outdated Show resolved Hide resolved
libraries/rush-lib/src/api/RushConfiguration.ts Outdated Show resolved Hide resolved
libraries/rush-lib/src/api/RushConfiguration.ts Outdated Show resolved Hide resolved
"description": "Part of the JSON Schema standard, this optional keyword declares the URL of the schema that the file conforms to. Editors may download the schema and use it to perform syntax highlighting.",
"type": "string"
},
"projects": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of duplicating this in a second schema, update this and the rush.json schema to allow anything in the projects property and extract this to its own schema and validate the projects object separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to use a "rush-project-config.schema.json"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This schema does not seem to be actually importing or using rush-project-config.schema.json.

@iclanton @D4N14L do we actually have an example of a schema referencing another schema in our code base? In the past I think anything.schema.json was used in this way, but today nothing seems to import it.

My concern is whether VS Code will fetch the URL correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what it looks like, when you do a ref to another json schema, doesn't that schema need to be uploaded to a server first? So I guess I would need to create the rush-project-config.schema.json, upload it, then add the reference in rush.schema.json?

Copy link
Contributor

@kenrick95 kenrick95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some typo in the comments

libraries/rush-lib/src/api/RushConfiguration.ts Outdated Show resolved Hide resolved
libraries/rush-lib/src/api/RushConfiguration.ts Outdated Show resolved Hide resolved
@william2958 william2958 requested a review from iclanton August 26, 2024 21:16
@@ -0,0 +1,18 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the filename is rush-projects.json then the schema filename must be rush-projects.schema.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking the same thing, but the rush-project.schema.json file already exists and I feel like it might be confusing to just have rush-project.schema.json and rush-projects.schema.json files

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.

4 participants