Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .changeset/flat-lies-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphiql/react': minor
'@graphiql/plugin-explorer': minor
'@graphiql/plugin-code-exporter': minor
---

generate types with `vite-plugin-dts`
2 changes: 1 addition & 1 deletion examples/monaco-graphql-react-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"devDependencies": {
"@vitejs/plugin-react": "^4.3.1",
"vite": "^5.3.5",
"vite": "^5.4.0",
"vite-plugin-monaco-editor": "^1.1.0"
},
"scripts": {
Expand Down
16 changes: 8 additions & 8 deletions packages/graphiql-plugin-code-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"author": "LekoArts",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "types/index.d.ts",
"types": "dist/index.d.ts",
"license": "MIT",
"keywords": [
"react",
Expand All @@ -19,15 +19,14 @@
"explorer"
],
"files": [
"dist",
"src",
"types"
"dist"
],
"scripts": {
"prebuild": "rimraf dist types",
"dev": "vite",
"build": "tsc --emitDeclarationOnly && node resources/copy-types.mjs && vite build && UMD=true vite build",
"preview": "vite preview"
"build": "vite build && UMD=true vite build",
"prebuild": "yarn types:check",
"postbuild": "cp src/graphiql-code-exporter.d.ts dist/graphiql-code-exporter.d.ts",
"types:check": "tsc --noEmit"
},
"dependencies": {
"graphiql-code-exporter": "^3.0.3"
Expand All @@ -46,6 +45,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^4.6.3",
"vite": "^5.3.5"
"vite": "^5.4.0",
"vite-plugin-dts": "^4.0.1"
}
}
11 changes: 0 additions & 11 deletions packages/graphiql-plugin-code-exporter/resources/copy-types.mjs

This file was deleted.

4 changes: 1 addition & 3 deletions packages/graphiql-plugin-code-exporter/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"declaration": true,
"declarationDir": "types",
"jsx": "react"
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"include": ["src"]
}
9 changes: 0 additions & 9 deletions packages/graphiql-plugin-code-exporter/tsconfig.node.json

This file was deleted.

7 changes: 5 additions & 2 deletions packages/graphiql-plugin-code-exporter/vite.config.mts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import packageJSON from './package.json';
import dts from 'vite-plugin-dts';

const IS_UMD = process.env.UMD === 'true';

export default defineConfig({
plugins: [react({ jsxRuntime: 'classic' })],
plugins: [react({ jsxRuntime: 'classic' }), dts()],
build: {
minify: IS_UMD ? 'esbuild' : false,
minify: IS_UMD
? 'terser' // produce better bundle size than esbuild
: false,
// avoid clean cjs/es builds
emptyOutDir: !IS_UMD,
lib: {
Expand Down
16 changes: 8 additions & 8 deletions packages/graphiql-plugin-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "types/index.d.ts",
"types": "dist/index.d.ts",
"license": "MIT",
"keywords": [
"react",
Expand All @@ -18,15 +18,14 @@
"explorer"
],
"files": [
"dist",
"src",
"types"
"dist"
],
"scripts": {
"prebuild": "rimraf dist types",
"dev": "vite",
"build": "tsc --emitDeclarationOnly && node resources/copy-types.mjs && vite build && UMD=true vite build",
"preview": "vite preview"
"build": "vite build && UMD=true vite build",
"postbuild": "cp src/graphiql-explorer.d.ts dist/graphiql-explorer.d.ts",
"prebuild": "yarn types:check",
"types:check": "tsc --noEmit"
},
"dependencies": {
"graphiql-explorer": "^0.9.0"
Expand All @@ -44,7 +43,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^4.6.3",
"vite": "^5.3.5",
"vite": "^5.4.0",
"vite-plugin-dts": "^4.0.1",
"vite-plugin-svgr": "^4.2.0"
}
}
11 changes: 0 additions & 11 deletions packages/graphiql-plugin-explorer/resources/copy-types.mjs

This file was deleted.

4 changes: 1 addition & 3 deletions packages/graphiql-plugin-explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"declaration": true,
"declarationDir": "types",
"jsx": "react"
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"include": ["src"]
}
9 changes: 0 additions & 9 deletions packages/graphiql-plugin-explorer/tsconfig.node.json

This file was deleted.

6 changes: 5 additions & 1 deletion packages/graphiql-plugin-explorer/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
import packageJSON from './package.json';
import dts from 'vite-plugin-dts';

const IS_UMD = process.env.UMD === 'true';

Expand All @@ -14,9 +15,12 @@ export default defineConfig({
titleProp: true,
},
}),
dts(),
],
build: {
minify: IS_UMD ? 'esbuild' : false,
minify: IS_UMD
? 'terser' // produce better bundle size than esbuild
: false,
// avoid clean cjs/es builds
emptyOutDir: !IS_UMD,
lib: {
Expand Down
18 changes: 9 additions & 9 deletions packages/graphiql-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./types/index.d.ts"
"types": "./dist/types/index.d.ts"
},
"./font/roboto.css": "./font/roboto.css",
"./font/fira-code.css": "./font/fira-code.css",
"./dist/style.css": "./dist/style.css"
},
"types": "types/index.d.ts",
"types": "dist/types/index.d.ts",
"keywords": [
"react",
"graphql",
Expand All @@ -33,14 +33,13 @@
],
"files": [
"dist",
"font",
"src",
"types"
"font"
],
"scripts": {
"prebuild": "rimraf dist types",
"dev": "concurrently 'tsc --emitDeclarationOnly --watch' 'vite build --watch'",
"build": "tsc --emitDeclarationOnly && vite build"
"dev": "vite",
"build": "vite build",
"prebuild": "yarn types:check",
"types:check": "tsc --noEmit"
},
"peerDependencies": {
"graphql": "^15.5.0 || ^16.0.0",
Expand Down Expand Up @@ -75,7 +74,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^4.6.3",
"vite": "^5.3.5",
"vite": "^5.4.0",
"vite-plugin-dts": "^4.0.1",
"vite-plugin-svgr": "^4.2.0"
}
}
11 changes: 0 additions & 11 deletions packages/graphiql-react/tsconfig.cjs.json

This file was deleted.

7 changes: 2 additions & 5 deletions packages/graphiql-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"declaration": true,
"declarationDir": "types",
"outDir": "tsc"
"declaration": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"include": ["src"]
}
8 changes: 0 additions & 8 deletions packages/graphiql-react/tsconfig.node.json

This file was deleted.

7 changes: 6 additions & 1 deletion packages/graphiql-react/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
import postCssNestingPlugin from 'postcss-nesting';
import packageJSON from './package.json';
import dts from 'vite-plugin-dts';

export default defineConfig({
plugins: [
Expand All @@ -13,6 +14,10 @@ export default defineConfig({
titleProp: true,
},
}),
dts({
outDir: ['dist/types'],
exclude: ['**/*.spec.{ts,tsx}', '**/__tests__/'],
}),
],
css: {
postcss: {
Expand All @@ -37,7 +42,7 @@ export default defineConfig({
),
],
output: {
chunkFileNames: '[name].[format].js',
chunkFileNames: '[format]/[name].js',
},
},
},
Expand Down
6 changes: 4 additions & 2 deletions packages/graphiql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"cypress-open": "yarn dev 'cypress open'",
"build": "vite build && UMD=true vite build",
"dev": "concurrently 'cross-env PORT=8080 node test/e2e-server' vite",
"prebuild": "yarn types:check",
"types:check": "tsc --noEmit",
"e2e": "yarn e2e-server 'cypress run'",
"e2e-server": "start-server-and-test 'cross-env PORT=8080 node test/e2e-server' 'http-get://localhost:8080/graphql?query={test { id }}'"
},
Expand Down Expand Up @@ -65,9 +67,9 @@
"start-server-and-test": "^1.10.11",
"subscriptions-transport-ws": "0.11.0",
"typescript": "^4.6.3",
"vite": "^5.3.5",
"vite": "^5.4.0",
"vite-plugin-commonjs": "^0.10.1",
"vite-plugin-dts": "^3.9.1",
"vite-plugin-dts": "^4.0.1",
"ws": "8.17.1"
}
}
31 changes: 0 additions & 31 deletions packages/graphiql/tsconfig.esm.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/graphiql/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const umdConfig = defineConfig({
// To bundle `const { createClient } = require('graphql-ws')` in `createWebsocketsFetcherFromUrl` function
plugins: [commonjs()],
build: {
minify: 'terser', // produce less bundle size
sourcemap: true,
emptyOutDir: false,
lib: {
Expand Down
Loading