@seriousgaming/sdk-tools 1.10.0 → 1.11.0
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/dist/agent/guidance.md +31 -23
- package/dist/{cli-5V4N4BR4.js → cli-27TQVLVF.js} +1 -1
- package/dist/{cli-FGP6YYM7.js → cli-3VLBFWHN.js} +8 -8
- package/dist/{cli-XR3O2YTV.js → cli-4F24FUW6.js} +5 -5
- package/dist/{cli-CQ4ZR3ZQ.js → cli-5ATO27Z4.js} +5 -5
- package/dist/{cli-MGZYQDCH.js → cli-5TTJWM2R.js} +5 -5
- package/dist/{cli-6CYAOUYT.js → cli-5UKWX3IU.js} +4 -4
- package/dist/{cli-LLJQI2QP.js → cli-6AMK3DYS.js} +1 -1
- package/dist/{cli-WOFYI7HZ.js → cli-6JWDFCUV.js} +6 -6
- package/dist/{cli-A3AJQZEN.js → cli-6P6V2EHY.js} +7 -7
- package/dist/{cli-RSF5R3HC.js → cli-77T4LJQF.js} +10 -7
- package/dist/{cli-LNEZ6KDW.js → cli-ATAJSIXH.js} +4 -4
- package/dist/{cli-4A7RWFNO.js → cli-ATHATKI5.js} +47 -47
- package/dist/{cli-QW7VXL2V.js → cli-B2QAJ5RQ.js} +5 -5
- package/dist/{cli-BB6CU4ZC.js → cli-BINVO5R7.js} +8 -8
- package/dist/{cli-5SHG2M7E.js → cli-BJFYGVJV.js} +4 -4
- package/dist/{cli-J42N4PJG.js → cli-BZOKZ7LP.js} +11 -9
- package/dist/{cli-MUOLHQNL.js → cli-D3S7NJZ3.js} +1 -1
- package/dist/{cli-WLSACMYA.js → cli-DBMEH4Y5.js} +10 -8
- package/dist/{cli-CLO7HKEQ.js → cli-DH35TZ2Q.js} +4 -2
- package/dist/{cli-2ANX6E3A.js → cli-DQE7ITIR.js} +5 -5
- package/dist/{cli-467VRXGP.js → cli-EEO5ZPAZ.js} +1 -1
- package/dist/{cli-B5DWKRZ4.js → cli-ERJNDBDH.js} +1 -1
- package/dist/{cli-IQBY7Z7Q.js → cli-FT3X3D4P.js} +5 -5
- package/dist/{cli-5TKPT3CY.js → cli-FYPW25VD.js} +4 -4
- package/dist/{cli-36GABN2A.js → cli-G3TU6CP6.js} +5 -5
- package/dist/{cli-NAZTYKZT.js → cli-H6PP2MZT.js} +14 -2
- package/dist/{cli-5XE4OMFL.js → cli-HLI5UEKX.js} +8 -8
- package/dist/{cli-YZJBFKRI.js → cli-HMDYG6PS.js} +5 -5
- package/dist/{cli-2AH6D32V.js → cli-K4HSQWXC.js} +1 -1
- package/dist/{cli-EXUPHPDJ.js → cli-L7F4XKCB.js} +7 -7
- package/dist/{cli-O5WYATAI.js → cli-LHMRUJVN.js} +3 -1
- package/dist/{cli-VALLLE6Y.js → cli-LPFSJ625.js} +7 -7
- package/dist/{cli-HN442ZVK.js → cli-MSNSXVGF.js} +5 -5
- package/dist/{cli-OXU6TTEN.js → cli-NKKCDO6K.js} +5 -5
- package/dist/{cli-L54SXUK6.js → cli-OBLEROSC.js} +4 -4
- package/dist/{cli-RFAPPYXK.js → cli-OF36EA62.js} +8 -8
- package/dist/{cli-XB5PI2XT.js → cli-OM32UURE.js} +6 -6
- package/dist/{cli-2AVPNSAX.js → cli-OMTHTWYJ.js} +6 -6
- package/dist/{cli-I3ZAZYWP.js → cli-OVIJRBFI.js} +8 -8
- package/dist/{cli-IPTHJT3J.js → cli-PNS4KWWC.js} +10 -7
- package/dist/{cli-VZVHS5AP.js → cli-Q7QSWNY2.js} +5 -5
- package/dist/{cli-GRSQRFRG.js → cli-QEFYDXMH.js} +8 -1
- package/dist/{cli-TDLIPYKT.js → cli-QPV3TYOM.js} +8 -8
- package/dist/{cli-PYAST3G5.js → cli-R5SNTPND.js} +6 -6
- package/dist/{cli-WG7MAOCS.js → cli-REAM7LSC.js} +5 -5
- package/dist/{cli-URCHZDTS.js → cli-RHL4B4H7.js} +3 -2
- package/dist/{cli-KNXY43YV.js → cli-RKPQLB7J.js} +1 -1
- package/dist/{cli-PBSLPO6G.js → cli-RMD5WSUQ.js} +4 -4
- package/dist/{cli-PTXOKO2Y.js → cli-S3NHXAJM.js} +1 -1
- package/dist/{cli-33MZSPPK.js → cli-SRXDLMXY.js} +6 -6
- package/dist/{cli-M6AZFIMV.js → cli-TEBV2OIW.js} +5 -2
- package/dist/{cli-35GV2F6R.js → cli-TI2FOFPA.js} +4 -4
- package/dist/{cli-JMNPMDXH.js → cli-TLSTSZAC.js} +7 -7
- package/dist/{cli-XEEOJGBL.js → cli-UIYKPSIY.js} +8 -8
- package/dist/{cli-267QJ2DS.js → cli-UVIURDZC.js} +1 -1
- package/dist/{cli-JAVMRERQ.js → cli-VXLHOZSO.js} +5 -5
- package/dist/{cli-SOO6SEIS.js → cli-WJVPSVF2.js} +10 -7
- package/dist/{cli-RUEPTOWG.js → cli-WNBP3LOD.js} +7 -7
- package/dist/{cli-ILHHJR2S.js → cli-WNHMJM3Z.js} +5 -5
- package/dist/{cli-4JNF3O5N.js → cli-WQ7JBZNW.js} +1 -1
- package/dist/{cli-5DWR7RPQ.js → cli-X3TSTTYI.js} +1 -1
- package/dist/{cli-Z3DITVBE.js → cli-X52TXCNF.js} +7 -7
- package/dist/{cli-HNG6PZW2.js → cli-XJ7JESC2.js} +7 -7
- package/dist/{cli-7NUFHMGE.js → cli-XNOAO6DY.js} +1 -1
- package/dist/{cli-HHRP6FP6.js → cli-XOYUTNER.js} +7 -7
- package/dist/{cli-YFLQ7XOO.js → cli-YYXAGJQR.js} +5 -5
- package/dist/{cli-NQSL2CIH.js → cli-ZGCG6C22.js} +6 -6
- package/dist/cli.js +24 -24
- package/dist/client/index.d.ts +1 -1
- package/dist/client/test-session.d.ts +44 -6
- package/dist/client.js +16 -3
- package/dist/docs/api/index.md +3 -1
- package/dist/docs/api/sdk-tools-client.md +38 -6
- package/dist/docs/api/sdk-tools-vite.md +21 -0
- package/dist/docs/changelog.md +39 -0
- package/dist/docs/guides/endpoints.md +1 -1
- package/dist/docs/guides/engine-testing.md +49 -14
- package/dist/docs/guides/engine.md +2 -2
- package/dist/docs/guides/testing.md +3 -8
- package/dist/docs/guides/upgrading.md +15 -0
- package/dist/docs/page-index.md +4 -3
- package/dist/docs/recipes/create-game.md +1 -1
- package/dist/docs/recipes/fix-duplicate-packages.md +8 -19
- package/dist/oxlint/logic.json +184 -0
- package/dist/playwright.js +16 -3
- package/dist/templates/package/README.md.liquid +1 -0
- package/dist/templates/package/claude/rules/workflow-create-engine.md +1 -1
- package/dist/templates/package/claude/rules/workflow-create-user-interface.md +1 -1
- package/dist/templates/package/claude/rules/workflow-test-engine-or-ui.md +1 -1
- package/dist/templates/package/claude/rules/workflow-update-sdk-version.md +2 -2
- package/dist/templates/package/claude/settings.json.template +1 -0
- package/dist/templates/package/oxfmtrc.json.template +8 -1
- package/dist/templates/package/oxlintrc.json.template +1 -180
- package/dist/templates/package/package.json.liquid +1 -0
- package/dist/templates/package/vite.config.ts.liquid +2 -8
- package/dist/templates/package/vitest.config.ts.liquid +2 -8
- package/dist/templates/starter-game/package.json +2 -1
- package/dist/templates/starter-game/testing/engine/game.engine.test.ts +62 -37
- package/dist/templates/starter-game/vite.config.ts +2 -8
- package/dist/templates/starter-game/vitest.config.ts +4 -3
- package/dist/utils/resource-scan.d.ts +5 -0
- package/dist/vite/index.d.ts +30 -0
- package/dist/vite.js +12 -0
- package/package.json +12 -4
|
@@ -60,7 +60,7 @@ pnpm run sdk view
|
|
|
60
60
|
| The build reports no engine | Check `engine/engine.sdk.json` exists |
|
|
61
61
|
| The build warns that only the engine can end the game | There is no `maxTicks`; expected for a goal-based game |
|
|
62
62
|
| A patch fails on a missing path | Use `add` for a field the manifest does not have yet, `replace` for one it has |
|
|
63
|
-
| Detailed errors | Run `pnpm run sdk build --validate-only --json`
|
|
63
|
+
| Detailed errors | Run `pnpm run --silent sdk build --validate-only --json` |
|
|
64
64
|
|
|
65
65
|
## Related
|
|
66
66
|
|
|
@@ -21,24 +21,20 @@ Two copies of React in one page (a library that bundles its own, such as `@react
|
|
|
21
21
|
Create `vite.config.ts` alongside your `seriousgaming.sdk.json`:
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
|
+
import { REACT_CONTEXT_PACKAGES } from '@seriousgaming/sdk-tools/vite';
|
|
24
25
|
import { defineConfig } from 'vite';
|
|
25
26
|
|
|
26
27
|
export default defineConfig({
|
|
27
28
|
resolve: {
|
|
28
|
-
dedupe: [
|
|
29
|
-
'react',
|
|
30
|
-
'react-dom',
|
|
31
|
-
'@emotion/react',
|
|
32
|
-
'@emotion/styled',
|
|
33
|
-
'@seriousgaming/sdk',
|
|
34
|
-
'@seriousgaming/deck',
|
|
35
|
-
],
|
|
29
|
+
dedupe: [...REACT_CONTEXT_PACKAGES],
|
|
36
30
|
},
|
|
37
31
|
});
|
|
38
32
|
```
|
|
39
33
|
|
|
40
34
|
`resolve.dedupe` tells Vite to resolve these packages to the single copy at the project root,
|
|
41
|
-
however many paths in the dependency tree lead to them.
|
|
35
|
+
however many paths in the dependency tree lead to them. `REACT_CONTEXT_PACKAGES` is the SDK's
|
|
36
|
+
list of every package that holds React context a surface reads: React, Emotion, the SDK and the
|
|
37
|
+
deck. Read it from the SDK rather than writing it out, so it keeps up when the SDK gains one.
|
|
42
38
|
|
|
43
39
|
If your package was created with `sdk new package` and already has a `vite.config.ts`, add
|
|
44
40
|
entries to its `dedupe` list rather than creating a second file.
|
|
@@ -59,24 +55,17 @@ Add a package to `dedupe` whenever you install a library that:
|
|
|
59
55
|
- Lists React (or Emotion) as a **peer dependency**, and
|
|
60
56
|
- Also `require()`s that peer internally in its own bundled code
|
|
61
57
|
|
|
62
|
-
Or any package that holds React context and that more than one path leads to, as the SDK does. A package created with `sdk new package`
|
|
58
|
+
Or any package that holds React context and that more than one path leads to, as the SDK does. A package created with `sdk new package` spreads `REACT_CONTEXT_PACKAGES` already, in both `vite.config.ts` and `vitest.config.ts`.
|
|
63
59
|
|
|
64
60
|
Example with additional libraries:
|
|
65
61
|
|
|
66
62
|
```typescript
|
|
63
|
+
import { REACT_CONTEXT_PACKAGES } from '@seriousgaming/sdk-tools/vite';
|
|
67
64
|
import { defineConfig } from 'vite';
|
|
68
65
|
|
|
69
66
|
export default defineConfig({
|
|
70
67
|
resolve: {
|
|
71
|
-
dedupe: [
|
|
72
|
-
'react',
|
|
73
|
-
'react-dom',
|
|
74
|
-
'@emotion/react',
|
|
75
|
-
'@emotion/styled',
|
|
76
|
-
'@seriousgaming/sdk',
|
|
77
|
-
'@seriousgaming/deck',
|
|
78
|
-
'@react-three/fiber',
|
|
79
|
-
],
|
|
68
|
+
dedupe: [...REACT_CONTEXT_PACKAGES, '@react-three/fiber'],
|
|
80
69
|
},
|
|
81
70
|
});
|
|
82
71
|
```
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
{
|
|
2
|
+
"overrides": [
|
|
3
|
+
{
|
|
4
|
+
"files": [
|
|
5
|
+
"engine/**/*.ts",
|
|
6
|
+
"tick_controller/**/*.ts",
|
|
7
|
+
"**/hooks/*/logic/**/*.ts",
|
|
8
|
+
"**/validators/*/logic/**/*.ts",
|
|
9
|
+
"**/endpoints/*/logic/**/*.ts"
|
|
10
|
+
],
|
|
11
|
+
"rules": {
|
|
12
|
+
"no-restricted-globals": [
|
|
13
|
+
"error",
|
|
14
|
+
{
|
|
15
|
+
"name": "structuredClone",
|
|
16
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Context is JSON-serialisable, so JSON.parse(JSON.stringify(value)) is the portable equivalent."
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "TextEncoder",
|
|
20
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Import encodeUtf8 from @seriousgaming/sdk instead."
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "TextDecoder",
|
|
24
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Import decodeUtf8 from @seriousgaming/sdk instead."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "fetch",
|
|
28
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Reach external services through the injected callbacks, or through an endpoint."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "XMLHttpRequest",
|
|
32
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Reach external services through the injected callbacks, or through an endpoint."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "setTimeout",
|
|
36
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "setInterval",
|
|
40
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "setImmediate",
|
|
44
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "queueMicrotask",
|
|
48
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "process",
|
|
52
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Settings reach logic through the `settings` argument."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "Buffer",
|
|
56
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Use Uint8Array, with the SDK's encodeUtf8 / decodeUtf8 for string conversion."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "URL",
|
|
60
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Build asset URLs from the references and callbacks the runtime injects."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "clearTimeout",
|
|
64
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "clearInterval",
|
|
68
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "clearImmediate",
|
|
72
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "URLSearchParams",
|
|
76
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "crypto",
|
|
80
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "atob",
|
|
84
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "btoa",
|
|
88
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "performance",
|
|
92
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "ReadableStream",
|
|
96
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "WritableStream",
|
|
100
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "TransformStream",
|
|
104
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "Blob",
|
|
108
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "File",
|
|
112
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "FormData",
|
|
116
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "Headers",
|
|
120
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "Request",
|
|
124
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "Response",
|
|
128
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "AbortController",
|
|
132
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "EventTarget",
|
|
136
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"name": "WebSocket",
|
|
140
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "localStorage",
|
|
144
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "sessionStorage",
|
|
148
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "window",
|
|
152
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "document",
|
|
156
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "navigator",
|
|
160
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "require",
|
|
164
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "__dirname",
|
|
168
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "__filename",
|
|
172
|
+
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"files": ["**/*.test.ts", "**/*.spec.ts"],
|
|
179
|
+
"rules": {
|
|
180
|
+
"no-restricted-globals": "off"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
package/dist/playwright.js
CHANGED
|
@@ -893,6 +893,16 @@ function distPath(meta, identifier) {
|
|
|
893
893
|
return `${meta.pluralDir}/${identifier}`;
|
|
894
894
|
}
|
|
895
895
|
|
|
896
|
+
// cli/vite/index.ts
|
|
897
|
+
var REACT_CONTEXT_PACKAGES = [
|
|
898
|
+
"react",
|
|
899
|
+
"react-dom",
|
|
900
|
+
"@emotion/react",
|
|
901
|
+
"@emotion/styled",
|
|
902
|
+
"@seriousgaming/sdk",
|
|
903
|
+
"@seriousgaming/deck"
|
|
904
|
+
];
|
|
905
|
+
|
|
896
906
|
// cli/bundling/ui-bundler.ts
|
|
897
907
|
async function bundleUserInterface(ui, workingDir, buildDir, type) {
|
|
898
908
|
const uiOutputDir = join(buildDir, distPath(getResourceMeta(type), ui.definition.identifier));
|
|
@@ -918,7 +928,7 @@ async function bundleUserInterface(ui, workingDir, buildDir, type) {
|
|
|
918
928
|
configFile: false,
|
|
919
929
|
plugins: [react()],
|
|
920
930
|
resolve: {
|
|
921
|
-
dedupe: [
|
|
931
|
+
dedupe: [...REACT_CONTEXT_PACKAGES]
|
|
922
932
|
},
|
|
923
933
|
build: {
|
|
924
934
|
outDir: uiOutputDir,
|
|
@@ -17507,6 +17517,7 @@ import { WebSocketServer } from "ws";
|
|
|
17507
17517
|
|
|
17508
17518
|
// cli/core/listen-with-fallback.ts
|
|
17509
17519
|
import { createServer as createSocket } from "net";
|
|
17520
|
+
var PORT_IN_USE_HINT = "`sdk dev status` says whether a dev server is already running for this package. Pass --port auto to take any free port.";
|
|
17510
17521
|
async function listenWithPortFallback(server, startPort, options = {}) {
|
|
17511
17522
|
const maxAttempts = options.maxAttempts ?? 100;
|
|
17512
17523
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
@@ -17520,7 +17531,8 @@ async function listenWithPortFallback(server, startPort, options = {}) {
|
|
|
17520
17531
|
}
|
|
17521
17532
|
throw new CliError(
|
|
17522
17533
|
"PORT_IN_USE",
|
|
17523
|
-
`Could not find available port after ${maxAttempts} attempts
|
|
17534
|
+
`Could not find available port after ${maxAttempts} attempts`,
|
|
17535
|
+
{ hint: PORT_IN_USE_HINT }
|
|
17524
17536
|
);
|
|
17525
17537
|
}
|
|
17526
17538
|
function tryListen(server, port, host) {
|
|
@@ -17558,7 +17570,8 @@ async function findFreePort(startPort, maxAttempts = 100) {
|
|
|
17558
17570
|
}
|
|
17559
17571
|
throw new CliError(
|
|
17560
17572
|
"PORT_IN_USE",
|
|
17561
|
-
`Could not find available port after ${maxAttempts} attempts
|
|
17573
|
+
`Could not find available port after ${maxAttempts} attempts`,
|
|
17574
|
+
{ hint: PORT_IN_USE_HINT }
|
|
17562
17575
|
);
|
|
17563
17576
|
}
|
|
17564
17577
|
var PROBED_ADDRESSES = [void 0, "127.0.0.1", "::1"];
|
|
@@ -91,6 +91,7 @@ pnpm run build
|
|
|
91
91
|
## Running the tests
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
+
pnpm check # everything below but the browser tests, after validating, typechecking and linting
|
|
94
95
|
pnpm test:run # the engine's arithmetic, and every surface
|
|
95
96
|
pnpm test:engine # the whole game, day by day, in-process
|
|
96
97
|
pnpm test:e2e # the surfaces in a browser, against a dev server of its own
|
|
@@ -18,7 +18,7 @@ The engine runs each tick. It reads from capabilities and returns the ones it wr
|
|
|
18
18
|
4. **Implement `Init` and `Run`** in `engine/logic.ts`. Both are async, both take `{ context, settings, callbacks, meta }`, and both return `{ capabilities: Context }`. Never mutate `context`: always spread. Optionally, return `state` beside `capabilities` for memory only the engine needs between ticks (it comes back as `state`; type it with `RunFunction`'s fourth parameter), and return `complete: true` from `Run` to end the game for that team. A simulation with several steps calls them as plain functions from its one `Run`: type each as `StepFunction<Context, Settings>`, pass the context along flat, and wrap only the final one.
|
|
19
19
|
5. **Check the types.** `new` and `update` regenerate `engine/types.ts`; run `pnpm run generate` yourself only after editing the bundle by hand.
|
|
20
20
|
6. **Test it.** Unit tests go in `engine/logic.test.ts`, covering at least the happy path and every branch in `Run`. Whole-game behaviour across several ticks goes in `testing/engine/` and runs with `pnpm test:engine`.
|
|
21
|
-
7. **Verify**: `pnpm
|
|
21
|
+
7. **Verify**: `pnpm check`, which validates the package, typechecks, lints and runs the unit and engine tests, stopping at the first that fails. The engine tests run the logic in the restricted production runtime, so keep one that plays a tick of every scenario. `pnpm run --silent sdk tick --no-server --summary` plays one tick by hand. A running dev server picks up the edit from its next tick, without a reset.
|
|
22
22
|
|
|
23
23
|
## Things that almost always go wrong
|
|
24
24
|
|
|
@@ -18,7 +18,7 @@ A user interface is a React app that reads game state and (optionally) sends dec
|
|
|
18
18
|
4. **Implement the components** under `ui/src/` (the entry component is `App.tsx`), with `useUserInterfaceData()` for `data`, `settings`, `setData` and `completedTicks`. Default to MUI; another library must integrate with `useUserInterfaceTheme` so dark mode and colour palettes work, and text on a theme colour uses that colour's `contrastText`. Remember a viewer's own choices with `useViewerStorage`, never `localStorage`. Put every string in `src/i18n.ts`. `pnpm run --silent sdk docs view guides/ui.md` is the reference for every hook, with the topic pages it links.
|
|
19
19
|
5. **Await every write.** `setData` returns a promise that rejects when the host refuses the write. Route writes through `useMutationReporter`, as the starter game's `ui/src/writes.ts` does, so the participant sees the refusal. Never retry a write automatically: on a `conflict` the host has already retried and given up, so offer `failure.retry` behind a 'Try again' button instead.
|
|
20
20
|
6. **Add a test** beside the component (`App.test.tsx`), rendered with `renderUserInterface()` (or `renderSessionUserInterface<SessionData>()`, `renderSettingsEditor()`) from `@seriousgaming/sdk/ui/testing`, as the starter game's tests do. `pnpm run --silent sdk docs view guides/testing.md` has the harness.
|
|
21
|
-
7. **Verify**: `pnpm
|
|
21
|
+
7. **Verify**: `pnpm check`, then `pnpm run build`. A running dev server hot-reloads the UI. The user starts the dev server (`pnpm run sdk dev`) when they want to see it; never start it yourself.
|
|
22
22
|
|
|
23
23
|
## Things that almost always go wrong
|
|
24
24
|
|
|
@@ -18,7 +18,7 @@ Unit and component tests live next to the source they cover: the engine's `engin
|
|
|
18
18
|
2. **For logic**, call `Init`, `Run`, a hook, an endpoint or a validator directly with arguments built by `logicArgs` from `@seriousgaming/sdk/testing` (`logicArgs.run({ context, settings: defaultSettings })`), and assert on the returned `capabilities`. For behaviour across several ticks, hooks, validators, endpoints, participants, undo or automatic ticks, use `createTestSession<Context, SharedContext>` in `testing/engine/`: it runs the session the dev server runs, in-process, with offline stubs for `generateText`, `generateSpeech` and `extractText`. The references are `pnpm run --silent sdk docs view guides/testing.md` and `guides/engine-testing.md`.
|
|
19
19
|
3. **For UI components**, render with `renderUserInterface()` (or `renderSessionUserInterface()`, or `renderSettingsEditor()` for setup and the scenario editor) from `@seriousgaming/sdk/ui/testing`, which supplies every provider the host does. Never `vi.mock` the SDK contexts, and never wire the providers by hand. For a session UI, pass the generated types: `renderSessionUserInterface<SessionData>()`, with fixtures from `createMockTeamState<TeamContext>()` and `createMockSharedState<SharedContext>()`, so a shared capability left on a team fixture fails to compile.
|
|
20
20
|
4. **Cover the branches.** One test per code path: the happy path plus each failure mode, each option flag, each conditional in `Run`.
|
|
21
|
-
5. **Run the tests**: `pnpm test:run` and `pnpm test:engine
|
|
21
|
+
5. **Run the tests**: `pnpm test:run` and `pnpm test:engine`, or `pnpm check` for both after validating, typechecking and linting. `pnpm test` is watch mode, so leave it to the user. `pnpm test:e2e` starts an isolated dev server for each Playwright worker on free ports, beside any the user has running, and serves them surfaces built once by `testing/e2e/global-setup.ts`. Import `test` from `@seriousgaming/sdk-tools/playwright` in a spec, not from `@playwright/test`.
|
|
22
22
|
|
|
23
23
|
## Things that almost always go wrong
|
|
24
24
|
|
|
@@ -26,9 +26,9 @@ The SDK ships as three npm packages: `@seriousgaming/sdk` (runtime), `@seriousga
|
|
|
26
26
|
The package also lists `@seriousgaming/sdk` under `peerDependencies`; move that range to match.
|
|
27
27
|
4. **Regenerate types**: `pnpm run generate`. New schema fields, renames, or removed fields all surface through the generated `types.ts` files.
|
|
28
28
|
5. **Build and address breakages**: `pnpm run build`. Work through type errors and address each Breaking Changes entry from step 2.
|
|
29
|
-
6. **Run the
|
|
29
|
+
6. **Run the checks**: `pnpm check`, or `pnpm test:run` and `pnpm test:engine` in a package that has no `check` script yet.
|
|
30
30
|
7. **Adopt updated scaffold guidance**. The SDK's own guidance ships in `node_modules/@seriousgaming/sdk-tools/dist/agent/guidance.md`, and `CLAUDE.md` imports it with its first line, so it updates with the version you just installed and needs no merging. The `.claude/rules/` files are copied into the package, so it keeps whatever it was scaffolded with. The new version ships its templates inside the installed package, so both sides of the diff are on disk. Check three places and fold in anything relevant:
|
|
31
|
-
1. The
|
|
31
|
+
1. The **Scaffold changes** section of every release between the old and new version (from step 2; releases from 1.11 carry one whenever a scaffolded file, a shipped rule or the guidance changed). Each line names a file, says what changed and why, and ends with `Adopt:` and whether to. Work through them in order, oldest release first, applying each `Adopt: yes` to the local file and weighing each `Adopt: optional`. For a release before 1.11, read its entries for anything mentioning scaffold, guidance, rules, or `CLAUDE.md`.
|
|
32
32
|
2. The shipped rules in `node_modules/@seriousgaming/sdk-tools/dist/templates/package/claude/rules/` against the local `.claude/rules/`: copy rule files that don't exist locally; for rules that do exist, diff the two and incorporate new guidance while keeping local edits.
|
|
33
33
|
3. The first line of the local `CLAUDE.md`. If it is not `@node_modules/@seriousgaming/sdk-tools/dist/agent/guidance.md`, the package predates the import: replace the SDK's text in `CLAUDE.md` (everything copied from the old template) with the first three lines of `node_modules/@seriousgaming/sdk-tools/dist/templates/package/CLAUDE.md.template`, and keep what the package wrote about itself below them. There is no command that refreshes it.
|
|
34
34
|
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
|
3
|
-
"ignorePatterns": [
|
|
3
|
+
"ignorePatterns": [
|
|
4
|
+
"**/*.sdk.json",
|
|
5
|
+
"seriousgaming.sdk.json",
|
|
6
|
+
"**/types.ts",
|
|
7
|
+
"lib/",
|
|
8
|
+
"test-results/",
|
|
9
|
+
"playwright-report/"
|
|
10
|
+
],
|
|
4
11
|
"semi": true,
|
|
5
12
|
"trailingComma": "es5",
|
|
6
13
|
"singleQuote": true,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"extends": ["./node_modules/@seriousgaming/sdk-tools/dist/oxlint/logic.json"],
|
|
3
4
|
"plugins": null,
|
|
4
5
|
"categories": {},
|
|
5
6
|
"rules": {
|
|
@@ -41,186 +42,6 @@
|
|
|
41
42
|
"globals": {},
|
|
42
43
|
"ignorePatterns": ["**/types.ts"],
|
|
43
44
|
"overrides": [
|
|
44
|
-
{
|
|
45
|
-
"files": [
|
|
46
|
-
"engine/**/*.ts",
|
|
47
|
-
"tick_controller/**/*.ts",
|
|
48
|
-
"**/hooks/*/logic/**/*.ts",
|
|
49
|
-
"**/validators/*/logic/**/*.ts",
|
|
50
|
-
"**/endpoints/*/logic/**/*.ts"
|
|
51
|
-
],
|
|
52
|
-
"rules": {
|
|
53
|
-
"no-restricted-globals": [
|
|
54
|
-
"error",
|
|
55
|
-
{
|
|
56
|
-
"name": "structuredClone",
|
|
57
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Context is JSON-serialisable, so JSON.parse(JSON.stringify(value)) is the portable equivalent."
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"name": "TextEncoder",
|
|
61
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Import encodeUtf8 from @seriousgaming/sdk instead."
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"name": "TextDecoder",
|
|
65
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Import decodeUtf8 from @seriousgaming/sdk instead."
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"name": "fetch",
|
|
69
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Reach external services through the injected callbacks, or through an endpoint."
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"name": "XMLHttpRequest",
|
|
73
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Reach external services through the injected callbacks, or through an endpoint."
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"name": "setTimeout",
|
|
77
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"name": "setInterval",
|
|
81
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"name": "setImmediate",
|
|
85
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"name": "queueMicrotask",
|
|
89
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Ticks are the scheduling primitive: logic must run to completion within one tick."
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"name": "process",
|
|
93
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Settings reach logic through the `settings` argument."
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"name": "Buffer",
|
|
97
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Use Uint8Array, with the SDK's encodeUtf8 / decodeUtf8 for string conversion."
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"name": "URL",
|
|
101
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics. Build asset URLs from the references and callbacks the runtime injects."
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"name": "clearTimeout",
|
|
105
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"name": "clearInterval",
|
|
109
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"name": "clearImmediate",
|
|
113
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"name": "URLSearchParams",
|
|
117
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"name": "crypto",
|
|
121
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"name": "atob",
|
|
125
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
"name": "btoa",
|
|
129
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"name": "performance",
|
|
133
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"name": "ReadableStream",
|
|
137
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
"name": "WritableStream",
|
|
141
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"name": "TransformStream",
|
|
145
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"name": "Blob",
|
|
149
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"name": "File",
|
|
153
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
"name": "FormData",
|
|
157
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
"name": "Headers",
|
|
161
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
"name": "Request",
|
|
165
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"name": "Response",
|
|
169
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
"name": "AbortController",
|
|
173
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"name": "EventTarget",
|
|
177
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
"name": "WebSocket",
|
|
181
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
"name": "localStorage",
|
|
185
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"name": "sessionStorage",
|
|
189
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
"name": "window",
|
|
193
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
"name": "document",
|
|
197
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
"name": "navigator",
|
|
201
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"name": "require",
|
|
205
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
"name": "__dirname",
|
|
209
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"name": "__filename",
|
|
213
|
-
"message": "Not available in the production runtime, which is a bare V8 isolate exposing only the ECMAScript intrinsics."
|
|
214
|
-
}
|
|
215
|
-
]
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
"files": ["**/*.test.ts", "**/*.spec.ts"],
|
|
220
|
-
"rules": {
|
|
221
|
-
"no-restricted-globals": "off"
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
45
|
{
|
|
225
46
|
"files": ["**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/testing/**"],
|
|
226
47
|
"rules": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"generate": "pnpm run sdk generate",
|
|
13
13
|
"build": "pnpm run sdk build",
|
|
14
|
+
"check": "pnpm run --silent sdk build --validate-only && pnpm run --silent typecheck && pnpm run --silent lint && pnpm run --silent test:run --passWithNoTests && pnpm run --silent test:engine --passWithNoTests",
|
|
14
15
|
"start": "pnpm run sdk dev",
|
|
15
16
|
"test": "vitest",
|
|
16
17
|
"test:run": "vitest run",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { REACT_CONTEXT_PACKAGES } from '@seriousgaming/sdk-tools/vite';
|
|
1
2
|
import { defineConfig } from 'vite';
|
|
2
3
|
|
|
3
4
|
export default defineConfig({
|
|
@@ -7,13 +8,6 @@ export default defineConfig({
|
|
|
7
8
|
// hook reads empty data: React's "Invalid hook call" when MUI bundles
|
|
8
9
|
// its own React, or an SDK hook in a shared package of yours that
|
|
9
10
|
// finds none of the providers the host set up.
|
|
10
|
-
dedupe: [
|
|
11
|
-
'react',
|
|
12
|
-
'react-dom',
|
|
13
|
-
'@emotion/react',
|
|
14
|
-
'@emotion/styled',
|
|
15
|
-
'@seriousgaming/sdk',
|
|
16
|
-
'@seriousgaming/deck',
|
|
17
|
-
],
|
|
11
|
+
dedupe: [...REACT_CONTEXT_PACKAGES],
|
|
18
12
|
},
|
|
19
13
|
});
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
+
import { REACT_CONTEXT_PACKAGES } from '@seriousgaming/sdk-tools/vite';
|
|
1
2
|
import { defineConfig } from 'vitest/config';
|
|
2
3
|
|
|
3
4
|
export default defineConfig({
|
|
4
5
|
resolve: {
|
|
5
6
|
// The same single copies vite.config.ts asks for, so a test renders
|
|
6
7
|
// with the providers the component reads.
|
|
7
|
-
dedupe: [
|
|
8
|
-
'react',
|
|
9
|
-
'react-dom',
|
|
10
|
-
'@emotion/react',
|
|
11
|
-
'@emotion/styled',
|
|
12
|
-
'@seriousgaming/sdk',
|
|
13
|
-
'@seriousgaming/deck',
|
|
14
|
-
],
|
|
8
|
+
dedupe: [...REACT_CONTEXT_PACKAGES],
|
|
15
9
|
},
|
|
16
10
|
esbuild: {
|
|
17
11
|
jsx: 'automatic',
|