Skip to content

Commit

Permalink
patch: Mark @urql/core as a peer as well as a regular dependency (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed May 3, 2024
1 parent e5c32da commit 0204e04
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 21 deletions.
18 changes: 18 additions & 0 deletions .changeset/two-hounds-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@urql/exchange-request-policy': minor
'@urql/introspection': minor
'@urql/exchange-graphcache': minor
'@urql/preact': minor
'@urql/svelte': minor
'@urql/exchange-persisted': minor
'urql': minor
'@urql/exchange-populate': minor
'@urql/exchange-context': minor
'@urql/exchange-execute': minor
'@urql/exchange-refocus': minor
'@urql/vue': minor
'@urql/exchange-retry': minor
'@urql/exchange-auth': minor
---

Mark `@urql/core` as a peer dependency as well as a regular dependency.
5 changes: 4 additions & 1 deletion exchanges/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@
"prepare": "node ../../scripts/prepare/index.js",
"prepublishOnly": "run-s clean build"
},
"peerDependencies": {
"@urql/core": "^5.0.0"
},
"dependencies": {
"@urql/core": ">=5.0.0",
"@urql/core": "^5.0.0",
"wonka": "^6.3.2"
},
"devDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion exchanges/context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@
"prepare": "node ../../scripts/prepare/index.js",
"prepublishOnly": "run-s clean build"
},
"peerDependencies": {
"@urql/core": "^5.0.0"
},
"dependencies": {
"@urql/core": ">=5.0.0",
"@urql/core": "^5.0.0",
"wonka": "^6.3.2"
},
"devDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions exchanges/execute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@
"prepublishOnly": "run-s clean build"
},
"dependencies": {
"@urql/core": ">=5.0.0",
"@urql/core": "^5.0.0",
"wonka": "^6.3.2"
},
"peerDependencies": {
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
"@urql/core": "^5.0.0",
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
},
"devDependencies": {
"@urql/core": "workspace:*",
Expand Down
5 changes: 4 additions & 1 deletion exchanges/graphcache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@
"prepare": "node ../../scripts/prepare/index.js",
"prepublishOnly": "run-s clean build"
},
"peerDependencies": {
"@urql/core": "^5.0.0"
},
"dependencies": {
"@0no-co/graphql.web": "^1.0.5",
"@urql/core": ">=5.0.0",
"@urql/core": "^5.0.0",
"wonka": "^6.3.2"
},
"devDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion exchanges/persisted/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@
"prepare": "node ../../scripts/prepare/index.js",
"prepublishOnly": "run-s clean build"
},
"peerDependencies": {
"@urql/core": "^5.0.0"
},
"dependencies": {
"@urql/core": ">=5.0.0",
"@urql/core": "^5.0.0",
"wonka": "^6.3.2"
},
"devDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions exchanges/populate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@
"prepublishOnly": "run-s clean build"
},
"dependencies": {
"@urql/core": ">=5.0.0",
"@urql/core": "^5.0.0",
"wonka": "^6.3.2"
},
"peerDependencies": {
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
"@urql/core": "^5.0.0",
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
},
"devDependencies": {
"@urql/core": "workspace:*",
Expand Down
5 changes: 4 additions & 1 deletion exchanges/refocus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@
"@types/react": "^17.0.4",
"graphql": "^16.0.0"
},
"peerDependencies": {
"@urql/core": "^5.0.0"
},
"dependencies": {
"@urql/core": ">=5.0.0",
"@urql/core": "^5.0.0",
"wonka": "^6.3.2"
},
"publishConfig": {
Expand Down
5 changes: 4 additions & 1 deletion exchanges/request-policy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@
"@urql/core": "workspace:*",
"graphql": "^16.0.0"
},
"peerDependencies": {
"@urql/core": "^5.0.0"
},
"dependencies": {
"@urql/core": ">=5.0.0",
"@urql/core": "^5.0.0",
"wonka": "^6.3.2"
},
"publishConfig": {
Expand Down
5 changes: 4 additions & 1 deletion exchanges/retry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@
"@urql/core": "workspace:*",
"graphql": "^16.0.0"
},
"peerDependencies": {
"@urql/core": "^5.0.0"
},
"dependencies": {
"@urql/core": ">=5.0.0",
"@urql/core": "^5.0.0",
"wonka": "^6.3.2"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/introspection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"graphql": "^16.0.0"
},
"peerDependencies": {
"graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
},
"dependencies": {},
"publishConfig": {
Expand Down
1 change: 1 addition & 0 deletions packages/preact-urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"preact": "^10.13.0"
},
"peerDependencies": {
"@urql/core": "^5.0.0",
"preact": ">= 10.0.0"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/react-urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"vite": "^3.2.4"
},
"peerDependencies": {
"@urql/core": "^5.0.0",
"react": ">= 16.8.0"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/svelte-urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"prepublishOnly": "run-s clean build"
},
"peerDependencies": {
"@urql/core": "^5.0.0",
"svelte": "^3.0.0 || ^4.0.0"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/vue-urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"vue": "^3.2.47"
},
"peerDependencies": {
"@urql/core": "^5.0.0",
"vue": "^2.7.0 || ^3.0.0"
},
"dependencies": {
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions scripts/prepare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,28 @@ invariant(
'package.json:files must include "dist" and "LICENSE"'
);

if (pkg.dependencies && pkg.dependencies['@urql/core']) {
invariant(
!!pkg.peerDependencies && !!pkg.peerDependencies['@urql/core'],
'package.json:peerDependencies must contain @urql/core.'
);
}

if (pkg.peerDependencies && pkg.peerDependencies['@urql/core']) {
invariant(
!!pkg.dependencies && !!pkg.dependencies['@urql/core'],
'package.json:dependencies must contain @urql/core.'
);
}

for (const key in pkg.peerDependencies || {}) {
const dependency = pkg.peerDependencies[key];
invariant(
key !== 'react' || key !== 'preact' || !dependency.includes('>='),
`Peer Dependency "${key}" must not contain ">=" (greater than) range`
);
}

if (hasReact && !hasNext) {
invariant(
!pkg.exports,
Expand Down

0 comments on commit 0204e04

Please sign in to comment.