create-substrat 0.11.0 → 0.11.1
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/index.js +10 -11
- package/package.json +1 -1
- package/project-files.js +8 -0
- package/template/AGENTS.md +5 -0
- package/template/vitest.ui.config.ts +9 -21
package/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { basename, dirname, join, resolve } from 'node:path';
|
|
|
17
17
|
import { fileURLToPath } from 'node:url';
|
|
18
18
|
|
|
19
19
|
import { DEV_SERVERS } from './dev-servers.js';
|
|
20
|
-
import { TSCONFIG, VITEST_CONFIG } from './project-files.js';
|
|
20
|
+
import { TEST_RUNNER, TSCONFIG, VITEST_CONFIG } from './project-files.js';
|
|
21
21
|
|
|
22
22
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
23
23
|
const TEMPLATE = join(HERE, 'template');
|
|
@@ -36,12 +36,12 @@ const TEMPLATE = join(HERE, 'template');
|
|
|
36
36
|
// The runtime packages release together off one version line (the changesets `fixed`
|
|
37
37
|
// group), so one constant is right for all of them. Engines do NOT share a line —
|
|
38
38
|
// each versions on its own, so one pin per engine, deliberately.
|
|
39
|
-
const SUBSTRAT = '^0.
|
|
40
|
-
const ENGINE_WORKORDER = '^0.12.
|
|
41
|
-
const ENGINE_INVOICING = '^0.11.
|
|
42
|
-
const BOUNDARY_LINT = '^0.6.
|
|
43
|
-
const DEV_ISSUER = '^0.2.
|
|
44
|
-
const ATTACHMENT_EXTRACTORS = '^0.2.
|
|
39
|
+
const SUBSTRAT = '^0.141.0';
|
|
40
|
+
const ENGINE_WORKORDER = '^0.12.25';
|
|
41
|
+
const ENGINE_INVOICING = '^0.11.25';
|
|
42
|
+
const BOUNDARY_LINT = '^0.6.2';
|
|
43
|
+
const DEV_ISSUER = '^0.2.23';
|
|
44
|
+
const ATTACHMENT_EXTRACTORS = '^0.2.2';
|
|
45
45
|
|
|
46
46
|
const DOCS = 'https://substrat.net';
|
|
47
47
|
|
|
@@ -114,8 +114,8 @@ function packageJson(name) {
|
|
|
114
114
|
issuer: 'substrat-dev-issuer --personas src/personas.ts',
|
|
115
115
|
server: 'tsx src/server.ts',
|
|
116
116
|
test: 'vitest run',
|
|
117
|
-
// The live test dashboard
|
|
118
|
-
// .
|
|
117
|
+
// The live test dashboard: the `tests` entry of .claude/launch.json, opened at the
|
|
118
|
+
// tokenised URL vitest prints. `--watch` is explicit, since vitest runs once and exits without a TTY.
|
|
119
119
|
'test:ui': 'vitest --watch --ui --open=false -c vitest.ui.config.ts',
|
|
120
120
|
typecheck: 'tsc --noEmit && tsc -p tsconfig.worker.json --noEmit',
|
|
121
121
|
'lint:boundaries': 'substrat-boundary-lint',
|
|
@@ -144,8 +144,7 @@ function packageJson(name) {
|
|
|
144
144
|
concurrently: '^9.0.0',
|
|
145
145
|
tsx: '^4.19.0',
|
|
146
146
|
typescript: '^5.6.0',
|
|
147
|
-
|
|
148
|
-
'@vitest/ui': '^3.0.0',
|
|
147
|
+
...TEST_RUNNER,
|
|
149
148
|
},
|
|
150
149
|
// Do NOT add `zod` here — import `z` from `@substrat-run/contracts` (AGENTS.md, rule 10).
|
|
151
150
|
// better-sqlite3 >=13 ships prebuilt binaries for every supported platform and
|
package/package.json
CHANGED
package/project-files.js
CHANGED
|
@@ -52,3 +52,11 @@ export default defineConfig({
|
|
|
52
52
|
},
|
|
53
53
|
});
|
|
54
54
|
`;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The test runner a scaffold installs. Here rather than inline in `index.js`'s `packageJson()`
|
|
58
|
+
* so `tools/template-sync.mjs` can hold it to the vitest the workspace runs the template on
|
|
59
|
+
* (#2129): `packages/template-check` tests the template on the catalog's vitest, and a scaffold
|
|
60
|
+
* on a different major is a project nothing on a PR has ever run.
|
|
61
|
+
*/
|
|
62
|
+
export const TEST_RUNNER = { vitest: '^5.0.0', '@vitest/ui': '^5.0.0' };
|
package/template/AGENTS.md
CHANGED
|
@@ -336,6 +336,11 @@ The page worth opening first on a vertical that serves the Scalar API reference
|
|
|
336
336
|
vertical's own origin, so a try-it request carries the session cookie you already have and
|
|
337
337
|
a 403 in the playground is the permission system working rather than a broken page.
|
|
338
338
|
|
|
339
|
+
The `tests` entry is the one whose bare origin shows nothing: the vitest dashboard serves
|
|
340
|
+
only the URL it prints when it starts (`UI started at …/__vitest__/?token=…`) and answers a
|
|
341
|
+
403 without the token, which guards an API that can write files and run code. Take that URL
|
|
342
|
+
from the server's output; never work around the token.
|
|
343
|
+
|
|
339
344
|
## When it breaks — symptom → fix
|
|
340
345
|
|
|
341
346
|
Six failures that have each cost someone a day. What makes them expensive is that none of
|
|
@@ -1,32 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The config behind `pnpm test:ui` — your own `vitest.config.ts`, plus the live test
|
|
3
|
-
* dashboard
|
|
4
|
-
* the `tests` entry).
|
|
3
|
+
* dashboard on a fixed port (`.claude/launch.json`, the `tests` entry).
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* Open it at the URL vitest prints when it starts (`UI started at
|
|
6
|
+
* http://127.0.0.1:5290/__vitest__/?token=…`). The dashboard refuses any request without that
|
|
7
|
+
* token, because its API can re-run your tests, write files and run code; the token is what
|
|
8
|
+
* keeps another page in your browser from driving it. So nothing here redirects the bare
|
|
9
|
+
* origin to it. `VITEST_UI_PORT` moves the port; it binds 127.0.0.1 only. The port is strict:
|
|
10
|
+
* a busy one fails the start rather than moving the dashboard somewhere the launch entry does
|
|
11
|
+
* not point.
|
|
11
12
|
*/
|
|
12
|
-
import { mergeConfig
|
|
13
|
+
import { mergeConfig } from 'vitest/config';
|
|
13
14
|
|
|
14
15
|
import base from './vitest.config.ts';
|
|
15
16
|
|
|
16
|
-
const redirectRootToUi: Plugin = {
|
|
17
|
-
name: 'substrat:vitest-ui-root',
|
|
18
|
-
configureServer(server) {
|
|
19
|
-
server.middlewares.use((req, res, next) => {
|
|
20
|
-
if (req.url !== '/') return next();
|
|
21
|
-
res.statusCode = 302;
|
|
22
|
-
res.setHeader('Location', '/__vitest__/');
|
|
23
|
-
res.end();
|
|
24
|
-
});
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
17
|
export default mergeConfig(base, {
|
|
29
|
-
plugins: [redirectRootToUi],
|
|
30
18
|
test: {
|
|
31
19
|
api: {
|
|
32
20
|
host: '127.0.0.1',
|