Skip to content

fix(graphql-request): use same version in all packages #1623

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @type {import('jest').Config} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
preset: 'ts-jest/presets/js-with-ts',
transformIgnorePatterns: ['/node_modules/(?!(graphql-request|@superfluid-finance/sdk-core)/)'],
reporters: [
'default',
[
Expand Down
4 changes: 0 additions & 4 deletions packages/integration-test/babel.config.js

This file was deleted.

19 changes: 0 additions & 19 deletions packages/integration-test/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
// The error ReferenceError: crypto is not defined occurs because the Node.js environment needs the crypto module to be explicitly available.
// For Node.js versions before 19, you need to add the crypto global explicitly.
const { webcrypto } = require('crypto');
global.crypto = webcrypto;

const jestCommonConfig = require('../../jest.config');

/** @type {import('jest').Config} */
module.exports = {
...jestCommonConfig,
transform: {
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.json',
},
],
'^.+\\.js$': ['babel-jest', { configFile: './babel.config.js' }],
},
transformIgnorePatterns: ['/node_modules/(?!(graphql-request|@superfluid-finance/sdk-core)/)'],
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
};
6 changes: 0 additions & 6 deletions packages/integration-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
"test:lit": "jest test/lit-protocol.test.ts --forceExit"
},
"devDependencies": {
"@babel/core": "7.23.9",
"@babel/plugin-transform-modules-commonjs": "7.23.3",
"@babel/plugin-transform-runtime": "7.23.3",
"@babel/preset-env": "7.23.3",
"@babel/runtime": "7.26.10",
"@lit-protocol/lit-node-client": "7.0.5",
"@requestnetwork/advanced-logic": "0.54.0",
"@requestnetwork/currency": "0.28.0",
Expand All @@ -66,7 +61,6 @@
"@requestnetwork/web3-signature": "0.9.0",
"@types/jest": "29.5.6",
"@types/node": "18.11.9",
"babel-jest": "29.7.0",
"ethers": "5.7.2",
"jest": "29.5.0",
"jest-junit": "16.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/payment-detection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@
"@requestnetwork/utils": "0.54.0",
"ethers": "5.7.2",
"graphql": "16.8.1",
"graphql-request": "6.1.0",
"graphql-request": "7.1.2",
"graphql-tag": "2.12.6",
"satoshi-bitcoin": "1.0.4",
"tslib": "2.8.1"
},
"devDependencies": {
"@babel/helper-get-function-arity": "7.16.7",
"@graphql-codegen/cli": "4.0.1",
"@graphql-codegen/typescript": "4.0.1",
"@graphql-codegen/typescript-document-nodes": "4.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/payment-processor/src/payment/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export class UnsupportedCurrencyNetwork extends Error {
* Utility to get the default window.ethereum provider, or throws an error.
*/
export function getProvider(): providers.Web3Provider {
if (typeof window !== 'undefined' && 'ethereum' in window) {
return new ethers.providers.Web3Provider((window as any).ethereum);
if ('ethereum' in globalThis) {
return new ethers.providers.Web3Provider((globalThis as any).ethereum);
}
Comment on lines -31 to 33
Copy link
Member Author

@alexandre-abrioux alexandre-abrioux May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, we would get the following error during build:

✖  @requestnetwork/payment-processor:build
$ tsc -b tsconfig.build.json
       src/payment/utils.ts(31,14): error TS2304: Cannot find name 'window'.

I'm guessing it worked before because graphql-request v6 was declaring a window type globally.

throw new Error('ethereum not found, you must pass your own web3 provider');
}
Expand Down
4 changes: 0 additions & 4 deletions packages/request-node/babel.config.js

This file was deleted.

14 changes: 0 additions & 14 deletions packages/request-node/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,4 @@ const jestCommonConfig = require('../../jest.config');
/** @type {import('jest').Config} */
module.exports = {
...jestCommonConfig,
transform: {
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.json',
},
],
'^.+\\.js$': ['babel-jest', { configFile: './babel.config.js' }],
},
transformIgnorePatterns: ['/node_modules/(?!(graphql-request|@superfluid-finance/sdk-core)/)'],
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
};
8 changes: 1 addition & 7 deletions packages/request-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"ethers": "5.7.2",
"express": "4.21.0",
"graphql": "16.8.1",
"graphql-request": "6.1.0",
"graphql-request": "7.1.2",
"http-shutdown": "1.2.2",
"http-status-codes": "2.1.4",
"morgan": "1.10.0",
Expand All @@ -69,19 +69,13 @@
"yargs": "17.6.2"
},
"devDependencies": {
"@babel/core": "7.23.9",
"@babel/plugin-transform-modules-commonjs": "7.23.3",
"@babel/plugin-transform-runtime": "7.23.3",
"@babel/preset-env": "7.23.3",
"@babel/runtime": "7.26.10",
"@types/cors": "2.8.9",
"@types/express": "4.17.17",
"@types/jest": "29.5.6",
"@types/morgan": "1.9.9",
"@types/node": "18.11.9",
"@types/supertest": "2.0.10",
"@types/yargs": "17.0.14",
"babel-jest": "29.7.0",
"jest": "29.5.0",
"jest-junit": "16.0.0",
"msw": "2.0.6",
Expand Down
Loading