teamwalnut / graphql-ppx

GraphQL language primitives for ReScript/ReasonML written in ReasonML
https://graphql-ppx.com
MIT License
257 stars 53 forks source link

Installation not working. #263

Closed samwightt closed 3 years ago

samwightt commented 3 years ago

I'm having issues installing the package with ReScript and Yarn. When I install the package and add it to my bsconfig.json, I get this error:

Error: /home/sam/Code/elixir/threaded/frontend/node_modules/@reasonml-community/graphql-ppx/bsconfig.json: No such file or directory
error Command failed with exit code 2.

Looking in the node_modules folder, it looks like the bsconfig.json file isn't included in the package.

Package version: ^0.7.3

My package.json:

{
  "name": "frontend",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "serve": "vite preview",
    "re:build": "rescript",
    "re:watch": "rescript build -w"
  },
  "dependencies": {
    "@rescript/react": "^0.10.3",
    "@urql/rescript": "^4.0.0",
    "graphql": "^15.5.1",
    "react": "^17.0.0",
    "react-dom": "^17.0.0",
    "twind": "^0.16.16",
    "urql": "^2.0.4",
    "wonka": "^4.0.15"
  },
  "devDependencies": {
    "@reasonml-community/graphql-ppx": "^0.7.3",
    "@types/react": "^17.0.0",
    "@types/react-dom": "^17.0.0",
    "@vitejs/plugin-react-refresh": "^1.3.1",
    "gentype": "^4.1.0",
    "rescript": "^9.1.4",
    "typescript": "^4.3.2",
    "vite": "^2.4.3"
  }
}

My bsconfig.json:

{
  "name": "your-project-name",
  "sources": [
    {
      "dir": "src",
      "subdirs": true
    }
  ],
  "reason": { "react-jsx": 3 },
  "package-specs": [
    {
      "module": "es6"
    }
  ],
  "suffix": ".bs.js",
  "ppx-flags": ["@reasonml-community/graphql-ppx/ppx"],
  "bs-dependencies": [
    "@reasonml-community/graphql-ppx",
    "@rescript/react",
    "wonka",
    "@urql/rescript"
  ]
}
jfrolich commented 3 years ago

Yes we didn't have a runtime in 0.7.3 (so you don't need to put it in bs-dependencies), this was only introduced at 1.x

AlexMoutonNoble commented 3 years ago

@jfrolich Hi Jaap is there some meaning behind 0.7.3 being the latest release on NPM vs 1.0+ ?

Thanks Alex

jfrolich commented 3 years ago

It's to make the ppx work on an m1, for users that didn't migrate yet

AlexMoutonNoble commented 3 years ago

migrate to which?

samwightt commented 3 years ago

Ah yep, switching to the 1.x version fixed the issue! Would y'all be open to a PR that adds a note about this in the README.md?

jfrolich commented 3 years ago

Oh I was not aware of that the latest tag will now install the legacy version when you install it by default! Let me try to fix that!

jfrolich commented 3 years ago

Fixed by releasing a new minor version 1.2.2