@supatype/cli 0.1.2 → 0.1.3

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.
Files changed (67) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +108 -105
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/dist/commands/admin.d.ts +12 -0
  5. package/dist/commands/admin.d.ts.map +1 -1
  6. package/dist/commands/admin.js +97 -23
  7. package/dist/commands/admin.js.map +1 -1
  8. package/dist/commands/init.d.ts.map +1 -1
  9. package/dist/commands/init.js +287 -182
  10. package/dist/commands/init.js.map +1 -1
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/config.js +12 -1
  13. package/dist/config.js.map +1 -1
  14. package/dist/dev-compose.js +3 -3
  15. package/dist/dev-compose.js.map +1 -1
  16. package/dist/dev-log-bus.d.ts +1 -1
  17. package/dist/dev-log-bus.d.ts.map +1 -1
  18. package/dist/dev-log-bus.js +5 -3
  19. package/dist/dev-log-bus.js.map +1 -1
  20. package/dist/dev-ready-panel.d.ts +2 -0
  21. package/dist/dev-ready-panel.d.ts.map +1 -1
  22. package/dist/dev-ready-panel.js +18 -0
  23. package/dist/dev-ready-panel.js.map +1 -1
  24. package/dist/init-project-detect.d.ts +14 -0
  25. package/dist/init-project-detect.d.ts.map +1 -0
  26. package/dist/init-project-detect.js +89 -0
  27. package/dist/init-project-detect.js.map +1 -0
  28. package/dist/ui/dev/DevDashboard.d.ts.map +1 -1
  29. package/dist/ui/dev/DevDashboard.js +11 -4
  30. package/dist/ui/dev/DevDashboard.js.map +1 -1
  31. package/dist/ui/dev/DevReadyPanelView.d.ts +2 -1
  32. package/dist/ui/dev/DevReadyPanelView.d.ts.map +1 -1
  33. package/dist/ui/dev/DevReadyPanelView.js +21 -2
  34. package/dist/ui/dev/DevReadyPanelView.js.map +1 -1
  35. package/dist/ui/flows/FlowApp.d.ts.map +1 -1
  36. package/dist/ui/flows/FlowApp.js +3 -1
  37. package/dist/ui/flows/FlowApp.js.map +1 -1
  38. package/dist/ui/flows/prompt-fields.d.ts.map +1 -1
  39. package/dist/ui/flows/prompt-fields.js +9 -5
  40. package/dist/ui/flows/prompt-fields.js.map +1 -1
  41. package/dist/ui/runtime/run-clack-flow.d.ts.map +1 -1
  42. package/dist/ui/runtime/run-clack-flow.js +15 -3
  43. package/dist/ui/runtime/run-clack-flow.js.map +1 -1
  44. package/dist/ui/runtime/stdin-after-ink.d.ts +3 -0
  45. package/dist/ui/runtime/stdin-after-ink.d.ts.map +1 -0
  46. package/dist/ui/runtime/stdin-after-ink.js +16 -0
  47. package/dist/ui/runtime/stdin-after-ink.js.map +1 -0
  48. package/package.json +1 -1
  49. package/src/commands/admin.ts +135 -26
  50. package/src/commands/init.ts +360 -213
  51. package/src/config.ts +13 -1
  52. package/src/dev-compose.ts +4 -4
  53. package/src/dev-log-bus.ts +5 -3
  54. package/src/dev-ready-panel.ts +17 -0
  55. package/src/init-project-detect.ts +99 -0
  56. package/src/ui/dev/DevDashboard.tsx +14 -4
  57. package/src/ui/dev/DevReadyPanelView.tsx +76 -9
  58. package/src/ui/flows/FlowApp.tsx +3 -1
  59. package/src/ui/flows/prompt-fields.tsx +13 -7
  60. package/src/ui/runtime/run-clack-flow.tsx +16 -3
  61. package/src/ui/runtime/stdin-after-ink.ts +18 -0
  62. package/tests/admin-ensure.test.ts +80 -0
  63. package/tests/config.test.ts +19 -0
  64. package/tests/dev-ready-panel.test.ts +18 -1
  65. package/tests/init-project-detect.test.ts +53 -0
  66. package/tests/stdin-after-ink.test.ts +8 -0
  67. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,53 @@
1
+ import { describe, it, expect, beforeEach, afterEach } from "vitest"
2
+ import { mkdirSync, rmSync, writeFileSync } from "node:fs"
3
+ import { join } from "node:path"
4
+ import { tmpdir } from "node:os"
5
+ import { detectProjectSetup } from "../src/init-project-detect.js"
6
+
7
+ let dir: string
8
+
9
+ beforeEach(() => {
10
+ dir = join(tmpdir(), `supatype-detect-${Date.now()}`)
11
+ mkdirSync(dir, { recursive: true })
12
+ })
13
+
14
+ afterEach(() => {
15
+ rmSync(dir, { recursive: true, force: true })
16
+ })
17
+
18
+ describe("detectProjectSetup()", () => {
19
+ it("returns empty summary for an empty directory", () => {
20
+ const detected = detectProjectSetup(dir)
21
+ expect(detected.hasExistingFiles).toBe(false)
22
+ expect(detected.hasVite).toBe(false)
23
+ expect(detected.summaryLines).toEqual([])
24
+ })
25
+
26
+ it("detects Vite config and port", () => {
27
+ writeFileSync(
28
+ join(dir, "vite.config.ts"),
29
+ `export default { server: { port: 5174 } }`,
30
+ "utf8",
31
+ )
32
+ const detected = detectProjectSetup(dir)
33
+ expect(detected.hasVite).toBe(true)
34
+ expect(detected.hasViteConfig).toBe(true)
35
+ expect(detected.viteDevUrl).toBe("http://127.0.0.1:5174")
36
+ expect(detected.summaryLines.some((line) => line.includes("Vite config"))).toBe(true)
37
+ })
38
+
39
+ it("detects static dist directory", () => {
40
+ mkdirSync(join(dir, "dist"), { recursive: true })
41
+ writeFileSync(join(dir, "dist", "index.html"), "<html></html>", "utf8")
42
+ const detected = detectProjectSetup(dir)
43
+ expect(detected.staticDir).toBe("./dist")
44
+ expect(detected.summaryLines.some((line) => line.includes("./dist"))).toBe(true)
45
+ })
46
+
47
+ it("detects existing supatype.config.ts", () => {
48
+ writeFileSync(join(dir, "supatype.config.ts"), "export default {}", "utf8")
49
+ const detected = detectProjectSetup(dir)
50
+ expect(detected.hasSupatypeConfig).toBe(true)
51
+ expect(detected.summaryLines).toContain("supatype.config already present")
52
+ })
53
+ })
@@ -0,0 +1,8 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import { restoreStdinAfterInk } from "../src/ui/runtime/stdin-after-ink.js"
3
+
4
+ describe("restoreStdinAfterInk()", () => {
5
+ it("does not throw when stdin is not a TTY", () => {
6
+ expect(() => restoreStdinAfterInk()).not.toThrow()
7
+ })
8
+ })