ardatan / ardatan/graphql-tools

Forked relay-compiler breaks .bin script

Open
#4,726 4 comments 6 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.4k
Forks
830
Avg merge
10h 59m
Merged PRs (30d)
45

Description

### Issue workflow progress

_Progress of the issue based on the [Contributor Workflow](https://github.com/the-guild-org/Stack/blob/master/CONTRIBUTING.md#a-typical-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/typescript@2.7.3`.
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/relay-compiler@12.0.0`) 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:**

- OS: Windows 10
- `@graphql-tools/relay-operation-optimizer@6.5.6`:
- NodeJS: v16.13.2
- NPM: 8.17.0

**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.

Contributor guide

Open the contributing guide

Research direction

Reproduce the conflict with `npm init`, `relay-compiler`, and `@graphql-codegen/typescript@2.7.3`, then inspect the installed packages' `package.json` files and the generated `.bin/relay-compiler` script. Done means the forked `@ardatan/relay-compiler@12.0.0` no longer overwrites the regular relay-compiler script; the issue notes that the fork's repository is not available.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, nodejs, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.