-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(package/gqty): allow resolve to return null (#1992)
* fix(package/gqty): allow resolve to return null * feat(test-utils): new mocked client for testing * fix(package/react): test errors
- Loading branch information
Showing
24 changed files
with
1,311 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'test-utils': minor | ||
--- | ||
|
||
A new mocked test client for testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'gqty': patch | ||
--- | ||
|
||
Allow `resolve` to return `null` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// esbuild --bundle --minify --sourcemap --outdir=dist src/index.ts | ||
|
||
import { build, type BuildOptions } from 'esbuild'; | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import tsc from 'typescript'; | ||
import packageJson from './package.json'; | ||
|
||
fs.rmSync('dist/', { force: true, recursive: true }); | ||
|
||
const baseOptions: BuildOptions = { | ||
bundle: true, | ||
entryPoints: ['src/index.ts'], | ||
external: Object.keys({ | ||
...packageJson.dependencies, | ||
...packageJson.devDependencies, | ||
...packageJson.peerDependencies, | ||
}), | ||
minify: true, | ||
platform: 'node', | ||
target: 'es2020', | ||
}; | ||
|
||
// Build ESM module | ||
build({ | ||
...baseOptions, | ||
format: 'esm', | ||
outfile: 'dist/index.mjs', | ||
}); | ||
|
||
// Build CommonJS module | ||
build({ | ||
...baseOptions, | ||
format: 'cjs', | ||
outfile: 'dist/index.cjs', | ||
}); | ||
|
||
// tsc --emitDeclarationOnly | ||
tsc | ||
.createProgram(['src/index.ts'], { | ||
baseUrl: '.', | ||
declaration: true, | ||
emitDeclarationOnly: true, | ||
forceConsistentCasingInFileNames: true, | ||
noFallthroughCasesInSwitch: true, | ||
noImplicitReturns: true, | ||
noUnusedLocals: true, | ||
noUnusedParameters: true, | ||
outDir: 'dist', | ||
rootDir: 'src', | ||
skipLibCheck: true, | ||
strict: true, | ||
target: tsc.ScriptTarget.ESNext, | ||
verbatimModuleSyntax: true, | ||
}) | ||
.emit(undefined, undefined, undefined, true); | ||
|
||
// Copy project files | ||
for (const file of ['../../LICENSE', '../../README.md', 'package.json']) { | ||
fs.copyFileSync( | ||
path.normalize(path.join(import.meta.dirname ?? '.', file)), | ||
path.join('dist', path.basename(file)) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"private": true, | ||
"name": "test-utils", | ||
"version": "0.1.0", | ||
"private": true, | ||
"license": "MIT", | ||
"author": "PabloSzx <[email protected]>", | ||
"maintainers": [ | ||
|
@@ -10,42 +10,54 @@ | |
"exports": { | ||
".": { | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
"import": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"./*": { | ||
"require": "./dist/*.js", | ||
"import": "./dist/*.mjs" | ||
"import": "./dist/*.mjs", | ||
"types": "./dist/*.d.ts" | ||
}, | ||
"./jest.config.js": "./jest.config.js" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "src/index.d.ts", | ||
"bin": { | ||
"jest-test": "bin/jest-test.js" | ||
}, | ||
"scripts": { | ||
"build": "bob-ts -i src -f interop", | ||
"build": "tsx build.ts", | ||
"prepare": "pnpm build", | ||
"start": "nodemon --exec \"concurrently pnpm:build tsc\" -w src/index.ts", | ||
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config local.jest.config.js" | ||
}, | ||
"types": "src/index.ts", | ||
"dependencies": { | ||
"@graphql-ez/fastify": "^0.12.1", | ||
"@graphql-ez/fastify-testing": "^0.4.1", | ||
"@graphql-ez/plugin-codegen": "^0.8.1", | ||
"@graphql-ez/plugin-schema": "^0.9.1", | ||
"@graphql-tools/executor-http": "^1.0.9", | ||
"@rollup/plugin-babel": "^6.0.4", | ||
"@types/jest": "^29.5.12", | ||
"cross-env": "^7.0.3", | ||
"fastify": "^4.28.1", | ||
"gqty": "workspace:^", | ||
"graphql": "^16.9.0", | ||
"graphql-ez": "^0.16.1", | ||
"graphql-scalars": "^1.23.0", | ||
"graphql-ws": "^5.16.0", | ||
"graphql-yoga": "^5.4.0", | ||
"jest": "^29.7.0", | ||
"jest-watch-typeahead": "^2.2.2", | ||
"randomstring": "^1.3.0", | ||
"wait-for-expect": "^3.0.2" | ||
}, | ||
"devDependencies": { | ||
"@graphql-ez/plugin-websockets": "^0.11.3", | ||
"@jest/types": "^29.6.3", | ||
"@types/node": "^20.14.15", | ||
"esbuild": "^0.23.0", | ||
"typescript": "^5.5.4" | ||
}, | ||
"peerDependencies": { | ||
"graphql": "*" | ||
}, | ||
|
@@ -54,15 +66,9 @@ | |
"optional": true | ||
} | ||
}, | ||
"devDependencies": { | ||
"@graphql-ez/plugin-websockets": "^0.11.3", | ||
"@jest/types": "^29.6.3", | ||
"@types/node": "^20.14.15", | ||
"@types/randomstring": "^1.3.0", | ||
"bob-esbuild-cli": "^4.0.0", | ||
"bob-ts": "^4.1.1", | ||
"concurrently": "^8.2.2", | ||
"esbuild": "^0.23.0", | ||
"tslib": "^2.6.3" | ||
"gqty": { | ||
"scalarTypes": { | ||
"Date": "string" | ||
} | ||
} | ||
} |
Oops, something went wrong.