relay icon indicating copy to clipboard operation
relay copied to clipboard

Support multiple Relay project configurations in extension

Open ernieturner opened this issue 2 years ago • 9 comments

Reviving https://github.com/facebook/relay/pull/3972 into a separate PR and taking over for Terence. This mostly just copies that PR into a new one, but also does a few other fixes

  • Fixes issues were were having with extension publishing with vsce. I updated to the non-deprecated @vscode/vsce updated package. Packaging/publishing has changed a bit now
    • Uses esbuild to minify the extension into a single file as recommended by the VSCode docs
    • Removes the use of the extension as a yarn workspace. Yarn workspaces and the vsce packager don't play very well together and were causing all sorts of dependency issues when trying to create the extension .vsix file. Since no other parts of this repo were using workspaces (e.g. the website) I removed that and made it so the extension is its own standalone folder.
  • Clarified and updated extension options around the relay.projects configuration. Also added a section to the README on how to migrate from v1 to v2

I tested this extension in a handful of different projects, some with no configuration needed, some with the old configuration options (which we map to the new one), and workspaces with multiple projects. However, if anyone has the time I'd love to have others try it out. Just run yarn build-local from the vscode-extension directory and manually install the resulting relay-2.0.0.vsix file into VSCode.

Unrelated to the core purpose of this change, but I also added a .nvmrc file to the root of this repo (and removed .nvmrc from the gitignore since running yarn at the root of this repo with Node 18 fails. Not sure if we were intentionally not including .nvmrc files though, so I can revert if needed.

/cc @davidmccabe @captbaritone @tbezman

ernieturner avatar Mar 07 '23 18:03 ernieturner

I don't really understand the unit test failures at this point since my changes shouldn't have touched any of that. Maybe the cargo.lock file needs to be updated, not sure.

ernieturner avatar Mar 22 '23 22:03 ernieturner

Any update on that PR? What do we need to finish and merge this PR?

cc @captbaritone @tobias-tengler

noghartt avatar Jan 30 '24 10:01 noghartt

Do you plan to release this Pull Request?

I added relay.projects to settings.json as documented, but it did not work correctly and upon investigation I noticed that this PR has not yet been merged.

sho-pb avatar Feb 08 '24 08:02 sho-pb

Do you plan to release this Pull Request?

I added relay.projects to settings.json as documented, but it did not work correctly and upon investigation I noticed that this PR has not yet been merged.

I just came looking to find out why that wasn't working, since it was documented as a feature. Do we know when this would be released?

Screenshot 2024-02-13 at 5 10 07 PM

ldeveber avatar Feb 13 '24 22:02 ldeveber

Same for me, can we merge this MR and do a release ? Required for mono repo :)

ohardy-agrisight avatar Jun 22 '24 11:06 ohardy-agrisight

What is everyone doing as a workaround to handle monorepos with multiple relay configs?

net avatar Jun 26 '24 22:06 net

What is everyone doing as a workaround to handle monorepos with multiple relay configs?

You can pass projects into your relay.config.js like this:

module.exports = {
  root: ".",
  sources: {
    // put here the source of each project, the root dir of each package of your monorepo
  },
  projects: {
    project1: {
      schema: "...",
      language: "typescript",
    },
    // ...
  },
}

noghartt avatar Jun 27 '24 00:06 noghartt

@noghartt thank you!

net avatar Jun 27 '24 14:06 net