Skip to content
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

Use pkgroll, bump Node, remove deprecations, improve, shorter paths, and friends #613

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
7 changes: 7 additions & 0 deletions .changeset/proud-emus-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'graphql-ws': major
---

Least supported Node version is v20

Node v10 has been deprecated for years now. There is no reason to support it. Bumping the engine to the current LTS (v20) also allows the code to be leaner and use less polyfills.
7 changes: 7 additions & 0 deletions .changeset/shaggy-geese-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'graphql-ws': major
---

Least supported `graphql` peer dependency is ^15.9.0 and ^16.9.0

Users are advised to use the latest of `graphql` because of various improvements in performance and security.
23 changes: 0 additions & 23 deletions .eslintrc.js

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:
matrix:
check:
- format
- lint
- type
- types
name: Check ${{ matrix.check }}
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
uses: the-guild-org/shared-config/.github/workflows/release-snapshot.yml@v1
with:
node-version-file: .node-version
buildScript: build
npmTag: ${{ github.event.pull_request.title == 'Upcoming Release Changes' && 'rc' || 'alpha' }}
restoreDeletedChangesets: ${{ github.event.pull_request.title == 'Upcoming Release Changes' && true || false }}
secrets:
Expand All @@ -27,7 +26,6 @@ jobs:
uses: the-guild-org/shared-config/.github/workflows/release-stable.yml@v1
with:
node-version-file: .node-version
releaseScript: release
secrets:
githubToken: ${{ secrets.BOT_GITHUB_TOKEN }}
npmToken: ${{ secrets.NPM_TOKEN }}
11 changes: 6 additions & 5 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ on:
pull_request:
branches:
- master
paths:
- website/**
# we always want new site previews because the api reference changes are in code
# paths:
# - website/**

jobs:
check-type:
name: Check type
check-types:
name: Check types
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -24,7 +25,7 @@ jobs:
working-directory: website
- name: Check
working-directory: website
run: yarn check:type
run: yarn check:types

deploy:
name: Deploy
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.DS_Store
node_modules/
lib/
umd/
dist/
out/
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v21
v22
10 changes: 10 additions & 0 deletions .yarn/patches/pkgroll-npm-2.6.1-193e78e84e.patch

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions PATCHES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Notes about dependency patches in [package.json](/package.json)

Here we collect reasons and write explanations about why some resolutions or patches have been added.

### pkgroll

1. Skip libchecking while generating type declarations because we never bundle `@types` by disabling `respectExternal` ([read more](https://github.com/Swatinem/rollup-plugin-dts?tab=readme-ov-file#what-to-expect))
113 changes: 47 additions & 66 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "graphql-ws",
"version": "5.16.2",
"description": "Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/enisdenjo/graphql-ws.git"
Expand All @@ -11,59 +12,52 @@
"license": "MIT",
"packageManager": "[email protected]",
"engines": {
"node": ">=10"
"node": ">=20"
},
"main": "lib/index.js",
"module": "lib/index.mjs",
"main": "dist/index.js",
"exports": {
".": {
"types": "./lib/index.d.ts",
"require": "./lib/index.js",
"import": "./lib/index.mjs",
"browser": "./umd/graphql-ws.js"
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.js",
"browser": "./dist/client.js"
},
"./lib/use/ws": {
"types": "./lib/use/ws.d.ts",
"require": "./lib/use/ws.js",
"import": "./lib/use/ws.mjs"
"./use/ws": {
"types": "./dist/use/ws.d.ts",
"require": "./dist/use/ws.cjs",
"import": "./dist/use/ws.js"
},
"./lib/use/uWebSockets": {
"types": "./lib/use/uWebSockets.d.ts",
"require": "./lib/use/uWebSockets.js",
"import": "./lib/use/uWebSockets.mjs"
"./use/uWebSockets": {
"types": "./dist/use/uWebSockets.d.ts",
"require": "./dist/use/uWebSockets.cjs",
"import": "./dist/use/uWebSockets.js"
},
"./lib/use/@fastify/websocket": {
"types": "./lib/use/@fastify/websocket.d.ts",
"require": "./lib/use/@fastify/websocket.js",
"import": "./lib/use/@fastify/websocket.mjs"
"./use/@fastify/websocket": {
"types": "./dist/use/@fastify/websocket.d.ts",
"require": "./dist/use/@fastify/websocket.cjs",
"import": "./dist/use/@fastify/websocket.js"
},
"./lib/use/fastify-websocket": {
"types": "./lib/use/fastify-websocket.d.ts",
"require": "./lib/use/fastify-websocket.js",
"import": "./lib/use/fastify-websocket.mjs"
"./use/bun": {
"types": "./dist/use/bun.d.ts",
"require": "./dist/use/bun.cjs",
"import": "./dist/use/bun.js"
},
"./lib/use/bun": {
"bun": "./lib/use/bun.mjs",
"types": "./lib/use/bun.d.ts",
"require": "./lib/use/bun.js",
"import": "./lib/use/bun.mjs"
},
"./lib/use/deno": {
"types": "./lib/use/deno.d.ts",
"require": "./lib/use/deno.js",
"import": "./lib/use/deno.mjs"
"./use/deno": {
"types": "./dist/use/deno.d.ts",
"require": "./dist/use/deno.cjs",
"import": "./dist/use/deno.js"
},
"./package.json": "./package.json"
},
"browser": "umd/graphql-ws.js",
"types": "lib/index.d.ts",
"browser": "./dist/client.js",
"types": "./dist/index.d.ts",
"sideEffects": [
"umd/*"
],
"files": [
"LICENSE.md",
"PROTOCOL.md",
"lib",
"dist",
"umd",
"README.md"
],
Expand All @@ -83,54 +77,41 @@
"uwebsockets"
],
"scripts": {
"build": "yarn build:esm && yarn build:cjs && yarn build:umd && yarn postbuild",
"build:cjs": "tsc -b tsconfig.cjs.json",
"build:esm": "tsc -b tsconfig.esm.json && node scripts/esm-post-process.mjs",
"build:umd": "rollup --bundleConfigAsCjs --config rollup.config.ts --configPlugin typescript && gzip umd/graphql-ws.min.js -c > umd/graphql-ws.min.js.gz",
"changeset": "changeset",
"check:format": "prettier --check .",
"check:lint": "eslint 'src'",
"check:type": "tsc --noEmit",
"format": "yarn check:format --write",
"gendocs": "typedoc --options typedoc.js src/ && node scripts/post-gendocs.mjs",
"postbuild": "node scripts/fix-declaration-directives.mjs",
"check:types": "tsc --noEmit",
"test": "vitest",
"release": "yarn build && yarn changeset publish"
"build": "pkgroll --clean-dist && rollup -c rollup.config.js && gzip umd/graphql-ws.min.js -c > umd/graphql-ws.min.js.gz",
"prepack": "yarn build",
"gendocs": "typedoc --options typedoc.js src/ && node scripts/post-gendocs.js"
},
"peerDependencies": {
"graphql": ">=0.11 <=16"
"graphql": "^15.9.0 || ^16.9.0"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.11",
"@fastify/websocket": "^9.0.0",
"@fastify/websocket": "^11.0.1",
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@types/eslint": "^8.56.10",
"@tsconfig/strictest": "^2.0.5",
"@types/glob": "^8.1.0",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"@types/ws": "^8.5.13",
"bun-types": "^1.1.4",
"eslint": "^8.57.0",
"fastify": "^4.26.2",
"fastify-websocket": "4.2.2",
"fastify": "^5.2.1",
"glob": "^10.3.12",
"graphql": "^16.8.1",
"graphql": "^16.9.0",
"jsdom": "^25.0.1",
"pkgroll": "patch:pkgroll@npm%3A2.6.1#~/.yarn/patches/pkgroll-npm-2.6.1-193e78e84e.patch",
"prettier": "^3.4.2",
"prettier-plugin-sh": "^0.14.0",
"replacestream": "^4.0.3",
"rollup": "^4.14.3",
"subscriptions-transport-ws": "^0.11.0",
"tslib": "^2.6.2",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.4.5",
"uWebSockets.js": "uNetworking/uWebSockets.js#v20.43.0",
"rollup": "^4.30.1",
"typedoc": "^0.27.6",
"typedoc-plugin-markdown": "^4.4.1",
"typescript": "^5.7.3",
"uWebSockets.js": "uNetworking/uWebSockets.js#v20.51.0",
"vitest": "^2.1.8",
"ws": "8.12.0",
"ws7": "npm:ws@^7.5.9"
"ws": "^8.18.0"
}
}
4 changes: 1 addition & 3 deletions rollup.config.ts → rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';

export default {
input: './src/client.ts',
plugins: [typescript()],
input: './dist/client.js',
output: [
{
file: './umd/graphql-ws.js',
Expand Down
66 changes: 0 additions & 66 deletions scripts/esm-post-process.mjs

This file was deleted.

22 changes: 0 additions & 22 deletions scripts/fix-declaration-directives.mjs

This file was deleted.

Loading
Loading