facebook / relay

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

[epic] [v13] List of current issues, missing features and possible improvements in the new compiler (and relay) #3749

Open alunyov opened 2 years ago

alunyov commented 2 years ago

Here we will keep track of the progress of the release/adoption of the new compiler in OSS.

If there is something that is blocking you from adopting the new compiler (and it is not mentioned in this list) please create a new issue, we will review and add it to the list/or trying help with the fix.

The goal: help prioritizing critical bug-fixes/features for upcoming v13.0.2 release (and beyond).

Current Reported Issues:

Bugs:

Missing Features:

Possible Improvements:

seanaguinaga commented 2 years ago

Documentation has a few TODOs - not sure if that's related or I should make a separate issue

bigfootjon commented 2 years ago

Would OSS support for EntryPoint (which AFAICT just means generating $Parameters.js files, and writing docs) be a good thing to mention under "Possible Improvements:"?

mikeldking commented 2 years ago

Just migrated a large code base to 13.1.1 Main pain-points I had:

Thanks for all the improvements! Excited to be on 13.

alunyov commented 2 years ago

Thanks @mikeldking !

I think 1,2 items are probably connected. We do support --config flag, but it is probably cannot read JS files.

https://github.com/facebook/relay/blob/ec989877d483c25c957e770460891f7612d12714/compiler/crates/relay-compiler/src/main.rs#L120-L121

Typescript should not be a default language, maybe you have other config that have typescript in it?

https://github.com/facebook/relay/blob/ec989877d483c25c957e770460891f7612d12714/compiler/crates/relay-config/src/typegen_config.rs#L25-L27

mikeldking commented 2 years ago

Hey thanks for the response @alunyov

I forked the examples to show what I'm seeing: https://github.com/relayjs/relay-examples/pull/208

Issue 1 (--config not supported)

If you run yarn build:with-config-option (e.g. relay-compiler --config ./relay.config.json) you will get

➜  todo git:(relay-compiler-bug-demo) ✗ (⎈ |mynamespace:mikeldking) yarn build:with-config-option
yarn run v1.22.17
warning ../../../package.json: No license field
$ relay-compiler --config ./relay.config.json
error: Found argument '--config' which wasn't expected, or isn't valid in this context

    If you tried to supply `--config` as a value rather than a flag, use `-- --config`

USAGE:
    relay [OPTIONS] [CONFIG]

For more information try --help
error Command failed with exit code 2.

This diverged (seems to be fixed?) from the docs so it caused some confusion.

Previously you could mix CLI option flags with a config file but now you cannot. E.g. the only valid syntax in this case is relay-compiler ./relay.config.json. We were using a relay.config.js as a base config for two relay compilation steps (two different entry points into our app). We now have a relay.xxx.config.json and a relay.yyy.config.json to accomplish the two compilations.

Issue 2 (typescript default when using options)

You are right, in the case where there is no language specified in the config file, it defaults to flow. However in the case you run the compiler with flags (yarn build:with-options or relay-compiler --schema ./data/schema.graphql --src ./js --artifactDirectory ./__generated__/relay), you will get typescript emitted.

See video:

https://user-images.githubusercontent.com/5640648/154538403-d3ba1ff5-610c-4e55-a3b8-6cd4fd8f87b1.mov

Hope that helps clarify things!

alunyov commented 2 years ago

Thanks @mikeldking for detailed report!

simkessy commented 2 years ago

the old compiler used to output the changed files, is this something that was removed?

alunyov commented 2 years ago

the old compiler used to output the changed files, is this something that was removed?

Hmm, can you create an issue for this? With the possible example/repro to better understand what output should have changed files?