Skip to content

Commit

Permalink
feat!: remove support for CommonJS (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops authored Oct 30, 2023
1 parent d6298a3 commit c3a309f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 77 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Minimal GraphQL client supporting Node and browsers for scripts or simple apps

- Most **simple & lightweight** GraphQL client
- Promise-based API (works with `async` / `await`)
- ESM native package (CJS build is included for now as well, but will eventually be removed)
- [Pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
- First class TypeScript support
- Including `TypedDocumentNode`
- Isomorphic (works in both Nodejs and Browsers)
Expand Down Expand Up @@ -94,15 +94,14 @@ await client.request(document)
- [Cancellation](./examples/request-cancellation.ts)
- [Headers Per Request (static)](./examples/request-headers-static-per-request.ts)
- [Headers Per Request (dynamic)](./examples/request-headers-dynamic-per-request.ts)
- [Cookie support for Nodejs](./examples/request-cookie-support-for-node.ts)
- [Handle Raw Response](./examples/request-handle-raw-response.ts)
- GraphQL:
- [Document Variables](./examples/graphql-document-variables.ts)
- [Mutation](./examples/graphql-mutations.ts)
- [Batching Requests](./examples/graphql-batching-requests.ts)
- Configuration:
- [Fetch: Passing Options](./examples/configuration-fetch-options.ts)
- [Fetch: Use custom function](./examples/configuration-fetch-custom-function.ts)
- [Fetch: Use custom function (e.g. cookie support)](./examples/configuration-fetch-custom-function.ts)
- [Custom JSON Serializer](./examples/configuration-request-json-serializer.ts)
- [Incremental: Set Endpoint](./examples/configuration-incremental-endpoint.ts)
- [Incremental: Set Request Headers](./examples/configuration-incremental-request-headers.ts)
Expand All @@ -113,7 +112,6 @@ await client.request(document)
- Other:
- [Middleware](./examples/other-middleware.ts)
- [Error Handling](./examples/other-error-handling.ts)
- [OCommonJS Support](./examples/other-package-commonjs.ts)

## Node Version Support

Expand Down
23 changes: 0 additions & 23 deletions examples/other-package-commonjs.ts

This file was deleted.

27 changes: 0 additions & 27 deletions examples/request-cookie-support-for-node.ts

This file was deleted.

14 changes: 3 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@
"name": "graphql-request",
"version": "0.0.0-dripip",
"type": "module",
"main": "./build/cjs/index.js",
"exports": {
".": {
"require": {
"types": "./build/cjs/index.d.ts",
"default": "./build/cjs/index.js"
},
"import": {
"types": "./build/esm/index.d.ts",
"default": "./build/esm/index.js"
"types": "./build/index.d.ts",
"default": "./build/index.js"
}
}
},
"types": "./build/esm/index.d.ts",
"packageManager": "pnpm@8.10.0",
"files": [
"build",
Expand Down Expand Up @@ -51,9 +45,7 @@
"check:lint": "eslint . --ext .ts,.tsx --max-warnings 0",
"prepublishOnly": "pnpm build",
"build:docs": "doctoc README.md --notitle && prettier --write README.md",
"build": "pnpm clean && pnpm build:cjs && pnpm build:esm",
"build:cjs": "pnpm tsc --project tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > build/cjs/package.json",
"build:esm": "pnpm tsc --project tsconfig.esm.json",
"build": "pnpm clean && pnpm tsc --project tsconfig.build.json",
"clean": "tsc --build --clean && rm -rf build",
"test": "vitest",
"test:coverage": "pnpm test -- --coverage",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.esm.json → tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "build/esm",
"outDir": "build",
"rootDir": "src"
},
"include": ["src"],
Expand Down
11 changes: 0 additions & 11 deletions tsconfig.cjs.json

This file was deleted.

0 comments on commit c3a309f

Please sign in to comment.