Skip to content

Conversation

@motiz88
Copy link

@motiz88 motiz88 commented May 20, 2024

Summary

Previously (#24) we added the FuseboxClient.setClientMetadata method as an ad-hoc protocol extension directly in rn_fusebox.ts. Here we formalise this protocol extension by using the CDP codegen mechanism available in the repo. This is in anticipation of adding more React Native-specific methods/events in the future.

How to add RN-specific protocol messages

Upstream docs for the codegen mechanism are available here. In practice, I only followed the steps that are relevant to the CDT repo, skipping the Chromium ones.

NOTE: Instead of running npm run generate-protocol-resources which results in a lot of noisy formatting changes, I've run scripts/deps/generate_protocol_resources.py directly.

For ease of rebasing in the future, I've created a new react_native_domains.pdl file instead of modifying the existing browser_protocol.pdl.

Test plan

TODO: Ensure that the correct Fusebox welcome message appears on startup.

Upstreaming plan

  • This commit should be sent as a patch to the upstream devtools-frontend repo. I've reviewed the contribution guide.
  • This commit is React Native-specific and cannot be upstreamed.

Copy link

@hoxyq hoxyq left a comment

Choose a reason for hiding this comment

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

Makes sense to me, but oof, rebasing commits with changes in codegen-ed files will probably be painful

@hoxyq hoxyq merged commit 0eb7c90 into facebook:main May 20, 2024
@hoxyq hoxyq deleted the fusebox-client-protocol-codegen branch May 20, 2024 14:48
@motiz88
Copy link
Author

motiz88 commented May 20, 2024

rebasing commits with changes in codegen-ed files will probably be painful

I'm optimistic about this - after all, we can always rerun the codegen and commit the result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants