create-substrat 0.11.0 → 0.11.2

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 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.140.0';
40
- const ENGINE_WORKORDER = '^0.12.24';
41
- const ENGINE_INVOICING = '^0.11.24';
42
- const BOUNDARY_LINT = '^0.6.1';
43
- const DEV_ISSUER = '^0.2.22';
44
- const ATTACHMENT_EXTRACTORS = '^0.2.1';
39
+ const SUBSTRAT = '^0.142.0';
40
+ const ENGINE_WORKORDER = '^0.12.26';
41
+ const ENGINE_INVOICING = '^0.11.26';
42
+ const BOUNDARY_LINT = '^0.6.2';
43
+ const DEV_ISSUER = '^0.2.24';
44
+ const ATTACHMENT_EXTRACTORS = '^0.2.3';
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 in the Browser pane: the `tests` entry of
118
- // .claude/launch.json. `--watch` is explicit, since vitest runs once and exits without a TTY.
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
- vitest: '^3.0.0',
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-substrat",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Scaffold a Substrat vertical — `npm create substrat <dir>`.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
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' };
@@ -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 served on a port Claude Desktop's Browser pane can open (`.claude/launch.json`,
4
- * the `tests` entry).
3
+ * dashboard on a fixed port (`.claude/launch.json`, the `tests` entry).
5
4
  *
6
- * The UI lives at `/__vitest__/` and the bare origin is a 404, but a launch entry carries
7
- * a port and never a path, so `/` is redirected to the UI here. `VITEST_UI_PORT` moves
8
- * the port; it binds 127.0.0.1 only, since the dashboard can re-run your tests. The port
9
- * is strict: a busy one fails the start rather than moving the dashboard somewhere the
10
- * launch entry does not point.
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, type Plugin } from 'vitest/config';
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',