@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
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"generate": "pnpm run sdk generate",
|
|
15
15
|
"build": "pnpm run sdk build",
|
|
16
|
+
"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",
|
|
16
17
|
"start": "pnpm run sdk dev",
|
|
17
18
|
"test": "vitest",
|
|
18
19
|
"test:run": "vitest run",
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
"lint:fix": "oxlint --fix",
|
|
23
24
|
"format": "oxfmt",
|
|
24
25
|
"format:check": "oxfmt --check",
|
|
25
|
-
"typecheck": "tsc --noEmit",
|
|
26
|
+
"typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck.tsbuildinfo",
|
|
26
27
|
"sdk": "vite-node node_modules/@seriousgaming/sdk-tools/cli/cli.ts",
|
|
27
28
|
"test:e2e": "playwright test"
|
|
28
29
|
},
|
|
@@ -12,29 +12,25 @@
|
|
|
12
12
|
* Run with: pnpm test:engine
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import { readdirSync } from 'fs';
|
|
16
|
+
import { join } from 'path';
|
|
15
17
|
import { fileURLToPath } from 'url';
|
|
16
18
|
|
|
17
19
|
import { createTestSession, type TestSession } from '@seriousgaming/sdk-tools/client';
|
|
18
20
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/** The context is untyped here, so each read says what it expects to find. */
|
|
25
|
-
const cap = (context: Context, key: string) => context[key] as Record<string, unknown>;
|
|
26
|
-
|
|
27
|
-
const numberField = (context: Context, key: string, field: string) =>
|
|
28
|
-
cap(context, key)[field] as number;
|
|
22
|
+
// The engine's generated `Context` holds the capabilities the engine reads and
|
|
23
|
+
// writes, which are the ones these tests play. A capability only a hook or a
|
|
24
|
+
// surface writes is in the team's context too, and not in this type.
|
|
25
|
+
import type { Context } from '../../engine/types';
|
|
29
26
|
|
|
30
|
-
const
|
|
31
|
-
cap(context, key)[field] as Record<string, number>;
|
|
27
|
+
const PACKAGE_PATH = fileURLToPath(new URL('../..', import.meta.url));
|
|
32
28
|
|
|
33
29
|
describe('Lemonade Stand', () => {
|
|
34
|
-
let game: TestSession
|
|
30
|
+
let game: TestSession<Context>;
|
|
35
31
|
|
|
36
32
|
beforeEach(async () => {
|
|
37
|
-
game = await createTestSession({ packagePath: PACKAGE_PATH });
|
|
33
|
+
game = await createTestSession<Context>({ packagePath: PACKAGE_PATH });
|
|
38
34
|
});
|
|
39
35
|
|
|
40
36
|
afterEach(async () => {
|
|
@@ -52,8 +48,14 @@ describe('Lemonade Stand', () => {
|
|
|
52
48
|
|
|
53
49
|
/** Open the stall for a day, and fail loudly if the session refused. */
|
|
54
50
|
const tick = async (): Promise<Context> => {
|
|
55
|
-
const result = await game.
|
|
56
|
-
if (!result.ok)
|
|
51
|
+
const result = await game.tick();
|
|
52
|
+
if (!result.ok) {
|
|
53
|
+
// When the engine threw, the result says where: the same file,
|
|
54
|
+
// line, tick and team `sdk tick` reports.
|
|
55
|
+
const at = result.logicError;
|
|
56
|
+
const where = at ? ` at ${at.file}:${at.line} (tick ${at.tick})` : '';
|
|
57
|
+
throw new Error(`The day was refused: ${result.outcome.kind}${where}`);
|
|
58
|
+
}
|
|
57
59
|
return stall();
|
|
58
60
|
};
|
|
59
61
|
|
|
@@ -67,11 +69,10 @@ describe('Lemonade Stand', () => {
|
|
|
67
69
|
expect(result.ok).toBe(true);
|
|
68
70
|
};
|
|
69
71
|
|
|
70
|
-
const lines = (context: Context) =>
|
|
71
|
-
cap(context, 'results').Lines as Record<string, Record<string, number>>;
|
|
72
|
+
const lines = (context: Context) => context.results.Lines;
|
|
72
73
|
|
|
73
74
|
it('starts every item on the menu at a number the stall can make', () => {
|
|
74
|
-
const plan =
|
|
75
|
+
const plan = stall().plan.Make;
|
|
75
76
|
|
|
76
77
|
expect(Object.keys(plan).sort()).toEqual(['cookies', 'icedtea', 'lemonade']);
|
|
77
78
|
expect(Object.values(plan).reduce((sum, count) => sum + count, 0)).toBeLessThanOrEqual(120);
|
|
@@ -79,8 +80,8 @@ describe('Lemonade Stand', () => {
|
|
|
79
80
|
|
|
80
81
|
it('opens with nothing traded and a forecast for the first day', () => {
|
|
81
82
|
expect(day()).toBe(0);
|
|
82
|
-
expect(
|
|
83
|
-
expect(['sunny', 'cloudy', 'rainy']).toContain(
|
|
83
|
+
expect(stall().results.Day).toBe(0);
|
|
84
|
+
expect(['sunny', 'cloudy', 'rainy']).toContain(stall().weather.Today);
|
|
84
85
|
});
|
|
85
86
|
|
|
86
87
|
it('sells what it made, and turns the rest away', async () => {
|
|
@@ -98,32 +99,30 @@ describe('Lemonade Stand', () => {
|
|
|
98
99
|
|
|
99
100
|
expect(lines(context).cookies!.PouredAway).toBeGreaterThan(0);
|
|
100
101
|
// 100 cookies at 25p, whatever the day did.
|
|
101
|
-
expect(
|
|
102
|
-
expect(
|
|
102
|
+
expect(context.results.Spent).toBe(100 * 25);
|
|
103
|
+
expect(context.results.Profit).toBeLessThan(0);
|
|
103
104
|
});
|
|
104
105
|
|
|
105
106
|
it('makes more money matching the forecast than ignoring it', async () => {
|
|
106
|
-
await make(
|
|
107
|
+
await make(stall().weather.Expected);
|
|
107
108
|
for (let round = 0; round < 5; round += 1) await tick();
|
|
108
|
-
const matched =
|
|
109
|
+
const matched = stall().results.Purse;
|
|
109
110
|
|
|
110
111
|
expect((await game.send({ type: 'reinitialise' })).ok).toBe(true);
|
|
111
112
|
await make({ lemonade: 0, icedtea: 0, cookies: 0 });
|
|
112
113
|
for (let round = 0; round < 5; round += 1) await tick();
|
|
113
|
-
const nothing =
|
|
114
|
+
const nothing = stall().results.Purse;
|
|
114
115
|
|
|
115
116
|
expect(matched).toBeGreaterThan(nothing);
|
|
116
117
|
});
|
|
117
118
|
|
|
118
119
|
it('keeps a running purse across days', async () => {
|
|
119
|
-
await make(
|
|
120
|
+
await make(stall().weather.Expected);
|
|
120
121
|
|
|
121
122
|
const first = await tick();
|
|
122
123
|
const second = await tick();
|
|
123
124
|
|
|
124
|
-
expect(
|
|
125
|
-
numberField(first, 'results', 'Profit') + numberField(second, 'results', 'Profit')
|
|
126
|
-
);
|
|
125
|
+
expect(second.results.Purse).toBe(first.results.Profit + second.results.Profit);
|
|
127
126
|
});
|
|
128
127
|
|
|
129
128
|
it('labels each day with its own number', async () => {
|
|
@@ -131,31 +130,31 @@ describe('Lemonade Stand', () => {
|
|
|
131
130
|
await tick();
|
|
132
131
|
await tick();
|
|
133
132
|
|
|
134
|
-
expect(
|
|
133
|
+
expect(stall().results.Day).toBe(3);
|
|
135
134
|
});
|
|
136
135
|
|
|
137
136
|
it('plays the day it forecast, not a different one', async () => {
|
|
138
|
-
const forecastForDayOne =
|
|
137
|
+
const forecastForDayOne = stall().weather.Today;
|
|
139
138
|
|
|
140
139
|
const context = await tick();
|
|
141
140
|
|
|
142
|
-
expect(
|
|
141
|
+
expect(context.results.Weather).toBe(forecastForDayOne);
|
|
143
142
|
// And it has moved on to forecasting day two.
|
|
144
|
-
expect(['sunny', 'cloudy', 'rainy']).toContain(
|
|
143
|
+
expect(['sunny', 'cloudy', 'rainy']).toContain(context.weather.Today);
|
|
145
144
|
});
|
|
146
145
|
|
|
147
146
|
it('leaves the plan alone, so yesterday carries into today', async () => {
|
|
148
147
|
await make({ lemonade: 44, icedtea: 0, cookies: 0 });
|
|
149
148
|
const context = await tick();
|
|
150
149
|
|
|
151
|
-
expect(
|
|
150
|
+
expect(context.plan.Make).toEqual({ lemonade: 44, icedtea: 0, cookies: 0 });
|
|
152
151
|
});
|
|
153
152
|
|
|
154
153
|
it('trades its ten days', async () => {
|
|
155
154
|
for (let round = 0; round < 10; round += 1) await tick();
|
|
156
155
|
|
|
157
156
|
expect(day()).toBe(10);
|
|
158
|
-
expect(
|
|
157
|
+
expect(stall().results.Day).toBe(10);
|
|
159
158
|
});
|
|
160
159
|
|
|
161
160
|
it('undo takes back the last day', async () => {
|
|
@@ -165,7 +164,33 @@ describe('Lemonade Stand', () => {
|
|
|
165
164
|
expect((await game.send({ type: 'undo' })).ok).toBe(true);
|
|
166
165
|
|
|
167
166
|
expect(day()).toBe(0);
|
|
168
|
-
expect(
|
|
169
|
-
expect(
|
|
167
|
+
expect(stall().results.Purse).toBe(0);
|
|
168
|
+
expect(stall().results.Day).toBe(0);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Every scenario has to start and play a day. A scenario overrides settings,
|
|
174
|
+
* and a value the engine cannot work with (a menu with no items, a demand of
|
|
175
|
+
* zero it divides by) only shows when the game is played on it. Read from disk
|
|
176
|
+
* rather than listed, so a new scenario is covered the day it is added.
|
|
177
|
+
*/
|
|
178
|
+
describe('every scenario', () => {
|
|
179
|
+
const scenarios = readdirSync(join(PACKAGE_PATH, 'scenarios'), { withFileTypes: true })
|
|
180
|
+
.filter((entry) => entry.isDirectory())
|
|
181
|
+
.map((entry) => entry.name);
|
|
182
|
+
|
|
183
|
+
it('is a set this test can see', () => {
|
|
184
|
+
expect(scenarios.length).toBeGreaterThan(0);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it.each(scenarios)('%s starts and plays a day', async (scenarioId) => {
|
|
188
|
+
const game = await createTestSession<Context>({ packagePath: PACKAGE_PATH, scenarioId });
|
|
189
|
+
try {
|
|
190
|
+
expect(await game.tick()).toMatchObject({ ok: true });
|
|
191
|
+
expect(game.team(0).context.results.Day).toBe(1);
|
|
192
|
+
} finally {
|
|
193
|
+
await game.close();
|
|
194
|
+
}
|
|
170
195
|
});
|
|
171
196
|
});
|
|
@@ -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,10 +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
|
-
//
|
|
7
|
-
dedupe: [
|
|
6
|
+
// The same single copies vite.config.ts asks for, so a test renders
|
|
7
|
+
// with the providers the component reads.
|
|
8
|
+
dedupe: [...REACT_CONTEXT_PACKAGES],
|
|
8
9
|
},
|
|
9
10
|
test: {
|
|
10
11
|
// Exclude engine tests (node env, separate config) and Playwright specs
|
|
@@ -37,3 +37,8 @@ export declare function resourceNames(packagePath: string, meta: ResourceMeta):
|
|
|
37
37
|
export declare function bundlePaths(packagePath: string, meta: ResourceMeta): string[];
|
|
38
38
|
/** The absolute path to one resource's bundle, or undefined when it is absent. */
|
|
39
39
|
export declare function findBundleFile(packagePath: string, type: ResourceType, identifier?: string): string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* What to tell someone who named a resource that is not there: the ones of
|
|
42
|
+
* that type the package does hold, or how to make the first.
|
|
43
|
+
*/
|
|
44
|
+
export declare function existingResourcesHint(packagePath: string, type: ResourceType): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a game's Vite and Vitest configs need from the SDK.
|
|
3
|
+
*
|
|
4
|
+
* Imported from `@seriousgaming/sdk-tools/vite` by a `vite.config.ts` or a
|
|
5
|
+
* `vitest.config.ts`, so it stays free of the CLI and the dev server: a config
|
|
6
|
+
* file is loaded on every run.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Every package that holds React context a surface reads, for
|
|
10
|
+
* `resolve.dedupe`.
|
|
11
|
+
*
|
|
12
|
+
* A second copy of one of these brings contexts of its own, so a hook finds
|
|
13
|
+
* none of the providers the host set up: React's 'Invalid hook call' when a
|
|
14
|
+
* dependency bundles its own React, or an SDK hook in a shared package of
|
|
15
|
+
* yours that reads empty data. `sdk build` dedupes them itself; a
|
|
16
|
+
* `vite.config.ts` and a `vitest.config.ts` ask for the same single copies:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { REACT_CONTEXT_PACKAGES } from '@seriousgaming/sdk-tools/vite';
|
|
20
|
+
* import { defineConfig } from 'vite';
|
|
21
|
+
*
|
|
22
|
+
* export default defineConfig({
|
|
23
|
+
* resolve: { dedupe: [...REACT_CONTEXT_PACKAGES] },
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* The list grows when the SDK gains a package that holds context, which is why
|
|
28
|
+
* a game reads it from here rather than keeping a copy.
|
|
29
|
+
*/
|
|
30
|
+
export declare const REACT_CONTEXT_PACKAGES: readonly string[];
|
package/dist/vite.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seriousgaming/sdk-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "SDK tooling for building Serious Gaming games",
|
|
5
5
|
"homepage": "https://sdk.seriousgaming.com/",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
],
|
|
25
25
|
"runtime": [
|
|
26
26
|
"./dist/runtime/index.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"vite": [
|
|
29
|
+
"./dist/vite/index.d.ts"
|
|
27
30
|
]
|
|
28
31
|
}
|
|
29
32
|
},
|
|
@@ -36,6 +39,10 @@
|
|
|
36
39
|
"types": "./dist/client/playwright.d.ts",
|
|
37
40
|
"default": "./dist/playwright.js"
|
|
38
41
|
},
|
|
42
|
+
"./vite": {
|
|
43
|
+
"types": "./dist/vite/index.d.ts",
|
|
44
|
+
"default": "./dist/vite.js"
|
|
45
|
+
},
|
|
39
46
|
"./host": {
|
|
40
47
|
"types": "./dist/host/index.d.ts",
|
|
41
48
|
"default": "./dist/host.js"
|
|
@@ -45,6 +52,7 @@
|
|
|
45
52
|
"default": "./dist/runtime.js"
|
|
46
53
|
},
|
|
47
54
|
"./schema.json": "./dist/schema.json",
|
|
55
|
+
"./oxlint/logic.json": "./dist/oxlint/logic.json",
|
|
48
56
|
"./package.json": "./package.json"
|
|
49
57
|
},
|
|
50
58
|
"dependencies": {
|
|
@@ -74,7 +82,7 @@
|
|
|
74
82
|
"@mui/icons-material": "^9.5.0",
|
|
75
83
|
"@mui/material": "^9.5.0",
|
|
76
84
|
"@playwright/test": "^1.64.1",
|
|
77
|
-
"@seriousgaming/sdk": "1.
|
|
85
|
+
"@seriousgaming/sdk": "1.11.0",
|
|
78
86
|
"@testing-library/jest-dom": "^7.0.1",
|
|
79
87
|
"@testing-library/react": "^16.3.3",
|
|
80
88
|
"@types/express": "^5.0.6",
|
|
@@ -103,7 +111,7 @@
|
|
|
103
111
|
},
|
|
104
112
|
"peerDependencies": {
|
|
105
113
|
"@playwright/test": ">=1.50.0",
|
|
106
|
-
"@seriousgaming/sdk": "^1.
|
|
114
|
+
"@seriousgaming/sdk": "^1.11.0"
|
|
107
115
|
},
|
|
108
116
|
"peerDependenciesMeta": {
|
|
109
117
|
"@playwright/test": {
|
|
@@ -121,7 +129,7 @@
|
|
|
121
129
|
"lint:fix": "oxlint --fix",
|
|
122
130
|
"format": "oxfmt",
|
|
123
131
|
"format:check": "oxfmt --check",
|
|
124
|
-
"typecheck": "tsc --noEmit && tsc -p cli/dev/console --noEmit",
|
|
132
|
+
"typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck.tsbuildinfo && tsc -p cli/dev/console --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/console.tsbuildinfo",
|
|
125
133
|
"test": "vitest",
|
|
126
134
|
"test:run": "vitest run && vitest run --config cli/dev/console/vitest.config.ts",
|
|
127
135
|
"test:coverage": "vitest run --coverage",
|