Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

use changesets, update graphiql, separate graphiql package, support ESM, support graphql v16 #44

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
10 changes: 10 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": ["graphql-helix-example-*"]
}
5 changes: 5 additions & 0 deletions .changeset/fuzzy-cows-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@graphql-helix/graphiql": minor
---

add hybrid subscriptions support with UI dropdown, Thanks @n1ru4l
5 changes: 5 additions & 0 deletions .changeset/giant-pillows-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"graphql-helix": minor
---

allow client side code to throw HttpError, Thanks @mosch
6 changes: 6 additions & 0 deletions .changeset/orange-numbers-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"graphql-helix": major
"@graphql-helix/graphiql": major
---

Separate graphiql package from core
5 changes: 5 additions & 0 deletions .changeset/wild-apricots-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"graphql-helix": major
---

add ESM support, extensions are no longer accepted for deep imports
5 changes: 5 additions & 0 deletions .changeset/young-moles-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"graphql-helix": major
---

support GraphQL v16
27 changes: 13 additions & 14 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@ jobs:
uses: actions/setup-node@master
with:
node-version: 14
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn
- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-14-yarn-${{ hashFiles('yarn.lock') }}
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-14-yarn-
- name: Install Dependencies using Yarn
run: yarn install
- name: Build
run: (cd packages/core && yarn build)
${{ runner.os }}-
- name: install pnpm
run: npm i pnpm -g
- name: Install Dependencies
run: pnpm i
- name: Setup K6
run: |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
Expand All @@ -38,6 +37,6 @@ jobs:
sudo apt-get install k6
- name: Run Benchmark
run: |
yarn loadtest:start-server &
yarn wait-on tcp:5000
k6 -e GITHUB_PR=${{ github.event.number }} -e GITHUB_SHA=${{ github.sha }} -e GITHUB_TOKEN=${{secrets.GH_API_TOKEN}} -e GRAPHQL_HOSTNAME=0.0.0.0 run ./benchmark/k6.js
pnpm loadtest:start-server &
pnpm wait-on tcp:5000
k6 -e GITHUB_PR=${{ github.event.number }} -e GITHUB_SHA=${{ github.sha }} -e GITHUB_TOKEN=${{secrets.GH_API_TOKEN}} -e GRAPHQL_HOSTNAME=0.0.0.0 run ./benchmark/k6.js
27 changes: 22 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,27 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install --frozen-lockfile
- run: yarn workspace graphql-helix lint
- run: yarn workspace @graphql-helix/graphiql lint
- run: yarn workspace graphql-helix build
- run: yarn workspace graphql-helix test
- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('./pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: Cache Jest
uses: actions/cache@v2
with:
path: .cache/jest
key: ${{ runner.os }}-${{matrix.node_version}}-jest-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{matrix.node_version}}-jest-
- name: install pnpm
run: npm i pnpm -g

- run: pnpm install
- run: pnpm lint
- run: pnpm test
env:
CI: true
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Main
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node
uses: actions/setup-node@v2
with:
node-version: "14.x"
- name: Cache pnpm modules
uses: actions/cache@v2
env:
cache-name: cache-pnpm-modules
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: install pnpm
run: npm i pnpm -g
- name: Install Dependencies
run: pnpm i
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@master
with:
publish: pnpm ci:release
version: pnpm ci:version
commit: "chore(release): update monorepo packages versions"
title: "Upcoming Release Changes"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ node_modules
!.gitignore
!.github
!.prettierignore

!.changeset
!.prettierrc
!.husky
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint-staged
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ deno_dist
dist
node_modules
package-lock.json
css
*.min.js
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"jsxSingleQuote": false,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"arrowParens": "always",
"endOfLine": "lf",
"trailingComma": "es5"
}
6 changes: 6 additions & 0 deletions bob-esbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const config: import("bob-esbuild").BobConfig = {
tsc: {
dirs: ["packages/*"],
},
verbose: true,
};
13 changes: 7 additions & 6 deletions examples/context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
"start": "ts-node server"
},
"devDependencies": {
"@types/express": "^4.17.8",
"@types/express-session": "^1.17.0",
"ts-node": "^9.0.0",
"typescript": "^4.0.5"
"@types/express": "^4.17.13",
"@types/express-session": "^1.17.4",
"ts-node": "^10.2.0",
"typescript": "^4.3.5"
},
"dependencies": {
"@graphql-helix/graphiql": "workspace:^1.1.0",
"express": "^4.17.1",
"express-session": "^1.17.1",
"express-session": "^1.17.2",
"graphql": "15.4.0-experimental-stream-defer.1",
"graphql-helix": "^1.1.0"
"graphql-helix": "workspace:^1.7.0"
}
}
4 changes: 3 additions & 1 deletion examples/context/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export const schema = new GraphQLSchema({
logout: {
type: GraphQLString,
resolve: async (_root, _args, ctx) => {
await new Promise((resolve) => ctx.session.destroy(() => resolve()));
await new Promise<void>((resolve) =>
ctx.session.destroy(() => resolve())
);
return "Logged out!";
},
},
Expand Down
2 changes: 1 addition & 1 deletion examples/context/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import expressSession from "express-session";
import {
getGraphQLParameters,
processRequest,
renderGraphiQL,
shouldRenderGraphiQL,
} from "graphql-helix";
import { renderGraphiQL } from "@graphql-helix/graphiql";
import { schema } from "./schema";

const app = express();
Expand Down
12 changes: 6 additions & 6 deletions examples/csp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"start": "ts-node server"
},
"devDependencies": {
"@types/express": "^4.17.8",
"@types/helmet": "^4.0.0",
"ts-node": "^9.0.0",
"typescript": "^4.0.5"
"@types/express": "^4.17.13",
"ts-node": "^10.2.0",
"typescript": "^4.3.5"
},
"dependencies": {
"@graphql-helix/graphiql": "workspace:^1.1.0",
"express": "^4.17.1",
"graphql": "15.4.0-experimental-stream-defer.1",
"graphql-helix": "^1.1.0",
"helmet": "^4.2.0"
"graphql-helix": "workspace:^1.7.0",
"helmet": "^4.6.0"
}
}
2 changes: 1 addition & 1 deletion examples/csp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import express from "express";
import {
getGraphQLParameters,
processRequest,
renderGraphiQL,
shouldRenderGraphiQL,
} from "graphql-helix";
import { renderGraphiQL } from "@graphql-helix/graphiql";
import helmet from "helmet";
import { schema } from "./schema";

Expand Down
9 changes: 5 additions & 4 deletions examples/error-handling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
"start": "ts-node server"
},
"devDependencies": {
"@types/express": "^4.17.8",
"ts-node": "^9.0.0",
"typescript": "^4.0.5"
"@types/express": "^4.17.13",
"ts-node": "^10.2.0",
"typescript": "^4.3.5"
},
"dependencies": {
"@graphql-helix/graphiql": "workspace:^1.1.0",
"express": "^4.17.1",
"graphql": "15.4.0-experimental-stream-defer.1",
"graphql-helix": "^1.1.0"
"graphql-helix": "workspace:^1.7.0"
}
}
2 changes: 1 addition & 1 deletion examples/error-handling/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { ExecutionResult, GraphQLError } from "graphql";
import {
getGraphQLParameters,
processRequest,
renderGraphiQL,
shouldRenderGraphiQL,
} from "graphql-helix";
import { renderGraphiQL } from "@graphql-helix/graphiql";
import { schema } from "./schema";

const formatResult = (result: ExecutionResult) => {
Expand Down
9 changes: 5 additions & 4 deletions examples/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
"start": "ts-node server"
},
"devDependencies": {
"@types/express": "^4.17.8",
"ts-node": "^9.0.0",
"typescript": "^4.0.5"
"@types/express": "^4.17.13",
"ts-node": "^10.2.0",
"typescript": "^4.3.5"
},
"dependencies": {
"@graphql-helix/graphiql": "workspace:^1.1.0",
"express": "^4.17.1",
"graphql": "15.4.0-experimental-stream-defer.1",
"graphql-helix": "^1.1.0"
"graphql-helix": "workspace:^1.7.0"
}
}
2 changes: 1 addition & 1 deletion examples/express/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import express from "express";
import {
getGraphQLParameters,
processRequest,
renderGraphiQL,
shouldRenderGraphiQL,
} from "graphql-helix";
import { renderGraphiQL } from "@graphql-helix/graphiql";
import { schema } from "./schema";

const app = express();
Expand Down
14 changes: 8 additions & 6 deletions examples/fastify/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"name": "graphql-helix-example-fasitfy",
"name": "graphql-helix-example-fastify",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "ts-node server"
"start": "ts-node-dev server"
},
"devDependencies": {
"ts-node": "^9.0.0",
"typescript": "^4.0.5"
"ts-node": "^10.2.0",
"ts-node-dev": "^1.1.8",
"typescript": "^4.3.5"
},
"dependencies": {
"fastify": "^3.7.0",
"@graphql-helix/graphiql": "workspace:^1.1.0",
"fastify": "^3.20.2",
"graphql": "15.4.0-experimental-stream-defer.1",
"graphql-helix": "^1.1.0"
"graphql-helix": "workspace:^1.7.0"
}
}
13 changes: 11 additions & 2 deletions examples/fastify/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import fastify from "fastify";
import {
getGraphQLParameters,
processRequest,
renderGraphiQL,
shouldRenderGraphiQL,
} from "graphql-helix";
import { renderGraphiQL } from "@graphql-helix/graphiql";
import { schema } from "./schema";

const app = fastify();
Expand All @@ -22,7 +22,16 @@ app.route({

if (shouldRenderGraphiQL(request)) {
res.type("text/html");
res.send(renderGraphiQL({}));
res.send(
renderGraphiQL({
hybridSubscriptionTransportConfig: {
default: "sse",
config: {
sse: "/graphql",
},
},
})
);
} else {
const request = {
body: req.body,
Expand Down
Loading