facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.41k stars 1.83k forks source link

Skip check for source control integration if noSourceControl: true is set in config. #4767

Closed Markionium closed 2 months ago

Markionium commented 3 months ago

This PR adds the option to add noSourceControl: true to the relay config which will skip the git status and sl --version commands when creating the configuration.

Those checks are run to help the compiler add/remove files from source control for you. However in cases where the generated files are not checked into source control this isn't helpful, especially when git status is "slow".

I noticed a significant decrease in performance between 16 and 17 when git status was introduced.

Another issue we have internally in Microsoft is that we use BuildXL in some of our repos, which distributes building of our packages. However it will not allow reads to undeclared dependencies, a git status check will break that "rule" as it read across the whole repo.

In the repo I work on we do not check in our artefacts and thus do not need source control integration.

facebook-github-bot commented 3 months ago

@tyao1 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

tyao1 commented 3 months ago

For making it a config, you could add the config here: https://github.com/facebook/relay/blob/main/compiler/crates/relay-compiler/src/config.rs

Markionium commented 3 months ago

@tyao1 Updated the PR, tested to make sure it works for both scenarios (Single and Multi project config files). I'm not sure if there any tests for this source control integration that I could have updated/added to?

[Edit]: I realized we can keep everything in config.rs now that we're making it a config. I'll update the PR tomorrow :)

Markionium commented 3 months ago

@tyao1 should be good to go now!

facebook-github-bot commented 2 months ago

@captbaritone has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

captbaritone commented 2 months ago

Looks good!

facebook-github-bot commented 2 months ago

@captbaritone merged this pull request in facebook/relay@4d140d29aabb45de977d0bc5bc533886efb9d5f0.