@quilted/create 0.2.29 → 0.2.30
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 +8 -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 +2 -2
- package/templates/{app-graphql/features/start/Start.module.css → app-basic/features/home/Home.module.css} +1 -1
- package/templates/app-basic/features/home/tests/Home.test.tsx +12 -0
- package/templates/app-basic/features/home.ts +3 -0
- package/templates/app-graphql/App.tsx +6 -3
- package/templates/app-graphql/browser.tsx +6 -4
- package/templates/{app-basic/features/start/Start.module.css → app-graphql/features/home/Home.module.css} +1 -1
- package/templates/app-graphql/features/home/Home.tsx +13 -0
- package/templates/app-graphql/features/{start/StartQuery.graphql → home/HomeQuery.graphql} +1 -1
- package/templates/app-graphql/features/home/tests/Home.test.tsx +21 -0
- package/templates/app-graphql/features/home.ts +3 -0
- package/templates/app-graphql/server.tsx +12 -11
- package/templates/app-graphql/shared/graphql.ts +4 -2
- package/templates/app-trpc/App.tsx +2 -2
- package/templates/app-trpc/features/{start/Start.module.css → home/Home.module.css} +1 -1
- package/templates/app-trpc/features/home/Home.tsx +9 -0
- package/templates/app-trpc/features/home/tests/Home.test.tsx +12 -0
- package/templates/app-trpc/features/home.ts +3 -0
- package/templates/app-basic/features/start/tests/Start.test.tsx +0 -12
- package/templates/app-basic/features/start.ts +0 -3
- package/templates/app-graphql/features/start/Start.tsx +0 -13
- package/templates/app-graphql/features/start/tests/Start.test.tsx +0 -21
- package/templates/app-graphql/features/start.ts +0 -3
- package/templates/app-trpc/features/start/Start.tsx +0 -9
- package/templates/app-trpc/features/start/tests/Start.test.tsx +0 -12
- package/templates/app-trpc/features/start.ts +0 -5
- /package/templates/app-basic/features/{start/Start.tsx → home/Home.tsx} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @quilted/create
|
|
2
2
|
|
|
3
|
+
## 0.2.30
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f5981c1`](https://github.com/lemonmade/quilt/commit/f5981c1a28c91ffed11536b1ab6274c3d945bdf8) Thanks [@lemonmade](https://github.com/lemonmade)! - Improve app context in GraphQL template
|
|
8
|
+
|
|
9
|
+
- [`a70f378`](https://github.com/lemonmade/quilt/commit/a70f378463b7c951654e6ff44b4bf5aaeda3a386) Thanks [@lemonmade](https://github.com/lemonmade)! - Rename `Start` to `Home` in app templates
|
|
10
|
+
|
|
3
11
|
## 0.2.29
|
|
4
12
|
|
|
5
13
|
### 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
|
@@ -6,7 +6,7 @@ import {Localization, useLocaleFromEnvironment} from '@quilted/quilt/localize';
|
|
|
6
6
|
import {HTML} from './foundation/html.ts';
|
|
7
7
|
import {Frame} from './foundation/frame.ts';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import {Home} from './features/home.ts';
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
12
|
AppContextReact,
|
|
@@ -37,7 +37,7 @@ export default App;
|
|
|
37
37
|
// of routes, you may want to split this component into its own file.
|
|
38
38
|
function Routes() {
|
|
39
39
|
return useRoutes([
|
|
40
|
-
{match: '/', render: <
|
|
40
|
+
{match: '/', render: <Home />, renderPreload: <Home.Preload />},
|
|
41
41
|
]);
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {describe, it, expect} from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {renderApp} from '~/tests/render.ts';
|
|
4
|
+
|
|
5
|
+
import Home from '../Home.tsx';
|
|
6
|
+
|
|
7
|
+
describe('<Home />', () => {
|
|
8
|
+
it('includes a welcome message', async () => {
|
|
9
|
+
const home = await renderApp(<Home />);
|
|
10
|
+
expect(home).toContainPreactText('Hello world!');
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -7,7 +7,7 @@ import {Localization, useLocaleFromEnvironment} from '@quilted/quilt/localize';
|
|
|
7
7
|
import {HTML} from './foundation/html.ts';
|
|
8
8
|
import {Frame} from './foundation/frame.ts';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {Home} from './features/home.ts';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
AppContextReact,
|
|
@@ -38,7 +38,7 @@ export default App;
|
|
|
38
38
|
// of routes, you may want to split this component into its own file.
|
|
39
39
|
function Routes() {
|
|
40
40
|
return useRoutes([
|
|
41
|
-
{match: '/', render: <
|
|
41
|
+
{match: '/', render: <Home />, renderPreload: <Home.Preload />},
|
|
42
42
|
]);
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -48,7 +48,10 @@ function AppContext({children, context}: RenderableProps<AppProps>) {
|
|
|
48
48
|
|
|
49
49
|
return (
|
|
50
50
|
<AppContextReact.Provider value={context}>
|
|
51
|
-
<GraphQLContext
|
|
51
|
+
<GraphQLContext
|
|
52
|
+
fetch={context.graphql.fetch}
|
|
53
|
+
cache={context.graphql.cache}
|
|
54
|
+
>
|
|
52
55
|
<Localization locale={locale}>
|
|
53
56
|
<Routing>{children}</Routing>
|
|
54
57
|
</Localization>
|
|
@@ -11,12 +11,14 @@ import {App} from './App.tsx';
|
|
|
11
11
|
const element = document.querySelector('#app')!;
|
|
12
12
|
const browser = new Browser();
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
const graphQLCache = new GraphQLCache({fetch:
|
|
14
|
+
const graphQLFetch = createGraphQLFetch({url: '/api/graphql'});
|
|
15
|
+
const graphQLCache = new GraphQLCache({fetch: graphQLFetch});
|
|
16
16
|
|
|
17
17
|
const context = {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
graphql: {
|
|
19
|
+
fetch: graphQLFetch,
|
|
20
|
+
cache: graphQLCache,
|
|
21
|
+
},
|
|
20
22
|
} satisfies AppContext;
|
|
21
23
|
|
|
22
24
|
// 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 './Home.module.css';
|
|
4
|
+
import homeQuery from './HomeQuery.graphql';
|
|
5
|
+
|
|
6
|
+
export default function Home() {
|
|
7
|
+
const query = useGraphQLQuery(homeQuery);
|
|
8
|
+
|
|
9
|
+
const me = query.result?.data?.me;
|
|
10
|
+
const greeting = me ? `Hello ${me.name}!` : 'Hello!';
|
|
11
|
+
|
|
12
|
+
return <div className={styles.Home}>{greeting}</div>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {describe, it, expect} from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {renderApp} from '~/tests/render.ts';
|
|
4
|
+
import {fillGraphQL, GraphQLController} from '~/tests/graphql.ts';
|
|
5
|
+
|
|
6
|
+
import Home from '../Home.tsx';
|
|
7
|
+
import homeQuery from '../HomeQuery.graphql';
|
|
8
|
+
|
|
9
|
+
describe('<Home />', () => {
|
|
10
|
+
it('welcomes the user with their name', async () => {
|
|
11
|
+
const name = 'Winston';
|
|
12
|
+
const graphql = new GraphQLController([
|
|
13
|
+
fillGraphQL(homeQuery, {me: {name}}),
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
const home = await renderApp(<Home />, {graphql});
|
|
17
|
+
|
|
18
|
+
expect(graphql).toHavePerformedGraphQLQuery(homeQuery);
|
|
19
|
+
expect(home).toContainPreactText(`Hello ${name}!`);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -3,6 +3,8 @@ import '@quilted/quilt/globals';
|
|
|
3
3
|
import {RequestRouter, JSONResponse} from '@quilted/quilt/request-router';
|
|
4
4
|
import {BrowserAssets} from 'quilt:module/assets';
|
|
5
5
|
|
|
6
|
+
import type {AppContext} from '~/shared/context.ts';
|
|
7
|
+
|
|
6
8
|
const router = new RequestRouter();
|
|
7
9
|
const assets = new BrowserAssets();
|
|
8
10
|
|
|
@@ -29,18 +31,17 @@ router.get(async (request) => {
|
|
|
29
31
|
import('@quilted/quilt/server'),
|
|
30
32
|
]);
|
|
31
33
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
graphQLCache: new GraphQLCache(),
|
|
37
|
-
}}
|
|
38
|
-
/>,
|
|
39
|
-
{
|
|
40
|
-
request,
|
|
41
|
-
assets,
|
|
34
|
+
const context = {
|
|
35
|
+
graphql: {
|
|
36
|
+
fetch: performGraphQLOperation,
|
|
37
|
+
cache: new GraphQLCache(),
|
|
42
38
|
},
|
|
43
|
-
|
|
39
|
+
} satisfies AppContext;
|
|
40
|
+
|
|
41
|
+
const response = await renderToResponse(<App context={context} />, {
|
|
42
|
+
request,
|
|
43
|
+
assets,
|
|
44
|
+
});
|
|
44
45
|
|
|
45
46
|
return response;
|
|
46
47
|
});
|
|
@@ -2,8 +2,10 @@ import type {GraphQLFetch, GraphQLCache} from '@quilted/quilt/graphql';
|
|
|
2
2
|
|
|
3
3
|
declare module '~/shared/context.ts' {
|
|
4
4
|
interface AppContext {
|
|
5
|
-
readonly
|
|
6
|
-
|
|
5
|
+
readonly graphql: {
|
|
6
|
+
readonly fetch: GraphQLFetch;
|
|
7
|
+
readonly cache: GraphQLCache;
|
|
8
|
+
};
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
|
|
@@ -8,7 +8,7 @@ import {ReactQueryContext} from '@quilted/react-query';
|
|
|
8
8
|
import {HTML} from './foundation/html.ts';
|
|
9
9
|
import {Frame} from './foundation/frame.ts';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import {Home} from './features/home.ts';
|
|
12
12
|
|
|
13
13
|
import {trpc} from './shared/trpc.ts';
|
|
14
14
|
import {
|
|
@@ -40,7 +40,7 @@ export default App;
|
|
|
40
40
|
// of routes, you may want to split this component into its own file.
|
|
41
41
|
function Routes() {
|
|
42
42
|
return useRoutes([
|
|
43
|
-
{match: '/', render: <
|
|
43
|
+
{match: '/', render: <Home />, renderPreload: <Home.Preload />},
|
|
44
44
|
]);
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {describe, it, expect} from 'vitest';
|
|
2
|
+
|
|
3
|
+
import {renderApp} from '~/tests/render.ts';
|
|
4
|
+
|
|
5
|
+
import Home from '../Home.tsx';
|
|
6
|
+
|
|
7
|
+
describe('<Home />', () => {
|
|
8
|
+
it('includes a welcome message', async () => {
|
|
9
|
+
const home = await renderApp(<Home />);
|
|
10
|
+
expect(home).toContainPreactText('Hello world!');
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {describe, it, expect} from 'vitest';
|
|
2
|
-
|
|
3
|
-
import {renderApp} from '~/tests/render.ts';
|
|
4
|
-
|
|
5
|
-
import Start from '../Start.tsx';
|
|
6
|
-
|
|
7
|
-
describe('<Start />', () => {
|
|
8
|
-
it('includes a welcome message', async () => {
|
|
9
|
-
const start = await renderApp(<Start />);
|
|
10
|
-
expect(start).toContainPreactText('Hello world!');
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {describe, it, expect} from 'vitest';
|
|
2
|
-
|
|
3
|
-
import {renderApp} from '~/tests/render.ts';
|
|
4
|
-
import {fillGraphQL, GraphQLController} from '~/tests/graphql.ts';
|
|
5
|
-
|
|
6
|
-
import Start from '../Start.tsx';
|
|
7
|
-
import startQuery from '../StartQuery.graphql';
|
|
8
|
-
|
|
9
|
-
describe('<Start />', () => {
|
|
10
|
-
it('welcomes the user with their name', async () => {
|
|
11
|
-
const name = 'Winston';
|
|
12
|
-
const graphql = new GraphQLController([
|
|
13
|
-
fillGraphQL(startQuery, {me: {name}}),
|
|
14
|
-
]);
|
|
15
|
-
|
|
16
|
-
const start = await renderApp(<Start />, {graphql});
|
|
17
|
-
|
|
18
|
-
expect(graphql).toHavePerformedGraphQLQuery(startQuery);
|
|
19
|
-
expect(start).toContainPreactText(`Hello ${name}!`);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {describe, it, expect} from 'vitest';
|
|
2
|
-
|
|
3
|
-
import {renderApp} from '~/tests/render.ts';
|
|
4
|
-
|
|
5
|
-
import Start from '../Start.tsx';
|
|
6
|
-
|
|
7
|
-
describe('<Start />', () => {
|
|
8
|
-
it('includes a welcome message', async () => {
|
|
9
|
-
const start = await renderApp(<Start />);
|
|
10
|
-
expect(start).toContainPreactText('Hello world!');
|
|
11
|
-
});
|
|
12
|
-
});
|
|
File without changes
|