@supatype/cli 0.1.10 → 0.1.12

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.12 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.12 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/access-composition.test.ts (26 tests) 157ms
9
+ ✓ tests/type-extractor.test.ts (43 tests) 304ms
10
+ ✓ tests/runtime-contract.test.ts (49 tests) 178ms
11
+ ✓ tests/model-hooks.test.ts (19 tests) 165ms
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) 155ms
299
+ ✓ tests/external-database-compose.test.ts (17 tests) 14ms
300
+ ✓ tests/field-masking-tier.test.ts (16 tests) 16ms
301
301
 
302
- ✓ tests/dev-ui.test.ts (21 tests) 133ms
302
+ ✓ tests/dev-ui.test.ts (21 tests) 131ms
303
303
 
304
304
  [supatype] Shutting down…
305
305
  stdout | tests/docker-runtime.test.ts > requireDockerDaemon > exits when the daemon is unavailable
@@ -310,29 +310,30 @@
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) 31ms
314
+ ✓ tests/hooks-generator.test.ts (5 tests) 6103ms
315
+ ✓ typechecks under strict mode, together with a handler that uses it  3057ms
316
+ ✓ rejects a handler for a table that declares no hook  3005ms
317
+ ✓ tests/config.test.ts (19 tests) 8949ms
318
+ ✓ loads a valid supatype.config.ts (plain export default, no package imports)  762ms
319
+ ✓ normalizes shorthand schema string to { path, pg_schema }  876ms
320
+ ✓ loads a supatype.config.js (plain ESM)  841ms
321
+ ✓ loads config without a versions section (latest by default)  938ms
322
+ ✓ prefers supatype.config.ts over supatype.config.js when both exist  935ms
323
+ ✓ supports optional output field in config  932ms
324
+ ✓ merges supatype.local.config.ts over base  1930ms
325
+ ✓ loads defineConfig import before @supatype/cli is installed (init scaffold)  1719ms
326
+ ✓ tests/db-preflight.test.ts (14 tests) 15ms
327
+ ✓ tests/functions-deno-types.test.ts (7 tests) 4144ms
328
+ ✓ tsc fails with Cannot find name Deno without ambient types  2908ms
329
+ ✓ tsc passes for Deno.env after ensureFunctionsDenoTypes  1215ms
330
+ ✓ tests/external-database-config.test.ts (14 tests) 13ms
331
+ ✓ tests/cache-clean.test.ts (8 tests) 2514ms
332
+ ✓ keeps pinned versions and removes the rest  832ms
333
+ ✓ --force removes pinned versions  820ms
334
+ ✓ explicit version removes even when pinned (with warning)  829ms
335
+ ✓ tests/command-chrome-coverage.test.ts (1 test) 20ms
336
+ ✓ tests/hook-upload.test.ts (8 tests) 14ms
336
337
  ✓ tests/env-file.test.ts (9 tests) 16ms
337
338
  stdout | tests/link.test.ts > link model > migrates cloud.json into link.json
338
339
   created package.json
@@ -343,14 +344,14 @@
343
344
  created seeds/.gitkeep
344
345
  created public/.gitkeep
345
346
  created .gitignore
346
-
347
347
  stderr | tests/link.test.ts > link model > migrates cloud.json into link.json
348
+
348
349
  [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
349
350
 
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
351
+ ✓ tests/link.test.ts (4 tests) 3151ms
352
+ ✓ resolveTarget returns cloud mode with /api/v1 prefix  1039ms
353
+ ✓ resolveTarget returns self-host mode with /platform/v1 prefix  1059ms
354
+ ✓ targetSchemaRollback posts to /platform/v1 when linked  1043ms
354
355
  stdout | tests/admin-ensure.test.ts > init admin seed in .env > writes SUPATYPE_ADMIN_* when scaffold options include credentials
355
356
   created package.json
356
357
  created supatype.config.ts
@@ -361,7 +362,7 @@
361
362
  created public/.gitkeep
362
363
  created .gitignore
363
364
 
364
- ✓ tests/admin-ensure.test.ts (10 tests) 167ms
365
+ ✓ tests/admin-ensure.test.ts (10 tests) 187ms
365
366
  ✓ tests/service-role-check.test.ts (10 tests) 12ms
366
367
  stdout | tests/admin-studio-membership.test.ts > first admin user creation > does not write a role into app_metadata
367
368
  [supatype] Admin user "admin@example.com" created (role: admin).
@@ -379,82 +380,42 @@
379
380
  [supatype] Admin user "admin@example.com" created (role: admin).
380
381
  [supatype] Log in at /admin after starting the dev server.
381
382
 
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
383
+ ✓ tests/admin-studio-membership.test.ts (5 tests) 488ms
384
+ ✓ tests/augmentation-generator.test.ts (6 tests) 20ms
385
+ ✓ tests/pull-utils.test.ts (49 tests) 14ms
386
+ ✓ tests/schema-sources.test.ts (5 tests) 1281ms
387
+ ✓ buildSchemaSourcesPayload includes manifest metadata  609ms
388
+ ✓ restore overwrites modified local files  625ms
388
389
  stderr | tests/binary-cache-cloud-overrides.test.ts > isLinkedToCloudProject > is true when .supatype/cloud.json has projectSlug
389
390
  [supatype] Migrated .supatype/cloud.json → .supatype/link.json (legacy files kept; remove manually when ready).
390
391
 
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
395
- ✓ tests/api-schemas.test.ts (10 tests) 8ms
392
+ ✓ tests/binary-cache-cloud-overrides.test.ts (11 tests) 18ms
393
+ ✓ tests/homebrew-formula.test.ts (4 tests) 208ms
394
+ ✓ tests/minisign.test.ts (5 tests) 17ms
395
+ ✓ tests/local-secrets.test.ts (5 tests) 9ms
396
+ ✓ tests/api-schemas.test.ts (10 tests) 10ms
396
397
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
397
398
  [supatype] Storage bucket "photos" ready.
398
399
 
399
400
  stdout | tests/storage-provision.test.ts > provisionBuckets > POSTs each bucket to the storage API
400
401
  [supatype] Storage bucket "avatars" ready.
401
402
 
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
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
403
+ ✓ tests/storage-provision.test.ts (6 tests) 12ms
404
+ ✓ tests/cached-artifact-format.test.ts (7 tests) 11ms
405
+ ✓ tests/keys.test.ts (11 tests) 18356ms
406
+ ✓ exits 0 with --secret  1919ms
407
+ ✓ outputs ANON_KEY= line  1898ms
408
+ ✓ outputs SERVICE_ROLE_KEY= line  1634ms
409
+ ✓ ANON_KEY is a valid three-part JWT  1372ms
410
+ ✓ SERVICE_ROLE_KEY payload has role: service_role  1517ms
411
+ ✓ JWT has exp in the future  1479ms
412
+ ✓ --exp-years changes the expiry window  2842ms
413
+ ✓ reads JWT_SECRET from environment variable  1572ms
414
+ ✓ reads JWT_SECRET from .env file  1412ms
415
+ ✓ exits non-zero when no secret is available  1301ms
416
+ ✓ keys --help shows --secret and --exp-years options  1405ms
417
+ ✓ tests/target-client-refresh.test.ts (3 tests) 10ms
418
+ ✓ tests/proxy-dev-app.test.ts (7 tests) 7ms
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
482
- ✓ tests/ui-confirm.test.ts (3 tests) 7ms
483
- ✓ 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
493
- ✓ tests/studio-admin-roles.test.ts (3 tests) 4ms
494
- ✓ tests/dev-ready-panel.test.ts (2 tests) 4ms
495
- ✓ 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
439
+ ✓ tests/service-role-routes.test.ts (4 tests) 1708ms
440
+ ✓ reads the declared list  627ms
441
+ ✓ is an empty list when a project declares none  549ms
442
+ ✓ sends what the project declared, hook entries included  527ms
443
+ ✓ tests/init-dependency-versions.test.ts (4 tests) 38ms
444
+ ✓ tests/app-command.test.ts (2 tests) 3092ms
445
+ ✓ sets app.mode=static and static_dir in supatype.config.ts  1528ms
446
+ ✓ creates the static directory when missing  1558ms
447
+ ✓ tests/type-resolver.test.ts (2 tests) 16ms
448
+ ✓ tests/engine-push-output.test.ts (7 tests) 8ms
449
+ ✓ tests/tsx-runner.test.ts (7 tests) 3030ms
450
+ ✓ evaluates a simple expression and returns stdout  451ms
451
+ ✓ evaluates TypeScript syntax (type annotations)  361ms
452
+ ✓ can serialize a JSON object to stdout  422ms
453
+ ✓ returns non-zero exit code on syntax error  402ms
454
+ ✓ returns non-zero exit code on runtime error  359ms
455
+ ✓ captures stderr separately from stdout  379ms
456
+ ✓ runs a .ts file and returns its stdout  650ms
457
+ ✓ tests/command-chrome-wrap.test.ts (3 tests) 7ms
458
+ ✓ tests/cli-help.test.ts (16 tests) 24015ms
459
+ ✓ --help lists all top-level commands  2056ms
460
+ ✓ --version prints package.json version  1897ms
461
+ ✓ self-update --help describes the command  1356ms
462
+ ✓ init --help describes the init command  1430ms
463
+ ✓ push --help describes the push command and --yes flag  1473ms
464
+ ✓ diff --help describes the diff command  1439ms
465
+ ✓ pull --help describes scaffold pull command  1415ms
466
+ ✓ doctor --help describes drift report command  1476ms
467
+ ✓ introspect --help describes database introspection command  1397ms
468
+ ✓ adopt --help describes adoption ceremony command  1408ms
469
+ ✓ reset --help shows --yes flag  1413ms
470
+ ✓ app --help describes the app command with add/remove subcommands  1417ms
471
+ ✓ app add --help shows --static and --port options  1474ms
472
+ ✓ self-host --help shows compose only (legacy commands hidden)  1452ms
473
+ ✓ self-host compose --help shows compose subcommands  1435ms
474
+ ✓ unknown command exits non-zero  1469ms
475
+ ✓ tests/cli-install-method.test.ts (8 tests) 8ms
476
+ ✓ tests/archive-name-alias.test.ts (4 tests) 7ms
477
+ ✓ tests/ensure-binary.test.ts (2 tests) 7ms
478
+ ✓ tests/init-project-detect.test.ts (4 tests) 12ms
479
+ ✓ tests/doctor-render.test.ts (3 tests) 6ms
480
+ ✓ tests/required-host-components.test.ts (4 tests) 7ms
481
+ ✓ tests/ui-messages.test.ts (5 tests) 6ms
482
+ ✓ tests/normalize-admin-config.test.ts (1 test) 8ms
483
+ ✓ tests/doctor-service-role.test.ts (4 tests) 7ms
484
+ ✓ tests/ui-confirm.test.ts (3 tests) 6ms
485
+ ✓ tests/docker-postgres.test.ts (5 tests) 8ms
486
+ ✓ tests/binary-download-lock.test.ts (2 tests) 6ms
487
+ ✓ tests/dev-session-lock.test.ts (2 tests) 6ms
488
+ ✓ tests/dev-ports.test.ts (3 tests) 8ms
489
+ ✓ tests/route-manifest.test.ts (1 test) 4ms
490
+ ✓ tests/config-load-failure.test.ts (2 tests) 3570ms
491
+ ✓ is reported, rather than treated as absent  2076ms
492
+ ✓ does not stop the CLI working with no config at all  1491ms
493
+ ✓ tests/dev-ready-panel.test.ts (2 tests) 5ms
494
+ ✓ tests/studio-admin-roles.test.ts (3 tests) 5ms
495
+ ✓ tests/realtime-launch.test.ts (1 test) 5ms
496
+ ✓ tests/release-pins.test.ts (2 tests) 3ms
498
497
  ✓ tests/ensure-dev-api-config.test.ts (1 test) 5ms
499
- ✓ tests/rest-cache-admin.test.ts (1 test) 37ms
498
+ ✓ tests/seed-discover.test.ts (2 tests) 12ms
499
+ ✓ tests/rest-cache-admin.test.ts (1 test) 39ms
500
500
  ✓ tests/init-package-json.test.ts (1 test) 4ms
501
501
  ✓ tests/pg-spawn-env.test.ts (2 tests) 4ms
502
- ✓ 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
505
- ✓ tests/cli-package-version.test.ts (1 test) 3ms
502
+ ✓ tests/resolve-api-url.test.ts (2 tests) 6ms
503
+ ✓ tests/migrate-from-v1.test.ts (1 test) 15ms
504
+ ✓ tests/cli-package-version.test.ts (1 test) 4ms
505
+ ✓ tests/postgres-archive-tag.test.ts (1 test) 3ms
506
506
  ✓ tests/stdin-after-ink.test.ts (1 test) 3ms
507
507
 
508
508
   Test Files  73 passed (73)
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)
509
+  Tests  589 passed (589)
510
+  Start at  22:59:36
511
+  Duration  47.15s (transform 6.84s, setup 0ms, import 43.14s, tests 82.45s, environment 17ms)
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.12 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.12";
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,oBAAoB,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A;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
  }