Skip to content

Commit

Permalink
feat!: rename and remove legacy code (#1052)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt authored Sep 1, 2024
1 parent 4db0000 commit 1cf001a
Show file tree
Hide file tree
Showing 94 changed files with 127 additions and 3,042 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ blank_issues_enabled: false
contact_links:
- name: ✋ Question
about: You have a question about something you're not sure about
url: https://github.com/jasonkuhrt/graphql-request/discussions/new
url: https://github.com/jasonkuhrt/graffle/discussions/new
36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
> [!IMPORTANT]
> The next version (`8`) of `graphql-request` is being renamed to `graffle`. It has the same base simplicity but with many fixes, enhancements, and major new type safe features.
> It is not released yet but will be in the coming weeks/months and is already usable. Learn more about it [here](https://github.com/jasonkuhrt/graffle/discussions/1026). You can see the in progress website at https://graffle.js.org.
>
> The following README is still for `graphql-request@7.x.x`
# graphql-request

Minimal GraphQL client supporting Node and browsers for scripts or simple apps.

![GitHub Action](https://github.com/jasonkuhrt/graphql-request/workflows/trunk/badge.svg) [![npm version](https://badge.fury.io/js/graphql-request.svg)](https://badge.fury.io/js/graphql-request)
![GitHub Action](https://github.com/jasonkuhrt/graffle/workflows/trunk/badge.svg) [![npm version](https://badge.fury.io/js/graffle.svg)](https://badge.fury.io/js/graffle)

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
Expand All @@ -23,8 +29,8 @@ Minimal GraphQL client supporting Node and browsers for scripts or simple apps.
- [Knowledge Base](#knowledge-base)
- [Why was the file upload feature taken away? Will it return?](#why-was-the-file-upload-feature-taken-away-will-it-return)
- [Why do I have to install `graphql`?](#why-do-i-have-to-install-graphql)
- [Do I need to wrap my GraphQL documents inside the `gql` template exported by `graphql-request`?](#do-i-need-to-wrap-my-graphql-documents-inside-the-gql-template-exported-by-graphql-request)
- [What sets `graphql-request` apart from other clients like Apollo, Relay, etc.?](#what-sets-graphql-request-apart-from-other-clients-like-apollo-relay-etc)
- [Do I need to wrap my GraphQL documents inside the `gql` template exported by `graffle`?](#do-i-need-to-wrap-my-graphql-documents-inside-the-gql-template-exported-by-graffle)
- [What sets `graffle` apart from other clients like Apollo, Relay, etc.?](#what-sets-graffle-apart-from-other-clients-like-apollo-relay-etc)
- [Project Stats](#project-stats)
- [Package Installs](#package-installs)
- [Repo Beats](#repo-beats)
Expand All @@ -43,7 +49,7 @@ Minimal GraphQL client supporting Node and browsers for scripts or simple apps.
## Install

```sh
npm add graphql-request graphql
npm add graffle graphql
```

#### TypeScript Setup
Expand All @@ -58,7 +64,7 @@ This package uses [`package.exports`](https://www.typescriptlang.org/docs/handbo
Send a GraphQL document using a static request function:

```js
import { gql, request } from 'graphql-request'
import { gql, request } from 'graffle'

const document = gql`
{
Expand All @@ -84,7 +90,7 @@ await request({
A class is available for constructing your own instances:

```js
import { gql, GraphQLClient } from 'graphql-request'
import { gql, GraphQLClient } from 'graffle'

const document = gql`
{
Expand Down Expand Up @@ -163,7 +169,7 @@ Return both the errors and data, only works with `rawRequest`.

### IgnoreOperationName

OperationName has been introduced to address issues reported here [Support operation name](https://github.com/jasonkuhrt/graphql-request/issues/64),
OperationName has been introduced to address issues reported here [Support operation name](https://github.com/jasonkuhrt/graffle/issues/64),
However, on certain occasions this information may not be needed in requests. In such cases, you might consider ignoring operationName to avoid the extraction steps currently performed by a parsing operation when the document is provided in string format.

By default the GraphQLClient tries to extract the operationName from the document.
Expand All @@ -185,28 +191,28 @@ const client = new GraphQLClient(endpoint, {

#### Why was the file upload feature taken away? Will it return?

In [this issue](https://github.com/jasonkuhrt/graphql-request/issues/500) we decided to make this library more stable and maintainable. In principal the feature is still in scope of this library and will make a return when we find time to do the feature right.
In [this issue](https://github.com/jasonkuhrt/graffle/issues/500) we decided to make this library more stable and maintainable. In principal the feature is still in scope of this library and will make a return when we find time to do the feature right.

#### Why do I have to install `graphql`?

`graphql-request` uses methods exposed by the `graphql` package to handle some internal logic. On top of that, for TypeScript users, some types are used from the `graphql` package to provide better typings.
`graffle` uses methods exposed by the `graphql` package to handle some internal logic. On top of that, for TypeScript users, some types are used from the `graphql` package to provide better typings.

#### Do I need to wrap my GraphQL documents inside the `gql` template exported by `graphql-request`?
#### Do I need to wrap my GraphQL documents inside the `gql` template exported by `graffle`?

No. It is there for convenience so that you can get the tooling support like automatic formatting and syntax highlighting. You can use `gql` from `graphql-tag` if you need it for some reason too.

#### What sets `graphql-request` apart from other clients like Apollo, Relay, etc.?
#### What sets `graffle` apart from other clients like Apollo, Relay, etc.?

`graphql-request` is the most minimal and simplest to use GraphQL client. It's perfect for small scripts or simple apps.
`graffle` is the most minimal and simplest to use GraphQL client. It's perfect for small scripts or simple apps.

Compared to GraphQL clients like Apollo or Relay, `graphql-request` doesn't have a built-in cache and has no integrations for frontend frameworks. The goal is to keep the package and API as minimal as possible.
Compared to GraphQL clients like Apollo or Relay, `graffle` doesn't have a built-in cache and has no integrations for frontend frameworks. The goal is to keep the package and API as minimal as possible.

## Project Stats

### Package Installs

<a href="https://npm-compare.com/graphql-request#timeRange=FIVE_YEARS" target="_blank">
<img src="https://npm-compare.com/img/npm-trend/FIVE_YEARS/graphql-request.png" width="100%" alt="NPM Usage Trend of graphql-request" />
<a href="https://npm-compare.com/graffle#timeRange=FIVE_YEARS" target="_blank">
<img src="https://npm-compare.com/img/npm-trend/FIVE_YEARS/graffle.png" width="100%" alt="NPM Usage Trend of graffle" />
</a>

### Repo Beats
Expand Down
2 changes: 1 addition & 1 deletion examples/$generated-clients/SocialStudies/Client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createPrefilled } from '../../../src/entrypoints/graffle/client.js'
import { createPrefilled } from '../../../src/entrypoints/client.js'

import { $defaultSchemaUrl, $Index } from './SchemaRuntime.js'

Expand Down
2 changes: 1 addition & 1 deletion examples/$generated-clients/SocialStudies/Scalar.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from '../../../src/entrypoints/graffle/scalars.js'
export * from '../../../src/entrypoints/scalars.js'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type * as $ from '../../../src/entrypoints/graffle/schema.js'
import type * as $ from '../../../src/entrypoints/schema.js'
import type * as $Scalar from './Scalar.ts'

// ------------------------------------------------------------ //
Expand Down
2 changes: 1 addition & 1 deletion examples/$generated-clients/SocialStudies/SchemaRuntime.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */

import * as $ from '../../../src/entrypoints/graffle/schema.js'
import * as $ from '../../../src/entrypoints/schema.js'
import * as $Scalar from './Scalar.js'

export const $defaultSchemaUrl = new URL('https://countries.trevorblades.com/graphql')
Expand Down
4 changes: 2 additions & 2 deletions examples/$generated-clients/SocialStudies/Select.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { ResultSet, SelectionSet } from '../../../src/entrypoints/graffle/schema.js'
import type { ResultSet, SelectionSet } from '../../../src/entrypoints/schema.js'
import type { Index } from './Index.js'

// Runtime
// -------

import { createSelect } from '../../../src/entrypoints/graffle/client.js'
import { createSelect } from '../../../src/entrypoints/client.js'
export const Select = createSelect(`default`)

// Buildtime
Expand Down
31 changes: 0 additions & 31 deletions examples/legacy/configuration-fetch-options.ts

This file was deleted.

9 changes: 0 additions & 9 deletions examples/legacy/configuration-incremental-endpoint.ts

This file was deleted.

16 changes: 0 additions & 16 deletions examples/legacy/configuration-incremental-request-headers.ts

This file was deleted.

16 changes: 0 additions & 16 deletions examples/legacy/configuration-request-json-serializer.ts

This file was deleted.

60 changes: 0 additions & 60 deletions examples/legacy/graphql-batching-requests.ts

This file was deleted.

25 changes: 0 additions & 25 deletions examples/legacy/graphql-document-variables.ts

This file was deleted.

26 changes: 0 additions & 26 deletions examples/legacy/graphql-mutations.ts

This file was deleted.

26 changes: 0 additions & 26 deletions examples/legacy/other-error-handling.ts

This file was deleted.

Loading

0 comments on commit 1cf001a

Please sign in to comment.