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

Rust compiler: purging non-Relay files from __generated__ folders #3438

Open
Tracked by #3180
mrtnzlml opened this issue Apr 2, 2021 · 6 comments
Open
Tracked by #3180

Rust compiler: purging non-Relay files from __generated__ folders #3438

mrtnzlml opened this issue Apr 2, 2021 · 6 comments
Labels
bug rust Related to the compiler written in Rust

Comments

@mrtnzlml
Copy link
Contributor

mrtnzlml commented Apr 2, 2021

Hi, I have a feature request (or proposal/discussion) for the new Rust compiler. I noticed that the new compiler always deletes the whole content of __generated__ folder. It's even explained here:

/// A project without an output directory will put the generated files in
/// a __generated__ directory next to the input file.
/// All files in these directories should be generated by the Relay
/// compiler, so that the compiler can cleanup extra files.
#[serde(default)]
output: Option<PathBuf>,

I see the __generated__ folder to be a nice convention together with __tests__, __fixtures__ and so on. Nothing screams from it "Relay" (but rather "it's generated content"). So I used this pattern for some other use-cases where I generate some kind of non-Relay content into __generated__. This obviously brings some troubles now since Relay Rust compiler purges these files (even though it has nothing to do with Relay and there are no Relay artifacts).

What is the recommended strategy here? Or perhaps, would you please reconsider this behavior? Some other solutions could be:

  • target only *.graphql.js (or new *.relay.js) files under __generated__/…
  • have the possibility to put Relay artifacts under __generated__/relay/…
  • have the possibility to keep subfolders like __generated__/something-different/…

Have you encountered this situation inside Facebook? How did you solve it?

Thanks! 😎

@kassens kassens added the rust Related to the compiler written in Rust label Apr 13, 2021
@kassens
Copy link
Member

kassens commented Apr 13, 2021

For most code we use a fixed output directory, but in the places we use the relative directory I don't think we had anything other then Relay in them.

I think it'd be reasonable to match on *.graphql.js or *.graphql.ts.

Not sure I feel good about adding yet another output directory version as our options are already kindof hard to all test and it'd also add more confusion to the config as it would also need that configuration in the Babel plugin, I think.

@kassens kassens changed the title Rust compiler: always purging __generated__ folders Rust compiler: purging non-Relay files from __generated__ folders Apr 13, 2021
@kassens kassens added the bug label Apr 13, 2021
@kassens
Copy link
Member

kassens commented Apr 13, 2021

But assuming the existing JS compiler only removes the Relay files, we should fix this.

@kassens
Copy link
Member

kassens commented Apr 30, 2021

moved this comment to the correct issue #3437 (comment)

@mrtnzlml
Copy link
Contributor Author

mrtnzlml commented Apr 30, 2021

(edit by @kassens) moved this comment to the correct issue #3437 (comment)

mrtnzlml added a commit to adeira/universe that referenced this issue Dec 19, 2021
kodiakhq bot pushed a commit to adeira/universe that referenced this issue Dec 19, 2021
adeira-github-bot pushed a commit to mrtnzlml-archive/kochka.com.mx that referenced this issue Dec 19, 2021
See: facebook/relay#3438

adeira-source-id: 47ebdf10ddc94dec2bab68accaf44c477e264f39
@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 9, 2022
@mrtnzlml
Copy link
Contributor Author

mrtnzlml commented Jan 9, 2022

This is not stale. In fact, I believe there is a PR in progress fixing this issue: #3700

@stale stale bot removed the wontfix label Jan 9, 2022
adeira-github-bot pushed a commit to adeira/abacus-kochka that referenced this issue Jan 29, 2022
See: facebook/relay#3438

adeira-source-id: 47ebdf10ddc94dec2bab68accaf44c477e264f39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug rust Related to the compiler written in Rust
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants