mercurius-js / mercurius-typescript

TypeScript usage examples and "mercurius-codegen" for Mercurius

Home Page:https://mercurius.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mercurius 12.0 peer dependency conflict

kylerush opened this issue · comments

I am running into a peer dependency conflict:

npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: mercurius-codegen@5.0.1
npm WARN Found: mercurius@12.0.0
npm WARN node_modules/mercurius
npm WARN   mercurius@"^12.0.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer mercurius@"^11.3.0" from mercurius-codegen@5.0.1
npm WARN node_modules/mercurius-codegen
npm WARN   dev mercurius-codegen@"^5.0.1" from the root project
npm WARN 
npm WARN Conflicting peer dependency: mercurius@11.5.0
npm WARN node_modules/mercurius
npm WARN   peer mercurius@"^11.3.0" from mercurius-codegen@5.0.1
npm WARN   node_modules/mercurius-codegen
npm WARN     dev mercurius-codegen@"^5.0.1" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: mercurius-integration-testing@6.0.1
npm WARN Found: mercurius@12.0.0
npm WARN node_modules/mercurius
npm WARN   mercurius@"^12.0.0" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer mercurius@"^11.0.0" from mercurius-integration-testing@6.0.1
npm WARN node_modules/mercurius-integration-testing
npm WARN   dev mercurius-integration-testing@"^6.0.1" from the root project
npm WARN 
npm WARN Conflicting peer dependency: mercurius@11.5.0
npm WARN node_modules/mercurius
npm WARN   peer mercurius@"^11.0.0" from mercurius-integration-testing@6.0.1
npm WARN   node_modules/mercurius-integration-testing
npm WARN     dev mercurius-integration-testing@"^6.0.1" from the root project

I'm not exactly sure what's going on. When I look at the source code for the repository, I see that the distributed package has a mercurius ^12.0.0 peer dependency:

// packages/mercurius-codegen/package.json
"peerDependencies": {
    "fastify": "^4.12.0",
    "graphql": "*",
    "mercurius": "^12.0.0",
    "prettier": "^2.8.3"
  }

However, when I look at the distributed code for versions 5.0.0 and 5.0.1, I see a peer dependency for Mercurius ^11.3.0:

// packages/mercurius-codegen/package.json
"peerDependencies": {
    "fastify": "^4.9.2",
    "graphql": "*",
    "mercurius": "^11.3.0",
    "prettier": "^2.7.1"
  }

I see the "^11.3.0" mercurius version if I use the "code" feature on the npm web interface and if I download "Source code
(zip)" from the GitHub web interface.

I would submit a pull request if It was immediately obvious to me how to fix this, but I'm not sure. Any idea?

Here's a diff. a is what's committed to the repo, b is what's on npm:

diff --git a/packages/mercurius-codegen/package.json b/packages/mercurius-codegen/package.json
index 9d4c579..0b9ffff 100644
--- a/packages/mercurius-codegen/package.json
+++ b/packages/mercurius-codegen/package.json
@@ -20,61 +20,59 @@
   "files": [
     "dist"
   ],
-  "scripts": {
-    "build": "tsc --removeComments && tsc --emitDeclarationOnly",
-    "dev": "tsc --watch --preserveWatchOutput",
-    "prepare": "tsc --removeComments && tsc --emitDeclarationOnly",
-    "postpublish": "gh-release",
-    "test": "cross-env TS_NODE_PROJECT=test/tsconfig.json c8 ava test/index.test.ts",
-    "test:watch": "bob-watch -w src test package.json -c \"pnpm test\"",
-    "watch": "concurrently -r pnpm:test:watch \"wait-on coverage && serve coverage/lcov-report\" \"wait-on -s 1 tcp:5000 && open-cli http://localhost:5000\""
-  },
   "dependencies": {
-    "@graphql-codegen/core": "^3.0.0",
-    "@graphql-codegen/plugin-helpers": "^4.0.0",
-    "@graphql-codegen/typed-document-node": "^3.0.0",
-    "@graphql-codegen/typescript": "^3.0.0",
-    "@graphql-codegen/typescript-operations": "^3.0.0",
-    "@graphql-codegen/typescript-resolvers": "^3.0.0",
+    "@graphql-codegen/core": "^2.6.6",
+    "@graphql-codegen/plugin-helpers": "^2.7.2",
+    "@graphql-codegen/typed-document-node": "^2.3.7",
+    "@graphql-codegen/typescript": "^2.8.2",
+    "@graphql-codegen/typescript-operations": "^2.5.7",
+    "@graphql-codegen/typescript-resolvers": "^2.7.7",
     "@graphql-tools/load-files": "^6.6.1",
-    "@graphql-tools/utils": "^9.2.0",
+    "@graphql-tools/utils": "^9.1.1",
     "@graphql-typed-document-node/core": "^3.1.1",
     "chokidar": "^3.5.3",
-    "mkdirp": "^2.1.3"
+    "mkdirp": "^1.0.4"
   },
   "devDependencies": {
     "@istanbuljs/nyc-config-typescript": "^1.0.2",
     "@types/mkdirp": "^1.0.2",
-    "@types/node": "^18.11.18",
-    "@types/prettier": "^2.7.2",
+    "@types/node": "^18.11.9",
+    "@types/prettier": "^2.7.1",
     "@types/proxyquire": "^1.3.28",
     "@types/rimraf": "^3.0.2",
-    "ava": "^5.1.1",
+    "ava": "^5.1.0",
     "bob-watch": "^0.1.2",
     "c8": "^7.12.0",
     "changesets-github-release": "^0.1.0",
     "concurrently": "^7.6.0",
     "cross-env": "^7.0.3",
-    "fastify": "^4.12.0",
+    "fastify": "^4.10.2",
     "graphql": "^16.6.0",
-    "mercurius": "^12.0.0",
-    "mercurius-codegen": "workspace:5.0.1",
+    "mercurius": "^11.3.0",
+    "mercurius-codegen": "5.0.1",
     "nyc": "15.1.0",
     "open-cli": "^7.1.0",
-    "prettier": "^2.8.3",
+    "prettier": "^2.8.0",
     "proxyquire": "^2.1.3",
     "rimraf": "^3.0.2",
-    "serve": "^14.2.0",
+    "serve": "^14.1.2",
     "tmp-promise": "^3.0.3",
     "ts-node": "^10.9.1",
-    "typescript": "^4.9.5",
+    "typescript": "^4.9.3",
     "wait-for-expect": "^3.0.2",
-    "wait-on": "^7.0.1"
+    "wait-on": "^6.0.1"
   },
   "peerDependencies": {
-    "fastify": "^4.12.0",
+    "fastify": "^4.10.2",
     "graphql": "*",
-    "mercurius": "^12.0.0",
-    "prettier": "^2.8.3"
+    "mercurius": "^11.3.0",
+    "prettier": "^2.8.0"
+  },
+  "scripts": {
+    "build": "tsc --removeComments && tsc --emitDeclarationOnly",
+    "dev": "tsc --watch --preserveWatchOutput",
+    "test": "cross-env TS_NODE_PROJECT=test/tsconfig.json c8 ava test/index.test.ts",
+    "test:watch": "bob-watch -w src test package.json -c \"pnpm test\"",
+    "watch": "concurrently -r pnpm:test:watch \"wait-on coverage && serve coverage/lcov-report\" \"wait-on -s 1 tcp:5000 && open-cli http://localhost:5000\""
   }
-}
+}
\ No newline at end of file

I see that this problem is likely due to the changesets github action. In the changeset-release/master branch I see that the Mercurius version is not getting updated in peerDepdencies. Here's the line in the file: https://github.com/mercurius-js/mercurius-typescript/blob/changeset-release/master/packages/mercurius-codegen/package.json#L77

I've never used this action before so I'm going to look into this and see if I can fix it.

Any updates on this? It seems like that branch has other dependency upgrades for mercurius (7bc8464) so it seems odd that it's stopped now, but I have limited experience with Github actions.

@PabloSzx after some digging it seems like we just need you to cut a new release here so that the peer dependency versions get updated. would you mind helping us out with that? 🙏

@mcollina any chance you would be able to cut a new release for this repo to update the dependencies?

Will do!

@kylerush I have absolutely no idea how to interact with changeset. I've never used the tool and this kind of situation is why I stayed away from it in the past.

@PabloSzx could you take a look on how to ship this?

yep on it