@supatype/cli 0.1.10 → 0.1.11

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/cli@0.1.10 build /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.1.11 build /home/runner/work/supatype/supatype/packages/cli
3
3
  > tsc --project tsconfig.json && node --input-type=module -e "import{cpSync,mkdirSync}from'node:fs';const a='dist/assets';mkdirSync(a,{recursive:true});cpSync('assets/supatype-logo-wordmark.ascii.txt',a+'/supatype-logo-wordmark.ascii.txt')"
4
4
 
@@ -1,13 +1,14 @@
1
1
 
2
- > @supatype/cli@0.1.10 test /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.1.11 test /home/runner/work/supatype/supatype/packages/cli
3
3
  > vitest run
4
4
 
5
5
 
6
6
   RUN  v4.0.18 /home/runner/work/supatype/supatype/packages/cli
7
7
 
8
- ✓ tests/type-extractor.test.ts (43 tests) 271ms
9
- ✓ tests/access-composition.test.ts (26 tests) 323ms
10
- ✓ tests/model-hooks.test.ts (19 tests) 113ms
8
+ ✓ tests/type-extractor.test.ts (43 tests) 277ms
9
+ ✓ tests/access-composition.test.ts (26 tests) 288ms
10
+ ✓ tests/runtime-contract.test.ts (49 tests) 140ms
11
+ ✓ tests/model-hooks.test.ts (19 tests) 84ms
11
12
  stdout | tests/init.test.ts > scaffold() > creates all expected files
12
13
   created package.json
13
14
  created supatype.config.ts
@@ -294,12 +295,11 @@
294
295
  created public/.gitkeep
295
296
  created .gitignore
296
297
 
297
- ✓ tests/init.test.ts (26 tests) 103ms
298
- ✓ tests/runtime-contract.test.ts (49 tests) 186ms
299
- ✓ tests/field-masking-tier.test.ts (16 tests) 14ms
300
- ✓ tests/external-database-compose.test.ts (17 tests) 43ms
298
+ ✓ tests/init.test.ts (26 tests) 61ms
299
+ ✓ tests/field-masking-tier.test.ts (16 tests) 11ms
300
+ ✓ tests/external-database-compose.test.ts (17 tests) 12ms
301
301
 
302
- ✓ tests/dev-ui.test.ts (21 tests) 133ms
302
+ ✓ tests/dev-ui.test.ts (21 tests) 130ms
303
303
 
304
304
  [supatype] Shutting down…
305
305
  stdout | tests/docker-runtime.test.ts > requireDockerDaemon > exits when the daemon is unavailable
@@ -310,47 +310,47 @@
310
310
 
311
311
  docker: daemon down
312
312
 
313
- ✓ tests/docker-runtime.test.ts (10 tests) 27ms
314
- ✓ tests/hooks-generator.test.ts (5 tests) 6141ms
315
- ✓ typechecks under strict mode, together with a handler that uses it  3140ms
316
- ✓ rejects a handler for a table that declares no hook  2960ms
317
- ✓ tests/config.test.ts (19 tests) 8820ms
318
- ✓ loads a valid supatype.config.ts (plain export default, no package imports)  824ms
319
- ✓ normalizes shorthand schema string to { path, pg_schema }  957ms
320
- ✓ loads a supatype.config.js (plain ESM)  815ms
321
- ✓ loads config without a versions section (latest by default)  953ms
322
- ✓ prefers supatype.config.ts over supatype.config.js when both exist  1032ms
323
- ✓ supports optional output field in config  858ms
324
- ✓ merges supatype.local.config.ts over base  1793ms
325
- ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  1570ms
326
- ✓ tests/functions-deno-types.test.ts (7 tests) 4208ms
327
- ✓ tsc fails with Cannot find name Deno without ambient types  3089ms
328
- ✓ tsc passes for Deno.env after ensureFunctionsDenoTypes  1099ms
329
- ✓ tests/external-database-config.test.ts (14 tests) 11ms
330
- ✓ tests/cache-clean.test.ts (8 tests) 2494ms
331
- ✓ keeps pinned versions and removes the rest  817ms
332
- ✓ --force removes pinned versions  850ms
333
- ✓ explicit version removes even when pinned (with warning)  808ms
334
- ✓ tests/command-chrome-coverage.test.ts (1 test) 16ms
335
- ✓ tests/hook-upload.test.ts (8 tests) 20ms
313
+ ✓ tests/docker-runtime.test.ts (10 tests) 26ms
314
+ ✓ tests/hooks-generator.test.ts (5 tests) 5492ms
315
+ ✓ typechecks under strict mode, together with a handler that uses it  2768ms
316
+ ✓ rejects a handler for a table that declares no hook  2648ms
317
+ ✓ tests/config.test.ts (19 tests) 8234ms
318
+ ✓ loads a valid supatype.config.ts (plain export default, no package imports)  750ms
319
+ ✓ normalizes shorthand schema string to { path, pg_schema }  949ms
320
+ ✓ loads a supatype.config.js (plain ESM)  895ms
321
+ ✓ loads config without a versions section (latest by default)  847ms
322
+ ✓ prefers supatype.config.ts over supatype.config.js when both exist  979ms
323
+ ✓ supports optional output field in config  898ms
324
+ ✓ merges supatype.local.config.ts over base  1688ms
325
+ ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  1218ms
326
+ ✓ tests/functions-deno-types.test.ts (7 tests) 3635ms
327
+ ✓ tsc fails with Cannot find name Deno without ambient types  2634ms
328
+ ✓ tsc passes for Deno.env after ensureFunctionsDenoTypes  983ms
329
+ ✓ tests/external-database-config.test.ts (14 tests) 8ms
330
+ ✓ tests/cache-clean.test.ts (8 tests) 2130ms
331
+ ✓ keeps pinned versions and removes the rest  682ms
332
+ ✓ --force removes pinned versions  706ms
333
+ ✓ explicit version removes even when pinned (with warning)  719ms
334
+ ✓ tests/command-chrome-coverage.test.ts (1 test) 13ms
335
+ ✓ tests/hook-upload.test.ts (8 tests) 11ms
336
336
  ✓ tests/env-file.test.ts (9 tests) 16ms
337
337
  stdout | tests/link.test.ts > link model > migrates cloud.json into link.json
338
338
   created package.json
339
339
  created supatype.config.ts
340
340
  created schema/index.ts
341
341
  created .env
342
+ stderr | tests/link.test.ts > link model > migrates cloud.json into link.json
343
+ [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
342
344
  created seed.ts
343
345
  created seeds/.gitkeep
344
346
  created public/.gitkeep
345
347
  created .gitignore
346
348
 
347
- stderr | tests/link.test.ts > link model > migrates cloud.json into link.json
348
- [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
349
349
 
350
- ✓ tests/link.test.ts (4 tests) 2889ms
351
- ✓ resolveTarget returns cloud mode with /api/v1 prefix  922ms
352
- ✓ resolveTarget returns self-host mode with /platform/v1 prefix  976ms
353
- ✓ targetSchemaRollback posts to /platform/v1 when linked  980ms
350
+ ✓ tests/link.test.ts (4 tests) 2773ms
351
+ ✓ resolveTarget returns cloud mode with /api/v1 prefix  905ms
352
+ ✓ resolveTarget returns self-host mode with /platform/v1 prefix  927ms
353
+ ✓ targetSchemaRollback posts to /platform/v1 when linked  930ms
354
354
  stdout | tests/admin-ensure.test.ts > init admin seed in .env > writes SUPATYPE_ADMIN_* when scaffold options include credentials
355
355
   created package.json
356
356
  created supatype.config.ts
@@ -361,8 +361,8 @@
361
361
  created public/.gitkeep
362
362
  created .gitignore
363
363
 
364
- ✓ tests/admin-ensure.test.ts (10 tests) 167ms
365
- ✓ tests/service-role-check.test.ts (10 tests) 12ms
364
+ ✓ tests/admin-ensure.test.ts (10 tests) 148ms
365
+ ✓ tests/service-role-check.test.ts (10 tests) 11ms
366
366
  stdout | tests/admin-studio-membership.test.ts > first admin user creation > does not write a role into app_metadata
367
367
  [supatype] Admin user "admin@example.com" created (role: admin).
368
368
  [supatype] Log in at /admin after starting the dev server.
@@ -379,19 +379,19 @@
379
379
  [supatype] Admin user "admin@example.com" created (role: admin).
380
380
  [supatype] Log in at /admin after starting the dev server.
381
381
 
382
- ✓ tests/admin-studio-membership.test.ts (5 tests) 529ms
383
- ✓ tests/augmentation-generator.test.ts (6 tests) 19ms
384
- ✓ tests/pull-utils.test.ts (49 tests) 12ms
385
- ✓ tests/schema-sources.test.ts (5 tests) 1280ms
386
- ✓ buildSchemaSourcesPayload includes manifest metadata  623ms
387
- ✓ restore overwrites modified local files  614ms
382
+ ✓ tests/admin-studio-membership.test.ts (5 tests) 436ms
383
+ ✓ tests/augmentation-generator.test.ts (6 tests) 17ms
384
+ ✓ tests/pull-utils.test.ts (49 tests) 8ms
385
+ ✓ tests/schema-sources.test.ts (5 tests) 1219ms
386
+ ✓ buildSchemaSourcesPayload includes manifest metadata  518ms
387
+ ✓ restore overwrites modified local files  655ms
388
388
  stderr | tests/binary-cache-cloud-overrides.test.ts > isLinkedToCloudProject > is true when .supatype/cloud.json has projectSlug
389
389
  [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
390
390
 
391
- ✓ tests/binary-cache-cloud-overrides.test.ts (11 tests) 26ms
392
- ✓ tests/homebrew-formula.test.ts (4 tests) 206ms
393
- ✓ tests/minisign.test.ts (5 tests) 12ms
394
- ✓ tests/local-secrets.test.ts (5 tests) 7ms
391
+ ✓ tests/binary-cache-cloud-overrides.test.ts (11 tests) 13ms
392
+ ✓ tests/homebrew-formula.test.ts (4 tests) 176ms
393
+ ✓ tests/minisign.test.ts (5 tests) 13ms
394
+ ✓ tests/local-secrets.test.ts (5 tests) 8ms
395
395
  ✓ tests/api-schemas.test.ts (10 tests) 8ms
396
396
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
397
397
  [supatype] Storage bucket "photos" ready.
@@ -399,62 +399,23 @@
399
399
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
400
400
  [supatype] Storage bucket "avatars" ready.
401
401
 
402
- ✓ tests/storage-provision.test.ts (6 tests) 16ms
403
- ✓ tests/keys.test.ts (11 tests) 18147ms
404
- ✓ exits 0 with --secret  1867ms
405
- ✓ outputs ANON_KEY= line  1759ms
406
- ✓ outputs SERVICE_ROLE_KEY= line  1864ms
407
- ✓ ANON_KEY is a valid three-part JWT  1373ms
408
- ✓ SERVICE_ROLE_KEY payload has role: service_role  1465ms
409
- ✓ JWT has exp in the future  1383ms
410
- ✓ --exp-years changes the expiry window  2820ms
411
- ✓ reads JWT_SECRET from environment variable  1511ms
412
- ✓ reads JWT_SECRET from .env file  1398ms
413
- ✓ exits non-zero when no secret is available  1371ms
414
- ✓ keys --help shows --secret and --exp-years options  1329ms
415
- ✓ tests/db-preflight.test.ts (6 tests) 11ms
416
- ✓ tests/cached-artifact-format.test.ts (7 tests) 13ms
417
- ✓ tests/target-client-refresh.test.ts (3 tests) 8ms
402
+ ✓ tests/storage-provision.test.ts (6 tests) 9ms
403
+ ✓ tests/db-preflight.test.ts (6 tests) 4ms
404
+ ✓ tests/cached-artifact-format.test.ts (7 tests) 10ms
405
+ ✓ tests/keys.test.ts (11 tests) 15414ms
406
+ ✓ exits 0 with --secret  1501ms
407
+ ✓ outputs ANON_KEY= line  1641ms
408
+ ✓ outputs SERVICE_ROLE_KEY= line  1485ms
409
+ ✓ ANON_KEY is a valid three-part JWT  1181ms
410
+ ✓ SERVICE_ROLE_KEY payload has role: service_role  1195ms
411
+ ✓ JWT has exp in the future  1222ms
412
+ ✓ --exp-years changes the expiry window  2416ms
413
+ ✓ reads JWT_SECRET from environment variable  1209ms
414
+ ✓ reads JWT_SECRET from .env file  1255ms
415
+ ✓ exits non-zero when no secret is available  1166ms
416
+ ✓ keys --help shows --secret and --exp-years options  1136ms
417
+ ✓ tests/target-client-refresh.test.ts (3 tests) 10ms
418
418
  ✓ tests/proxy-dev-app.test.ts (7 tests) 6ms
419
- ✓ tests/init-dependency-versions.test.ts (4 tests) 36ms
420
- ✓ tests/service-role-routes.test.ts (4 tests) 1739ms
421
- ✓ reads the declared list  563ms
422
- ✓ is an empty list when a project declares none  574ms
423
- ✓ sends what the project declared, hook entries included  599ms
424
- ✓ tests/type-resolver.test.ts (2 tests) 15ms
425
- ✓ tests/engine-push-output.test.ts (7 tests) 6ms
426
- ✓ tests/tsx-runner.test.ts (7 tests) 3049ms
427
- ✓ evaluates a simple expression and returns stdout  421ms
428
- ✓ evaluates TypeScript syntax (type annotations)  426ms
429
- ✓ can serialize a JSON object to stdout  420ms
430
- ✓ returns non-zero exit code on syntax error  371ms
431
- ✓ returns non-zero exit code on runtime error  411ms
432
- ✓ captures stderr separately from stdout  396ms
433
- ✓ runs a .ts file and returns its stdout  599ms
434
- ✓ tests/command-chrome-wrap.test.ts (3 tests) 7ms
435
- ✓ tests/cli-install-method.test.ts (8 tests) 5ms
436
- ✓ tests/archive-name-alias.test.ts (4 tests) 6ms
437
- ✓ tests/ensure-binary.test.ts (2 tests) 10ms
438
- ✓ tests/doctor-render.test.ts (3 tests) 7ms
439
- ✓ tests/cli-help.test.ts (16 tests) 22876ms
440
- ✓ --help lists all top-level commands  1754ms
441
- ✓ --version prints package.json version  1969ms
442
- ✓ self-update --help describes the command  1402ms
443
- ✓ init --help describes the init command  1366ms
444
- ✓ push --help describes the push command and --yes flag  1463ms
445
- ✓ diff --help describes the diff command  1426ms
446
- ✓ pull --help describes scaffold pull command  1402ms
447
- ✓ doctor --help describes drift report command  1308ms
448
- ✓ introspect --help describes database introspection command  1310ms
449
- ✓ adopt --help describes adoption ceremony command  1341ms
450
- ✓ reset --help shows --yes flag  1254ms
451
- ✓ app --help describes the app command with add/remove subcommands  1366ms
452
- ✓ app add --help shows --static and --port options  1388ms
453
- ✓ self-host --help shows compose only (legacy commands hidden)  1358ms
454
- ✓ self-host compose --help shows compose subcommands  1350ms
455
- ✓ unknown command exits non-zero  1411ms
456
- ✓ tests/init-project-detect.test.ts (4 tests) 10ms
457
- ✓ tests/doctor-service-role.test.ts (4 tests) 6ms
458
419
  stdout | tests/app-command.test.ts > supatype app add --static > sets app.mode=static and static_dir in supatype.config.ts
459
420
   created package.json
460
421
  created supatype.config.ts
@@ -465,9 +426,6 @@
465
426
  created public/.gitkeep
466
427
  created .gitignore
467
428
 
468
- ✓ tests/required-host-components.test.ts (4 tests) 7ms
469
- ✓ tests/ui-messages.test.ts (5 tests) 6ms
470
- ✓ tests/normalize-admin-config.test.ts (1 test) 6ms
471
429
  stdout | tests/app-command.test.ts > supatype app add --static > creates the static directory when missing
472
430
   created package.json
473
431
  created supatype.config.ts
@@ -478,35 +436,77 @@
478
436
  created public/.gitkeep
479
437
  created .gitignore
480
438
 
481
- ✓ tests/dev-session-lock.test.ts (2 tests) 5ms
439
+ ✓ tests/service-role-routes.test.ts (4 tests) 1623ms
440
+ ✓ reads the declared list  553ms
441
+ ✓ is an empty list when a project declares none  501ms
442
+ ✓ sends what the project declared, hook entries included  564ms
443
+ ✓ tests/init-dependency-versions.test.ts (4 tests) 34ms
444
+ ✓ tests/app-command.test.ts (2 tests) 2532ms
445
+ ✓ sets app.mode=static and static_dir in supatype.config.ts  1280ms
446
+ ✓ creates the static directory when missing  1250ms
447
+ ✓ tests/type-resolver.test.ts (2 tests) 13ms
448
+ ✓ tests/engine-push-output.test.ts (7 tests) 6ms
449
+ ✓ tests/cli-help.test.ts (16 tests) 19936ms
450
+ ✓ --help lists all top-level commands  1693ms
451
+ ✓ --version prints package.json version  1783ms
452
+ ✓ self-update --help describes the command  1154ms
453
+ ✓ init --help describes the init command  1231ms
454
+ ✓ push --help describes the push command and --yes flag  1189ms
455
+ ✓ diff --help describes the diff command  1232ms
456
+ ✓ pull --help describes scaffold pull command  1192ms
457
+ ✓ doctor --help describes drift report command  1154ms
458
+ ✓ introspect --help describes database introspection command  1103ms
459
+ ✓ adopt --help describes adoption ceremony command  1120ms
460
+ ✓ reset --help shows --yes flag  1134ms
461
+ ✓ app --help describes the app command with add/remove subcommands  1155ms
462
+ ✓ app add --help shows --static and --port options  1308ms
463
+ ✓ self-host --help shows compose only (legacy commands hidden)  1091ms
464
+ ✓ self-host compose --help shows compose subcommands  1229ms
465
+ ✓ unknown command exits non-zero  1163ms
466
+ ✓ tests/command-chrome-wrap.test.ts (3 tests) 6ms
467
+ ✓ tests/cli-install-method.test.ts (8 tests) 6ms
468
+ ✓ tests/doctor-render.test.ts (3 tests) 6ms
469
+ ✓ tests/archive-name-alias.test.ts (4 tests) 5ms
470
+ ✓ tests/ensure-binary.test.ts (2 tests) 9ms
471
+ ✓ tests/init-project-detect.test.ts (4 tests) 7ms
472
+ ✓ tests/tsx-runner.test.ts (7 tests) 2754ms
473
+ ✓ evaluates a simple expression and returns stdout  388ms
474
+ ✓ evaluates TypeScript syntax (type annotations)  394ms
475
+ ✓ can serialize a JSON object to stdout  341ms
476
+ ✓ returns non-zero exit code on syntax error  380ms
477
+ ✓ returns non-zero exit code on runtime error  392ms
478
+ ✓ captures stderr separately from stdout  369ms
479
+ ✓ runs a .ts file and returns its stdout  485ms
480
+ ✓ tests/required-host-components.test.ts (4 tests) 6ms
481
+ ✓ tests/ui-messages.test.ts (5 tests) 5ms
482
+ ✓ tests/normalize-admin-config.test.ts (1 test) 6ms
483
+ ✓ tests/doctor-service-role.test.ts (4 tests) 5ms
482
484
  ✓ tests/ui-confirm.test.ts (3 tests) 7ms
483
485
  ✓ tests/docker-postgres.test.ts (5 tests) 5ms
484
- ✓ tests/binary-download-lock.test.ts (2 tests) 5ms
485
- ✓ tests/config-load-failure.test.ts (2 tests) 3666ms
486
- ✓ is reported, rather than treated as absent  2244ms
487
- ✓ does not stop the CLI working with no config at all  1420ms
488
- ✓ tests/app-command.test.ts (2 tests) 3024ms
489
- ✓ sets app.mode=static and static_dir in supatype.config.ts  1545ms
490
- ✓ creates the static directory when missing  1477ms
491
- ✓ tests/route-manifest.test.ts (1 test) 6ms
492
- ✓ tests/dev-ports.test.ts (3 tests) 6ms
486
+ ✓ tests/binary-download-lock.test.ts (2 tests) 7ms
487
+ ✓ tests/dev-session-lock.test.ts (2 tests) 4ms
488
+ ✓ tests/dev-ports.test.ts (3 tests) 5ms
489
+ ✓ tests/dev-ready-panel.test.ts (2 tests) 3ms
490
+ ✓ tests/route-manifest.test.ts (1 test) 5ms
493
491
  ✓ tests/studio-admin-roles.test.ts (3 tests) 4ms
494
- ✓ tests/dev-ready-panel.test.ts (2 tests) 4ms
492
+ ✓ tests/config-load-failure.test.ts (2 tests) 2975ms
493
+ ✓ is reported, rather than treated as absent  1807ms
494
+ ✓ does not stop the CLI working with no config at all  1164ms
495
+ ✓ tests/release-pins.test.ts (2 tests) 3ms
495
496
  ✓ tests/realtime-launch.test.ts (1 test) 4ms
496
- ✓ tests/release-pins.test.ts (2 tests) 4ms
497
- ✓ tests/seed-discover.test.ts (2 tests) 19ms
498
- ✓ tests/ensure-dev-api-config.test.ts (1 test) 5ms
499
- ✓ tests/rest-cache-admin.test.ts (1 test) 37ms
500
- ✓ tests/init-package-json.test.ts (1 test) 4ms
501
- ✓ tests/pg-spawn-env.test.ts (2 tests) 4ms
497
+ ✓ tests/ensure-dev-api-config.test.ts (1 test) 3ms
498
+ ✓ tests/seed-discover.test.ts (2 tests) 16ms
499
+ ✓ tests/rest-cache-admin.test.ts (1 test) 31ms
500
+ ✓ tests/init-package-json.test.ts (1 test) 2ms
502
501
  ✓ tests/resolve-api-url.test.ts (2 tests) 5ms
503
- ✓ tests/migrate-from-v1.test.ts (1 test) 16ms
504
- ✓ tests/postgres-archive-tag.test.ts (1 test) 2ms
502
+ ✓ tests/pg-spawn-env.test.ts (2 tests) 3ms
503
+ ✓ tests/migrate-from-v1.test.ts (1 test) 13ms
505
504
  ✓ tests/cli-package-version.test.ts (1 test) 3ms
505
+ ✓ tests/postgres-archive-tag.test.ts (1 test) 2ms
506
506
  ✓ tests/stdin-after-ink.test.ts (1 test) 3ms
507
507
 
508
508
   Test Files  73 passed (73)
509
509
   Tests  581 passed (581)
510
-  Start at  18:55:57
511
-  Duration  46.13s (transform 6.40s, setup 0ms, import 41.61s, tests 80.94s, environment 17ms)
510
+  Start at  09:33:26
511
+  Duration  40.72s (transform 6.67s, setup 0ms, import 37.37s, tests 70.91s, environment 13ms)
512
512
 
@@ -1,4 +1,4 @@
1
1
 
2
- > @supatype/cli@0.1.10 typecheck /home/runner/work/supatype/supatype/packages/cli
2
+ > @supatype/cli@0.1.11 typecheck /home/runner/work/supatype/supatype/packages/cli
3
3
  > tsc --project tsconfig.json --noEmit && tsc --project tests/tsconfig.json --noEmit
4
4
 
@@ -9,5 +9,5 @@
9
9
  // Annotated `string`, not left to inference: once a release stamps a value here, the
10
10
  // inferred literal type makes the `!== ""` test in cliPackageVersion() a compile error
11
11
  // (TS2367, no overlap), so the build would only fail during a release.
12
- export const EMBEDDED_CLI_VERSION = "0.1.10";
12
+ export const EMBEDDED_CLI_VERSION = "0.1.11";
13
13
  //# sourceMappingURL=cli-version-embedded.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAUxC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsCvD"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOxC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiCvD"}
@@ -1,10 +1,7 @@
1
- import { mkdirSync, writeFileSync } from "node:fs";
2
- import { resolve, dirname } from "node:path";
3
1
  import { loadConfig, loadSchemaAst } from "../config.js";
4
2
  import { hooksPathFromProject, schemaPathFromProject } from "../project-config.js";
5
- import { ensureEngine, engineRequest } from "../engine-client.js";
6
- import { generateClientAugmentation } from "../augmentation-generator.js";
7
3
  import { writeHooksModule } from "../model-hooks.js";
4
+ import { writeGeneratedTypes } from "../type-generation.js";
8
5
  import { error, info } from "../ui/messages.js";
9
6
  export function registerGenerate(program) {
10
7
  program
@@ -17,24 +14,24 @@ export function registerGenerate(program) {
17
14
  const schemaPath = schemaPathFromProject(config, cwd);
18
15
  const outputTypesPath = config.output?.types ?? "types/database.ts";
19
16
  const outputClientPath = config.output?.client ?? "supatype/generated/index.d.ts";
20
- await ensureEngine();
21
17
  info("Loading schema...");
22
18
  const ast = loadSchemaAst(schemaPath, cwd);
23
- const result = await engineRequest("/generate", { ast, lang: "typescript" });
24
- const typesCode = result.code ?? result.message;
25
- if (typesCode === undefined) {
26
- error("Engine returned no output.");
19
+ // Shared with push, which used to delegate the writing to the engine and produce no files.
20
+ // Unlike push, this command always writes: the defaults above are the point of running it.
21
+ try {
22
+ const written = await writeGeneratedTypes({
23
+ cwd,
24
+ ast,
25
+ typesPath: outputTypesPath,
26
+ clientPath: outputClientPath,
27
+ });
28
+ for (const message of written)
29
+ info(message);
30
+ }
31
+ catch (err) {
32
+ error(err instanceof Error ? err.message : String(err));
27
33
  process.exit(1);
28
34
  }
29
- const outPath = resolve(cwd, outputTypesPath);
30
- mkdirSync(dirname(outPath), { recursive: true });
31
- writeFileSync(outPath, typesCode, "utf8");
32
- info(`Types written to ${outputTypesPath}`);
33
- const augmentationOutPath = resolve(cwd, outputClientPath);
34
- const augmentationCode = generateClientAugmentation(ast);
35
- mkdirSync(dirname(augmentationOutPath), { recursive: true });
36
- writeFileSync(augmentationOutPath, augmentationCode, "utf8");
37
- info(`Client augmentation written to ${outputClientPath}`);
38
35
  const hooksPath = writeHooksModule(cwd, hooksPathFromProject(config, cwd), ast);
39
36
  if (hooksPath !== null)
40
37
  info(`Hook handler types written to ${hooksPath}`);
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAClF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAE/C,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,yDAAyD,CAAC;SACtE,MAAM,CAAC,oBA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,CAAA;CACvB;AAqCD,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,gBAAgB,GAAE,gBAA0B,GAC3C,eAAe,CAajB;AAcD,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8GnD;AAwaD,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,eAAe,GAAG,MAAM,EACpC,IAAI,GAAE,sBAAyD,GAC9D,IAAI,CAiDN;AA2rBD,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAStE"}
@@ -583,7 +583,22 @@ function packageJsonTemplate(opts, deps) {
583
583
  if (opts.helloFunction) {
584
584
  scripts.push(` "functions": "supatype functions serve"`);
585
585
  }
586
- const devDeps = [` "tsx": "^4.19.2"`, ` "typescript": "^5"`];
586
+ // Both are development-time only, so they belong in devDependencies. Validated end to end
587
+ // against a real database: schema/index.ts imports @supatype/types with `import type`, which is
588
+ // erased at build; supatype.config.ts imports defineConfig, which only the CLI evaluates; and
589
+ // seed.ts is run by `tsx seed.ts`. Nothing `supatype push` or `supatype generate` writes refers
590
+ // to either package: the generated types import nothing, and the client augmentation declares a
591
+ // module for @supatype/client, which stays a real dependency.
592
+ //
593
+ // In dependencies they were installed by `npm install --omit=dev`, so every production install
594
+ // of a Supatype app pulled the whole CLI toolchain (ink, react, typescript, ts-morph, pg, tsx)
595
+ // to support three files that never run in production.
596
+ const devDeps = [
597
+ ` "@supatype/cli": "^${deps.cli}"`,
598
+ ` "@supatype/types": "^${deps.types}"`,
599
+ ` "tsx": "^4.19.2"`,
600
+ ` "typescript": "^5"`,
601
+ ];
587
602
  if (opts.app.viteDevUrl) {
588
603
  devDeps.push(` "vite": "^6"`);
589
604
  }
@@ -594,10 +609,6 @@ function packageJsonTemplate(opts, deps) {
594
609
  "scripts": {
595
610
  ${scripts.join(",\n")}
596
611
  },
597
- "dependencies": {
598
- "@supatype/cli": "^${deps.cli}",
599
- "@supatype/types": "^${deps.types}"
600
- },
601
612
  "devDependencies": {
602
613
  ${devDeps.join(",\n")}
603
614
  }