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

Forked relay-compiler breaks .bin script #4726

Open
4 tasks
f8k8 opened this issue Sep 22, 2022 · 4 comments
Open
4 tasks

Forked relay-compiler breaks .bin script #4726

f8k8 opened this issue Sep 22, 2022 · 4 comments

Comments

@f8k8
Copy link

f8k8 commented Sep 22, 2022

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

The forked version of relay-compiler overwrites the script installed to .bin by the regular version of relay-compiler. This can cause builds to use an incorrect version of the relay compiler.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new, empty package with npm init.
  2. Install relay-compiler: npm install --save relay-compiler.
  3. The relay-compiler script in .bin points to the correct place.
  4. Install @graphql-codegen/typescript: npm install --save @graphql-codegen/[email protected].
  5. The relay-compiler script in .bin is updated to point to the v12 fork used in @graphql-tools/relay-operation-optimizer

Expected behavior

The forked version of relay-compiler (@ardatan/[email protected]) should not include the bin entry in its package.json:

"bin": {
    "relay-compiler": "bin/relay-compiler"
  },

and so wouldn't overwrite the relay-compiler script in the .bin folder.

Environment:

Additional context

There doesn't seem to be a repo for the forked relay-compiler (@ardatan/relay-compiler) that I could see to add this issue to.

@AnotherHermit
Copy link

We have the same issue, and are currently using "@graphql-codegen/typescript": "2.4.11", as a workaround since that version still works

@antonioguerra
Copy link

Hi, same issue here.

(npm init -y && npm i relay-compiler @graphql-tools/relay-operation-optimizer) > /dev/null && readlink node_modules/.bin/relay-compiler

../@ardatan/relay-compiler/bin/relay-compiler

Any ideas @ardatan ?

@edvinerikson
Copy link

edvinerikson commented Mar 16, 2023

Another workaround that seem to work:

create a new folder and package.json

// in relay-compiler-patch/package.json
{
  "name": "@ardatan/relay-compiler",
  "version": "0.0.0"
}

then in your top-level package.json, enable workspaces:

  "workspaces": [
    "relay-compiler-patch",
  ],

if you already use workspaces, just drop the package.json inside any of the workspace paths.

@Quramy
Copy link

Quramy commented Sep 25, 2024

I have the same issue. Any update for this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants