relay icon indicating copy to clipboard operation
relay copied to clipboard

inline graphql-js' printer

Open cometkim opened this issue 1 year ago • 13 comments

See #3628 and #4226

cometkim avatar May 04 '24 15:05 cometkim

This seems sensible to me. Feel free to ping me when this diff is ready for review (I see it's still marked as Draft).

captbaritone avatar May 07 '24 19:05 captbaritone

I wonder if there's a sensible way to add some tests which assert that the compiler and this code arrive at the same hash?

captbaritone avatar May 07 '24 19:05 captbaritone

That's is easy if we can run the printer standalone. Or, it would be ideal to publish to NPM and directly use its WASM or NAPI distribution

cometkim avatar May 08 '24 10:05 cometkim

Workaround: Commit md5 hashes for all the fixtures in the graphql-text-printer crate test suite. Then we can compare it when running the babel plugin tests.

cometkim avatar May 13 '24 10:05 cometkim

@captbaritone I added idempotency testing using compiler-side fixtures. Fixed 4 failures related to spaces between multiple definitions and it all passes.

cometkim avatar May 13 '24 18:05 cometkim

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

facebook-github-bot avatar May 13 '24 21:05 facebook-github-bot

I think it makes more sense for each package to have a lockfile since there is no workspaces setup, or gitignoring. yarn install is needed to run the test suite for react-relay, but it doesn't seem to be running anywhere?

Anyway, I'd suggest clearing it and activating the workspaces, it would improve your CI cache hits a lot.

cometkim avatar Jun 07 '24 22:06 cometkim

@cometkim Yeah, I could have sworn we had a workspace setup. Here's where we do the global yarn install. I guess we'll need to either setup the workspace or manually run install for this package.

https://github.com/facebook/relay/blob/main/.github/workflows/ci.yml#L45

captbaritone avatar Jun 07 '24 23:06 captbaritone

setup here? or another pr?

cometkim avatar Jun 07 '24 23:06 cometkim

Either way. Whatever you prefer.

captbaritone avatar Jun 07 '24 23:06 captbaritone

https://github.com/facebook/relay/pull/4711

I'm not sure it could actually boost the CI, let's see.

cometkim avatar Jun 08 '24 00:06 cometkim

Checking back here. Are we stuck on this Yarn issue?

captbaritone avatar Jan 24 '25 00:01 captbaritone

Not really. It is a result of prioritizing another task according to what you mentioned:

Maybe you can do some git blaming to figure out why we even have that yarn.lock in the first place?

cometkim avatar Jan 24 '25 03:01 cometkim