@quilted/create 0.1.81 → 0.1.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/templates/app-graphql/App.tsx +5 -11
- package/templates/app-graphql/browser.tsx +6 -1
- package/templates/app-graphql/features/start/Start/Start.test.tsx +3 -1
- package/templates/app-graphql/features/start/Start/Start.tsx +1 -1
- package/templates/app-graphql/features/start/Start/StartQuery.graphql +3 -1
- package/templates/app-graphql/server/graphql.ts +15 -20
- package/templates/app-graphql/server.tsx +7 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @quilted/create
|
|
2
2
|
|
|
3
|
+
## 0.1.83
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b8b0e5e2`](https://github.com/lemonmade/quilt/commit/b8b0e5e2bac4192d8e6b17b93868acec8524c611) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix some more GraphQL template type issues
|
|
8
|
+
|
|
9
|
+
## 0.1.82
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`c40bc1de`](https://github.com/lemonmade/quilt/commit/c40bc1deb3e3b48c30c881a4dd7bd98e2807a596) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix more GraphQL template issues
|
|
14
|
+
|
|
3
15
|
## 0.1.81
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -4,11 +4,7 @@ import {HTML} from '@quilted/quilt/html';
|
|
|
4
4
|
import {Routing, useRoutes} from '@quilted/quilt/navigate';
|
|
5
5
|
import {Localization, useLocaleFromEnvironment} from '@quilted/quilt/localize';
|
|
6
6
|
import {type PropsWithChildren} from '@quilted/quilt/react/tools';
|
|
7
|
-
import {
|
|
8
|
-
GraphQLContext,
|
|
9
|
-
createGraphQLHttpFetch,
|
|
10
|
-
type GraphQLFetch,
|
|
11
|
-
} from '@quilted/quilt/graphql';
|
|
7
|
+
import {GraphQLContext, type GraphQLFetch} from '@quilted/quilt/graphql';
|
|
12
8
|
|
|
13
9
|
import {ReactQueryContext} from '@quilted/react-query';
|
|
14
10
|
import {QueryClient} from '@tanstack/react-query';
|
|
@@ -25,7 +21,7 @@ import {
|
|
|
25
21
|
} from './shared/context.ts';
|
|
26
22
|
|
|
27
23
|
export interface AppProps extends AppContextType {
|
|
28
|
-
fetchGraphQL
|
|
24
|
+
fetchGraphQL: GraphQLFetch;
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
// The root component for your application. You will typically render any
|
|
@@ -61,16 +57,14 @@ function Routes() {
|
|
|
61
57
|
// This component renders any app-wide context.
|
|
62
58
|
function AppContext({
|
|
63
59
|
children,
|
|
64
|
-
fetchGraphQL
|
|
60
|
+
fetchGraphQL,
|
|
65
61
|
...context
|
|
66
62
|
}: PropsWithChildren<AppProps>) {
|
|
67
|
-
const {
|
|
63
|
+
const {queryClient} = useMemo(() => {
|
|
68
64
|
return {
|
|
69
|
-
fetchGraphQL:
|
|
70
|
-
customFetchGraphQL ?? createGraphQLHttpFetch({url: '/api/graphql'}),
|
|
71
65
|
queryClient: new QueryClient(),
|
|
72
66
|
};
|
|
73
|
-
}, [
|
|
67
|
+
}, []);
|
|
74
68
|
|
|
75
69
|
return (
|
|
76
70
|
<GraphQLContext fetch={fetchGraphQL}>
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import '@quilted/quilt/globals';
|
|
2
|
+
|
|
2
3
|
import {hydrateRoot} from 'react-dom/client';
|
|
4
|
+
import {createGraphQLFetchOverHTTP} from '@quilted/quilt/graphql';
|
|
3
5
|
|
|
4
6
|
import {App} from './App.tsx';
|
|
5
7
|
|
|
6
8
|
const element = document.querySelector('#app')!;
|
|
7
9
|
|
|
8
|
-
hydrateRoot(
|
|
10
|
+
hydrateRoot(
|
|
11
|
+
element,
|
|
12
|
+
<App fetchGraphQL={createGraphQLFetchOverHTTP({url: '/api/graphql'})} />,
|
|
13
|
+
);
|
|
@@ -9,7 +9,9 @@ import startQuery from './StartQuery.graphql';
|
|
|
9
9
|
describe('<Start />', () => {
|
|
10
10
|
it('welcomes the user with their name', async () => {
|
|
11
11
|
const name = 'Winston';
|
|
12
|
-
const graphql = new GraphQLController([
|
|
12
|
+
const graphql = new GraphQLController([
|
|
13
|
+
fillGraphQL(startQuery, {me: {name}}),
|
|
14
|
+
]);
|
|
13
15
|
|
|
14
16
|
const start = await renderApp(<Start />, {graphql});
|
|
15
17
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import {graphql} from 'graphql';
|
|
2
|
+
import {
|
|
3
|
+
toGraphQLSource,
|
|
4
|
+
type GraphQLFetch,
|
|
5
|
+
type GraphQLResult,
|
|
6
|
+
} from '@quilted/quilt/graphql';
|
|
2
7
|
import {
|
|
3
8
|
createGraphQLSchema,
|
|
4
9
|
createGraphQLResolverBuilder,
|
|
5
10
|
} from '@quilted/quilt/graphql/server';
|
|
6
|
-
import type {GraphQLResult, GraphQLSource} from '@quilted/quilt/graphql';
|
|
7
11
|
|
|
8
12
|
import schemaSource, {type Schema} from '../graphql/schema.ts';
|
|
9
13
|
|
|
@@ -26,22 +30,13 @@ const Query = createQueryResolver({
|
|
|
26
30
|
|
|
27
31
|
const schema = createGraphQLSchema(schemaSource, {Query, Person});
|
|
28
32
|
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const result = await graphql({
|
|
40
|
-
schema,
|
|
41
|
-
source: operation,
|
|
42
|
-
operationName,
|
|
43
|
-
variableValues: variables,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return result as GraphQLResult<Data>;
|
|
47
|
-
}
|
|
33
|
+
export const performGraphQLOperation: GraphQLFetch =
|
|
34
|
+
async function performGraphQLOperation(operation, options) {
|
|
35
|
+
const result = await graphql({
|
|
36
|
+
schema,
|
|
37
|
+
source: toGraphQLSource(operation),
|
|
38
|
+
variableValues: options?.variables as Readonly<{}>,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return result as GraphQLResult<any>;
|
|
42
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import '@quilted/quilt/globals';
|
|
2
2
|
|
|
3
3
|
import {RequestRouter, JSONResponse} from '@quilted/quilt/request-router';
|
|
4
|
-
import {type GraphQLFetch} from '@quilted/quilt/graphql';
|
|
5
4
|
import {BrowserAssets} from '@quilted/quilt/magic/assets';
|
|
6
5
|
|
|
7
6
|
const router = new RequestRouter();
|
|
@@ -29,23 +28,13 @@ router.get(async (request) => {
|
|
|
29
28
|
import('@quilted/quilt/server'),
|
|
30
29
|
]);
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
return result;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const response = await renderToResponse(<App fetchGraphQL={fetchGraphQL} />, {
|
|
46
|
-
request,
|
|
47
|
-
assets,
|
|
48
|
-
});
|
|
31
|
+
const response = await renderToResponse(
|
|
32
|
+
<App fetchGraphQL={performGraphQLOperation} />,
|
|
33
|
+
{
|
|
34
|
+
request,
|
|
35
|
+
assets,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
49
38
|
|
|
50
39
|
return response;
|
|
51
40
|
});
|