@quilted/create 0.2.26 → 0.2.28
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 +16 -0
- package/build/esnext/node_modules/.pnpm/@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.esnext +3 -3
- package/build/esnext/node_modules/.pnpm/@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.esnext +1 -1
- package/build/esnext/node_modules/.pnpm/@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.esnext +1 -1
- package/build/esnext/node_modules/.pnpm/@nodelib_fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.esnext +1 -1
- package/build/esnext/node_modules/.pnpm/@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.esnext +3 -3
- package/build/esnext/node_modules/.pnpm/@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/async.esnext +1 -1
- package/build/esnext/node_modules/.pnpm/@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/sync.esnext +1 -1
- package/build/esnext/node_modules/.pnpm/@nodelib_fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.esnext +1 -1
- package/package.json +1 -1
- package/templates/app-basic/App.tsx +1 -1
- package/templates/app-basic/features/start/{Start → tests}/Start.test.tsx +1 -1
- package/templates/app-basic/features/start.ts +1 -3
- package/templates/app-basic/server.tsx +5 -1
- package/templates/app-basic/tsconfig.json +3 -1
- package/templates/app-empty/tsconfig.json +5 -1
- package/templates/app-graphql/App.tsx +4 -5
- package/templates/app-graphql/browser.tsx +3 -3
- package/templates/app-graphql/features/start/Start.tsx +13 -0
- package/templates/app-graphql/features/start/{Start → tests}/Start.test.tsx +2 -2
- package/templates/app-graphql/features/start.ts +1 -3
- package/templates/app-graphql/package.json +0 -2
- package/templates/app-graphql/server.tsx +12 -8
- package/templates/app-graphql/shared/graphql.ts +3 -3
- package/templates/app-graphql/tests/render/render.tsx +9 -10
- package/templates/app-graphql/tests/render/types.ts +9 -3
- package/templates/app-graphql/tsconfig.json +3 -1
- package/templates/app-trpc/features/start/{Start → tests}/Start.test.tsx +1 -1
- package/templates/app-trpc/tsconfig.json +3 -1
- package/templates/app-graphql/features/start/Start/Start.tsx +0 -14
- /package/templates/app-basic/features/start/{Start/Start.module.css → Start.module.css} +0 -0
- /package/templates/app-basic/features/start/{Start/Start.tsx → Start.tsx} +0 -0
- /package/templates/app-graphql/features/start/{Start/Start.module.css → Start.module.css} +0 -0
- /package/templates/app-graphql/features/start/{Start/StartQuery.graphql → StartQuery.graphql} +0 -0
- /package/templates/app-trpc/features/start/{Start/Start.module.css → Start.module.css} +0 -0
- /package/templates/app-trpc/features/start/{Start/Start.tsx → Start.tsx} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @quilted/create
|
|
2
2
|
|
|
3
|
+
## 0.2.28
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`55d5fee`](https://github.com/lemonmade/quilt/commit/55d5fee9235e2625adb8826e367d70fbc0925908) Thanks [@lemonmade](https://github.com/lemonmade)! - Simplify directory structure for template apps
|
|
8
|
+
|
|
9
|
+
- [`7119a8c`](https://github.com/lemonmade/quilt/commit/7119a8c9464bffe18fc37155fed9fd2188e24c78) Thanks [@lemonmade](https://github.com/lemonmade)! - Add type aliases for React and React DOM to app templates
|
|
10
|
+
|
|
11
|
+
- [`eaa1110`](https://github.com/lemonmade/quilt/commit/eaa1110d0ce583b3ca904e11cbf9bf098a820f1d) Thanks [@lemonmade](https://github.com/lemonmade)! - Make app context required in basic app template
|
|
12
|
+
|
|
13
|
+
## 0.2.27
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`e5877f9`](https://github.com/lemonmade/quilt/commit/e5877f9b94f62a8ec09a75a44f028c4530ea9f2d) Thanks [@lemonmade](https://github.com/lemonmade)! - Update GraphQL template
|
|
18
|
+
|
|
3
19
|
## 0.2.26
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -2,9 +2,9 @@ import { __exports as out } from '../../../../../../../_virtual/index5.esnext';
|
|
|
2
2
|
import './providers/async.esnext';
|
|
3
3
|
import './providers/sync.esnext';
|
|
4
4
|
import './settings.esnext';
|
|
5
|
-
import { __exports as settings } from '../../../../../../../_virtual/
|
|
6
|
-
import { __exports as async$1 } from '../../../../../../../_virtual/
|
|
7
|
-
import { __exports as sync$1 } from '../../../../../../../_virtual/
|
|
5
|
+
import { __exports as settings } from '../../../../../../../_virtual/settings2.esnext';
|
|
6
|
+
import { __exports as async$1 } from '../../../../../../../_virtual/async3.esnext';
|
|
7
|
+
import { __exports as sync$1 } from '../../../../../../../_virtual/sync3.esnext';
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(out, "__esModule", { value: true });
|
|
10
10
|
out.statSync = out.stat = out.Settings = void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as settings } from '../../../../../../../_virtual/
|
|
1
|
+
import { __exports as settings } from '../../../../../../../_virtual/settings2.esnext';
|
|
2
2
|
import './adapters/fs.esnext';
|
|
3
3
|
import { __exports as fs$1 } from '../../../../../../../_virtual/fs2.esnext';
|
|
4
4
|
|
|
@@ -3,10 +3,10 @@ import './providers/async.esnext';
|
|
|
3
3
|
import './providers/stream.esnext';
|
|
4
4
|
import './providers/sync.esnext';
|
|
5
5
|
import './settings.esnext';
|
|
6
|
-
import { __exports as settings } from '../../../../../../../_virtual/
|
|
7
|
-
import { __exports as async } from '../../../../../../../_virtual/
|
|
6
|
+
import { __exports as settings } from '../../../../../../../_virtual/settings3.esnext';
|
|
7
|
+
import { __exports as async } from '../../../../../../../_virtual/async4.esnext';
|
|
8
8
|
import { __exports as stream } from '../../../../../../../_virtual/stream4.esnext';
|
|
9
|
-
import { __exports as sync } from '../../../../../../../_virtual/
|
|
9
|
+
import { __exports as sync } from '../../../../../../../_virtual/sync4.esnext';
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(out, "__esModule", { value: true });
|
|
12
12
|
out.Settings = out.walkStream = out.walkSync = out.walk = void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as async } from '../../../../../../../../_virtual/
|
|
1
|
+
import { __exports as async } from '../../../../../../../../_virtual/async4.esnext';
|
|
2
2
|
import '../readers/async.esnext';
|
|
3
3
|
import { __exports as async$1 } from '../../../../../../../../_virtual/async5.esnext';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as sync } from '../../../../../../../../_virtual/
|
|
1
|
+
import { __exports as sync } from '../../../../../../../../_virtual/sync4.esnext';
|
|
2
2
|
import '../readers/sync.esnext';
|
|
3
3
|
import { __exports as sync$1 } from '../../../../../../../../_virtual/sync5.esnext';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __exports as settings } from '../../../../../../../_virtual/
|
|
1
|
+
import { __exports as settings } from '../../../../../../../_virtual/settings3.esnext';
|
|
2
2
|
import path__default from 'node:path';
|
|
3
3
|
import '../../../../../@nodelib_fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/index.esnext';
|
|
4
4
|
import { __exports as out } from '../../../../../../../_virtual/index6.esnext';
|
package/package.json
CHANGED
|
@@ -3,6 +3,8 @@ import {RequestRouter} from '@quilted/quilt/request-router';
|
|
|
3
3
|
import {renderToResponse} from '@quilted/quilt/server';
|
|
4
4
|
import {BrowserAssets} from 'quilt:module/assets';
|
|
5
5
|
|
|
6
|
+
import type {AppContext} from '~/shared/context.ts';
|
|
7
|
+
|
|
6
8
|
import {App} from './App.tsx';
|
|
7
9
|
|
|
8
10
|
const router = new RequestRouter();
|
|
@@ -10,7 +12,9 @@ const assets = new BrowserAssets();
|
|
|
10
12
|
|
|
11
13
|
// For all GET requests, render our React application.
|
|
12
14
|
router.get(async (request) => {
|
|
13
|
-
const
|
|
15
|
+
const context = {} satisfies AppContext;
|
|
16
|
+
|
|
17
|
+
const response = await renderToResponse(<App context={context} />, {
|
|
14
18
|
request,
|
|
15
19
|
assets,
|
|
16
20
|
});
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
"jsxImportSource": "preact",
|
|
6
6
|
"paths": {
|
|
7
7
|
"~/shared/*": ["./shared/*"],
|
|
8
|
-
"~/tests/*": ["./tests/*"]
|
|
8
|
+
"~/tests/*": ["./tests/*"],
|
|
9
|
+
"react": ["./node_modules/preact/compat"],
|
|
10
|
+
"react-dom": ["./node_modules/preact/compat"]
|
|
9
11
|
}
|
|
10
12
|
},
|
|
11
13
|
"include": ["**/*"],
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
"extends": "@quilted/typescript/tsconfig.project.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"outDir": "build/typescript",
|
|
5
|
-
"jsxImportSource": "preact"
|
|
5
|
+
"jsxImportSource": "preact",
|
|
6
|
+
"paths": {
|
|
7
|
+
"react": ["./node_modules/preact/compat"],
|
|
8
|
+
"react-dom": ["./node_modules/preact/compat"]
|
|
9
|
+
}
|
|
6
10
|
},
|
|
7
11
|
"include": ["**/*"],
|
|
8
12
|
"exclude": ["build"],
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type {RenderableProps} from 'preact';
|
|
2
2
|
|
|
3
|
+
import {AsyncContext} from '@quilted/quilt/async';
|
|
4
|
+
import {GraphQLContext} from '@quilted/quilt/graphql';
|
|
3
5
|
import {Routing, useRoutes} from '@quilted/quilt/navigate';
|
|
4
6
|
import {Localization, useLocaleFromEnvironment} from '@quilted/quilt/localize';
|
|
5
|
-
import {GraphQLContext} from '@quilted/quilt/graphql';
|
|
6
|
-
|
|
7
|
-
import {ReactQueryContext} from '@quilted/react-query';
|
|
8
7
|
|
|
9
8
|
import {HTML} from './foundation/html.ts';
|
|
10
9
|
import {Frame} from './foundation/frame.ts';
|
|
@@ -51,11 +50,11 @@ function AppContext({children, context}: RenderableProps<AppProps>) {
|
|
|
51
50
|
return (
|
|
52
51
|
<AppContextReact.Provider value={context}>
|
|
53
52
|
<GraphQLContext fetch={context.fetchGraphQL}>
|
|
54
|
-
<
|
|
53
|
+
<AsyncContext cache={context.asyncCache}>
|
|
55
54
|
<Localization locale={locale}>
|
|
56
55
|
<Routing>{children}</Routing>
|
|
57
56
|
</Localization>
|
|
58
|
-
</
|
|
57
|
+
</AsyncContext>
|
|
59
58
|
</GraphQLContext>
|
|
60
59
|
</AppContextReact.Provider>
|
|
61
60
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@quilted/quilt/globals';
|
|
2
2
|
|
|
3
3
|
import {hydrate} from 'preact';
|
|
4
|
-
import {
|
|
4
|
+
import {AsyncActionCache} from '@quilted/quilt/async';
|
|
5
5
|
import {createGraphQLFetch} from '@quilted/quilt/graphql';
|
|
6
6
|
import {Browser, BrowserContext} from '@quilted/quilt/browser';
|
|
7
7
|
|
|
@@ -13,11 +13,11 @@ const element = document.querySelector('#app')!;
|
|
|
13
13
|
const browser = new Browser();
|
|
14
14
|
|
|
15
15
|
const fetchGraphQL = createGraphQLFetch({url: '/api/graphql'});
|
|
16
|
-
const
|
|
16
|
+
const asyncCache = new AsyncActionCache();
|
|
17
17
|
|
|
18
18
|
const context = {
|
|
19
19
|
fetchGraphQL,
|
|
20
|
-
|
|
20
|
+
asyncCache,
|
|
21
21
|
} satisfies AppContext;
|
|
22
22
|
|
|
23
23
|
// Makes key parts of the app available in the browser console
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {useGraphQLQuery} from '@quilted/quilt/graphql';
|
|
2
|
+
|
|
3
|
+
import styles from './Start.module.css';
|
|
4
|
+
import startQuery from './StartQuery.graphql';
|
|
5
|
+
|
|
6
|
+
export default function Start() {
|
|
7
|
+
const query = useGraphQLQuery(startQuery);
|
|
8
|
+
|
|
9
|
+
const me = query.result?.data?.me;
|
|
10
|
+
const greeting = me ? `Hello ${me.name}!` : 'Hello!';
|
|
11
|
+
|
|
12
|
+
return <div className={styles.Start}>{greeting}</div>;
|
|
13
|
+
}
|
|
@@ -3,8 +3,8 @@ import {describe, it, expect} from 'vitest';
|
|
|
3
3
|
import {renderApp} from '~/tests/render.ts';
|
|
4
4
|
import {fillGraphQL, GraphQLController} from '~/tests/graphql.ts';
|
|
5
5
|
|
|
6
|
-
import Start from '
|
|
7
|
-
import startQuery from '
|
|
6
|
+
import Start from '../Start.tsx';
|
|
7
|
+
import startQuery from '../StartQuery.graphql';
|
|
8
8
|
|
|
9
9
|
describe('<Start />', () => {
|
|
10
10
|
it('welcomes the user with their name', async () => {
|
|
@@ -21,19 +21,23 @@ router.post('/api/graphql', async (request) => {
|
|
|
21
21
|
|
|
22
22
|
// For all GET requests, render our React application.
|
|
23
23
|
router.get(async (request) => {
|
|
24
|
-
const [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const [
|
|
25
|
+
{App},
|
|
26
|
+
{performGraphQLOperation},
|
|
27
|
+
{renderToResponse},
|
|
28
|
+
{AsyncActionCache},
|
|
29
|
+
] = await Promise.all([
|
|
30
|
+
import('./App.tsx'),
|
|
31
|
+
import('./server/graphql.ts'),
|
|
32
|
+
import('@quilted/quilt/server'),
|
|
33
|
+
import('@quilted/quilt/async'),
|
|
34
|
+
]);
|
|
31
35
|
|
|
32
36
|
const response = await renderToResponse(
|
|
33
37
|
<App
|
|
34
38
|
context={{
|
|
35
39
|
fetchGraphQL: performGraphQLOperation,
|
|
36
|
-
|
|
40
|
+
asyncCache: new AsyncActionCache(),
|
|
37
41
|
}}
|
|
38
42
|
/>,
|
|
39
43
|
{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type {GraphQLFetch} from '@quilted/quilt/graphql';
|
|
2
|
-
import type {
|
|
2
|
+
import type {AsyncActionCache} from '@quilted/quilt/async';
|
|
3
3
|
|
|
4
4
|
declare module '~/shared/context.ts' {
|
|
5
5
|
interface AppContext {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
readonly fetchGraphQL: GraphQLFetch;
|
|
7
|
+
readonly asyncCache: AsyncActionCache;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import {Suspense} from 'preact/compat';
|
|
2
|
+
|
|
1
3
|
import {createRender} from '@quilted/quilt/testing';
|
|
2
4
|
import {BrowserContext, BrowserTestMock} from '@quilted/quilt/browser/testing';
|
|
3
5
|
import {TestRouting, TestRouter} from '@quilted/quilt/navigate/testing';
|
|
4
6
|
import {Localization} from '@quilted/quilt/localize';
|
|
5
|
-
|
|
6
|
-
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
|
|
7
|
+
import {AsyncActionCache, AsyncContext} from '@quilted/quilt/async';
|
|
7
8
|
|
|
8
9
|
import {AppContextReact} from '~/shared/context.ts';
|
|
9
10
|
|
|
@@ -28,18 +29,19 @@ export const renderApp = createRender<
|
|
|
28
29
|
router = new TestRouter(),
|
|
29
30
|
browser = new BrowserTestMock(),
|
|
30
31
|
graphql = new GraphQLController(),
|
|
32
|
+
asyncCache = new AsyncActionCache(),
|
|
31
33
|
}) {
|
|
32
34
|
return {
|
|
33
35
|
router,
|
|
34
36
|
browser,
|
|
35
37
|
graphql,
|
|
36
38
|
fetchGraphQL: graphql.fetch,
|
|
37
|
-
|
|
39
|
+
asyncCache,
|
|
38
40
|
};
|
|
39
41
|
},
|
|
40
42
|
// Render all of our app-wide context providers around each component under test.
|
|
41
43
|
render(element, context, {locale = 'en'}) {
|
|
42
|
-
const {router, browser, graphql,
|
|
44
|
+
const {router, browser, graphql, asyncCache} = context;
|
|
43
45
|
|
|
44
46
|
return (
|
|
45
47
|
<AppContextReact.Provider value={context}>
|
|
@@ -47,9 +49,9 @@ export const renderApp = createRender<
|
|
|
47
49
|
<Localization locale={locale}>
|
|
48
50
|
<TestRouting router={router}>
|
|
49
51
|
<GraphQLTesting controller={graphql}>
|
|
50
|
-
<
|
|
51
|
-
{element}
|
|
52
|
-
</
|
|
52
|
+
<AsyncContext cache={asyncCache}>
|
|
53
|
+
<Suspense fallback={null}>{element}</Suspense>
|
|
54
|
+
</AsyncContext>
|
|
53
55
|
</GraphQLTesting>
|
|
54
56
|
</TestRouting>
|
|
55
57
|
</Localization>
|
|
@@ -65,9 +67,6 @@ export const renderApp = createRender<
|
|
|
65
67
|
|
|
66
68
|
await wrapper.act(async () => {
|
|
67
69
|
await wrapper.context.graphql.resolveAll();
|
|
68
|
-
|
|
69
|
-
// react-query needs an extra tick to set state in response to GraphQL queries.
|
|
70
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
71
70
|
});
|
|
72
71
|
},
|
|
73
72
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {TestRouter} from '@quilted/quilt/navigate/testing';
|
|
2
2
|
import type {BrowserTestMock} from '@quilted/quilt/browser/testing';
|
|
3
|
-
import type {
|
|
3
|
+
import type {AsyncActionCache} from '@quilted/quilt/async';
|
|
4
4
|
|
|
5
5
|
import type {AppContext} from '~/shared/context.ts';
|
|
6
6
|
|
|
@@ -42,6 +42,12 @@ export interface RenderOptions {
|
|
|
42
42
|
*/
|
|
43
43
|
readonly graphql?: GraphQLController;
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* The cache of GraphQL query results. When not provided, an empty cache
|
|
47
|
+
* will be used.
|
|
48
|
+
*/
|
|
49
|
+
readonly asyncCache?: AsyncActionCache;
|
|
50
|
+
|
|
45
51
|
/**
|
|
46
52
|
* A custom locale to use for this component test.
|
|
47
53
|
*/
|
|
@@ -65,9 +71,9 @@ export interface RenderContext extends AppContext {
|
|
|
65
71
|
readonly graphql: GraphQLController;
|
|
66
72
|
|
|
67
73
|
/**
|
|
68
|
-
* The
|
|
74
|
+
* The cache of GraphQL query results.
|
|
69
75
|
*/
|
|
70
|
-
readonly
|
|
76
|
+
readonly asyncCache: AsyncActionCache;
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
export interface RenderActions extends Record<string, never> {}
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
"jsxImportSource": "preact",
|
|
6
6
|
"paths": {
|
|
7
7
|
"~/shared/*": ["./shared/*"],
|
|
8
|
-
"~/tests/*": ["./tests/*"]
|
|
8
|
+
"~/tests/*": ["./tests/*"],
|
|
9
|
+
"react": ["./node_modules/preact/compat"],
|
|
10
|
+
"react-dom": ["./node_modules/preact/compat"]
|
|
9
11
|
}
|
|
10
12
|
},
|
|
11
13
|
"include": ["**/*"],
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
"jsxImportSource": "preact",
|
|
6
6
|
"paths": {
|
|
7
7
|
"~/shared/*": ["./shared/*"],
|
|
8
|
-
"~/tests/*": ["./tests/*"]
|
|
8
|
+
"~/tests/*": ["./tests/*"],
|
|
9
|
+
"react": ["./node_modules/preact/compat"],
|
|
10
|
+
"react-dom": ["./node_modules/preact/compat"]
|
|
9
11
|
}
|
|
10
12
|
},
|
|
11
13
|
"include": ["**/*"],
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {useGraphQLQuery} from '@quilted/react-query';
|
|
2
|
-
|
|
3
|
-
import styles from './Start.module.css';
|
|
4
|
-
import startQuery from './StartQuery.graphql';
|
|
5
|
-
|
|
6
|
-
export default function Start() {
|
|
7
|
-
const {data} = useGraphQLQuery(startQuery);
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<div className={styles.Start}>
|
|
11
|
-
{data ? `Hello ${data.me.name}!` : 'Hello!'}
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/templates/app-graphql/features/start/{Start/StartQuery.graphql → StartQuery.graphql}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|