Skip to content

Commit 4e27388

Browse files
committed
@graphiql/plugin-utils & docs, redo #3328 off main
1 parent 595525c commit 4e27388

File tree

20 files changed

+979
-171
lines changed

20 files changed

+979
-171
lines changed

packages/graphiql-plugin-code-exporter/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
],
2626
"scripts": {
2727
"dev": "vite",
28-
"build": "tsc --emitDeclarationOnly && node resources/copy-types.mjs && vite build && UMD=true vite build",
28+
"build": "vite build && UMD=true vite build",
2929
"preview": "vite preview"
3030
},
3131
"dependencies": {
@@ -38,6 +38,7 @@
3838
"@graphiql/react": "^0.19.0"
3939
},
4040
"devDependencies": {
41+
"@graphiql/plugin-utils": "^0.0.1",
4142
"@graphiql/react": "^0.19.0",
4243
"@vitejs/plugin-react": "^4.0.1",
4344
"postcss-nesting": "^10.1.7",

packages/graphiql-plugin-code-exporter/resources/copy-types.mjs

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
{
2-
"compilerOptions": {
3-
"target": "ESNext",
4-
"useDefineForClassFields": true,
5-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
6-
"allowJs": false,
7-
"skipLibCheck": true,
8-
"esModuleInterop": false,
9-
"allowSyntheticDefaultImports": true,
10-
"strict": true,
11-
"forceConsistentCasingInFileNames": true,
12-
"module": "ESNext",
13-
"moduleResolution": "Node",
14-
"resolveJsonModule": true,
15-
"isolatedModules": true,
16-
"declaration": true,
17-
"declarationDir": "types",
18-
"jsx": "react"
19-
},
2+
"extends": "@graphiql/plugin-utils/base.tsconfig.json",
203
"include": ["src"],
21-
"references": [{ "path": "./tsconfig.node.json" }]
4+
"exclude": ["node_modules"]
225
}
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
{
2-
"compilerOptions": {
3-
"composite": true,
4-
"module": "ESNext",
5-
"moduleResolution": "Node",
6-
"allowSyntheticDefaultImports": true
7-
},
2+
"extends": "@graphiql/plugin-utils/vite.config.tsconfig.json",
83
"include": ["vite.config.ts"]
94
}
Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,7 @@
11
import { defineConfig } from 'vite';
2-
import react from '@vitejs/plugin-react';
3-
import packageJSON from './package.json';
42

5-
const IS_UMD = process.env.UMD === 'true';
3+
import { graphiqlVitePlugin } from '@graphiql/plugin-utils';
64

75
export default defineConfig({
8-
plugins: [react({ jsxRuntime: 'classic' })],
9-
build: {
10-
// avoid clean cjs/es builds
11-
emptyOutDir: !IS_UMD,
12-
lib: {
13-
entry: 'src/index.tsx',
14-
fileName: 'index',
15-
name: 'GraphiQLPluginCodeExporter',
16-
formats: IS_UMD ? ['umd'] : ['cjs', 'es'],
17-
},
18-
rollupOptions: {
19-
external: [
20-
// Exclude peer dependencies and dependencies from bundle
21-
...Object.keys(packageJSON.peerDependencies),
22-
...(IS_UMD ? [] : Object.keys(packageJSON.dependencies)),
23-
],
24-
output: {
25-
chunkFileNames: '[name].[format].js',
26-
globals: {
27-
graphql: 'GraphiQL.GraphQL',
28-
react: 'React',
29-
'react-dom': 'ReactDOM',
30-
},
31-
},
32-
},
33-
commonjsOptions: {
34-
esmExternals: true,
35-
requireReturnsDefault: 'auto',
36-
},
37-
},
6+
plugins: graphiqlVitePlugin({ umdExportName: 'GraphiQLPluginCodeExporter' }),
387
});

packages/graphiql-plugin-explorer/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
],
2525
"scripts": {
2626
"dev": "vite",
27-
"build": "tsc --emitDeclarationOnly && node resources/copy-types.mjs && vite build && UMD=true vite build",
27+
"build": "vite build && UMD=true vite build",
2828
"preview": "vite preview"
2929
},
3030
"dependencies": {
@@ -40,6 +40,7 @@
4040
"@graphiql/react": "^0.19.0",
4141
"@vitejs/plugin-react": "^4.0.1",
4242
"typescript": "^4.6.3",
43-
"vite": "^4.3.9"
43+
"vite": "^4.3.9",
44+
"@graphiql/plugin-utils": "^0.0.1"
4445
}
4546
}

packages/graphiql-plugin-explorer/resources/copy-types.mjs

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
{
2-
"compilerOptions": {
3-
"target": "ESNext",
4-
"useDefineForClassFields": true,
5-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
6-
"allowJs": false,
7-
"skipLibCheck": true,
8-
"esModuleInterop": false,
9-
"allowSyntheticDefaultImports": true,
10-
"strict": true,
11-
"forceConsistentCasingInFileNames": true,
12-
"module": "ESNext",
13-
"moduleResolution": "Node",
14-
"resolveJsonModule": true,
15-
"isolatedModules": true,
16-
"declaration": true,
17-
"declarationDir": "types",
18-
"jsx": "react"
19-
},
2+
"extends": "@graphiql/plugin-utils/base.tsconfig.json",
203
"include": ["src"],
21-
"references": [{ "path": "./tsconfig.node.json" }]
4+
"exclude": ["node_modules"]
225
}
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
{
2-
"compilerOptions": {
3-
"composite": true,
4-
"module": "ESNext",
5-
"moduleResolution": "Node",
6-
"allowSyntheticDefaultImports": true
7-
},
2+
"extends": "@graphiql/plugin-utils/vite.config.tsconfig.json",
83
"include": ["vite.config.ts"]
94
}
Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,7 @@
11
import { defineConfig } from 'vite';
2-
import react from '@vitejs/plugin-react';
3-
import packageJSON from './package.json';
42

5-
const IS_UMD = process.env.UMD === 'true';
3+
import { graphiqlVitePlugin } from '@graphiql/plugin-utils';
64

75
export default defineConfig({
8-
plugins: [react({ jsxRuntime: 'classic' })],
9-
build: {
10-
// avoid clean cjs/es builds
11-
emptyOutDir: !IS_UMD,
12-
lib: {
13-
entry: 'src/index.tsx',
14-
fileName: 'index',
15-
name: 'GraphiQLPluginExplorer',
16-
formats: IS_UMD ? ['umd'] : ['cjs', 'es'],
17-
},
18-
rollupOptions: {
19-
external: [
20-
// Exclude peer dependencies and dependencies from bundle
21-
...Object.keys(packageJSON.peerDependencies),
22-
...(IS_UMD ? [] : Object.keys(packageJSON.dependencies)),
23-
],
24-
output: {
25-
chunkFileNames: '[name].[format].js',
26-
globals: {
27-
'@graphiql/react': 'GraphiQL.React',
28-
graphql: 'GraphiQL.GraphQL',
29-
react: 'React',
30-
'react-dom': 'ReactDOM',
31-
},
32-
},
33-
},
34-
commonjsOptions: {
35-
esmExternals: true,
36-
requireReturnsDefault: 'auto',
37-
},
38-
},
6+
plugins: graphiqlVitePlugin({ umdExportName: 'GraphiQLPluginExplorer' }),
397
});

0 commit comments

Comments
 (0)