@gaonjs/cli 0.43.0 → 0.52.0

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 (72) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/check.d.ts +1 -1
  3. package/dist/commands/check.js +1 -1
  4. package/dist/commands/db.js +29 -7
  5. package/dist/commands/new.d.ts +2 -0
  6. package/dist/commands/new.js +8 -3
  7. package/dist/commands/test.js +16 -3
  8. package/dist/db/journal.d.ts +4 -3
  9. package/dist/db/journal.js +21 -10
  10. package/dist/db/migrate.d.ts +3 -1
  11. package/dist/db/migrate.js +3 -3
  12. package/dist/db/replay.js +2 -2
  13. package/dist/db/resolve.d.ts +15 -0
  14. package/dist/db/resolve.js +24 -2
  15. package/dist/db/status.js +13 -3
  16. package/dist/dev.d.ts +6 -4
  17. package/dist/dev.js +9 -4
  18. package/dist/doctor/fixers/index.d.ts +1 -1
  19. package/dist/doctor/fixers/index.js +6 -1
  20. package/dist/doctor/locale-parity.js +4 -1
  21. package/dist/doctor/pageprops-destructure.d.ts +2 -2
  22. package/dist/doctor/pageprops-destructure.js +29 -23
  23. package/dist/doctor/render-return.d.ts +11 -0
  24. package/dist/doctor/render-return.js +143 -0
  25. package/dist/doctor/types.d.ts +1 -1
  26. package/dist/doctor.d.ts +3 -2
  27. package/dist/doctor.js +17 -6
  28. package/dist/generate.d.ts +20 -1
  29. package/dist/generate.js +120 -21
  30. package/dist/hub.js +2 -0
  31. package/dist/i18n-config.d.ts +12 -0
  32. package/dist/i18n-config.js +95 -0
  33. package/dist/index.d.ts +6 -0
  34. package/dist/index.js +59 -14
  35. package/dist/mcp/tools.d.ts +1 -1
  36. package/dist/mcp/tools.js +9 -6
  37. package/dist/messages-gen.d.ts +1 -1
  38. package/dist/messages-gen.js +5 -2
  39. package/dist/scaffold/job.js +3 -1
  40. package/dist/templates/auth/Dashboard.vue.tpl +3 -2
  41. package/dist/templates/auth/Login.vue.tpl +3 -5
  42. package/dist/templates/auth/Signup.vue.tpl +3 -5
  43. package/dist/templates/auth/jwt.app.config.ts.tpl +18 -0
  44. package/dist/templates/auth/jwt.auth.wiring.ts.tpl +16 -0
  45. package/dist/templates/auth/jwt.routes.ts.tpl +7 -0
  46. package/dist/templates/auth/jwt.session.controller.ts.tpl +36 -0
  47. package/dist/templates/project/.dockerignore.tpl +3 -0
  48. package/dist/templates/project/.env.example.tpl +1 -1
  49. package/dist/templates/project/AGENTS.md.tpl +5 -3
  50. package/dist/templates/project/CLAUDE.md.tpl +5 -4
  51. package/dist/templates/project/Dockerfile.tpl +6 -1
  52. package/dist/templates/project/agents/async.md.tpl +75 -10
  53. package/dist/templates/project/agents/data.md.tpl +159 -22
  54. package/dist/templates/project/agents/frontend.md.tpl +51 -12
  55. package/dist/templates/project/agents/i18n.md.tpl +5 -2
  56. package/dist/templates/project/agents/mail.md.tpl +4 -2
  57. package/dist/templates/project/agents/realtime.md.tpl +37 -3
  58. package/dist/templates/project/agents/seal.md.tpl +14 -3
  59. package/dist/templates/project/agents/security.md.tpl +47 -11
  60. package/dist/templates/project/agents/storage.md.tpl +16 -8
  61. package/dist/templates/project/agents/web.md.tpl +78 -24
  62. package/dist/templates/project/apps/web/composables/useApiPing.ts.tpl +4 -3
  63. package/dist/templates/project/apps/web/controllers/home.ts.tpl +1 -1
  64. package/dist/templates/project/apps/web/main.ts.tpl +1 -1
  65. package/dist/templates/project/apps/web/routes.ts.tpl +1 -1
  66. package/dist/templates/project/docker-compose.yaml.tpl +1 -1
  67. package/dist/templates/project/pnpm-workspace.yaml.tpl +1 -1
  68. package/dist/templates/project/vite.config.ts.tpl +1 -1
  69. package/dist/work.d.ts +21 -0
  70. package/dist/work.js +45 -1
  71. package/package.json +12 -7
  72. package/dist/templates/index.ts +0 -109
@@ -1,109 +0,0 @@
1
- // @gaonjs/cli · templates/index.ts — 프로젝트 스캐폴드 템플릿 로더 (M9-F).
2
- //
3
- // `gaon new <name>` 이 소비하는 파일 트리. 소스 트리(src/templates/project/*)
4
- // 를 재귀 스캔해 각 `.tpl` 파일의 최종 경로와 렌더된 내용을 반환한다.
5
- // 렌더는 `{{TOKEN}}` 리터럴 replaceAll — Vue 의 `{{ }}` 보간과 겹치지 않는
6
- // 고정 리터럴이라 정규식 없이 안전하다(generate.ts 와 동일 관례).
7
- //
8
- // 폴더는 관례상 유지되어야 하지만 git 이 빈 폴더를 추적하지 않으므로
9
- // `.gitkeep.tpl` 을 두어 실 파일 `.gitkeep` 으로 렌더한다. 최종 경로는
10
- // `.tpl` 접미사를 벗긴 값이다.
11
-
12
- import { readFileSync, readdirSync } from 'node:fs'
13
- import { dirname, join, posix, relative, sep } from 'node:path'
14
- import { fileURLToPath } from 'node:url'
15
-
16
- /** 생성할 파일 하나 — path 는 프로젝트 루트 기준 상대 경로(POSIX). */
17
- export interface ProjectFile {
18
- readonly path: string
19
- readonly contents: string
20
- }
21
-
22
- /** 템플릿 렌더 시 치환되는 토큰 값. */
23
- export interface ProjectTemplateTokens {
24
- readonly projectName: string
25
- readonly gaonjsVersion: string
26
- /**
27
- * package.json 의 `packageManager` 필드(corepack 핀 · 예 `pnpm@10.27.0`).
28
- * 미지정 시 blessed 기본 pnpm. 선택한 pm 에 맞춰 채운다(결정 169).
29
- */
30
- readonly packageManager?: string
31
- }
32
-
33
- const TEMPLATE_DIR = join(dirname(fileURLToPath(import.meta.url)), 'project')
34
-
35
- /**
36
- * pm 별 `packageManager` 핀(corepack 형식 `<pm>@<x.y.z>`). 선택한 pm 을
37
- * 그대로 적어 corepack enforcement 가 install 을 막지 않게 한다(결정 169 ·
38
- * 12차 실사용 yarn 파손). 정본 버전 근거:
39
- * · pnpm@10.27.0 — blessed 툴체인(Dockerfile corepack·CI)과 정합.
40
- * · yarn@1.22.22 — yarn **classic** 최종 안정판. berry(2·4.x)는 `.yarnrc.yml`
41
- * 없이 기본 PnP 라 node_modules 를 읽는 vite·gaon serve 를 깨므로 배제.
42
- * · npm@10.9.9 — engines.node≥22(Node 22 LTS) 동봉 npm 라인의 tip.
43
- */
44
- export const PACKAGE_MANAGER_PINS: Readonly<Record<'pnpm' | 'npm' | 'yarn', string>> = {
45
- pnpm: 'pnpm@10.27.0',
46
- npm: 'npm@10.9.9',
47
- yarn: 'yarn@1.22.22',
48
- }
49
-
50
- /** blessed 기본(pm 미선택 시). */
51
- export const DEFAULT_PACKAGE_MANAGER = PACKAGE_MANAGER_PINS.pnpm
52
-
53
- /** 템플릿 문자열의 {{TOKEN}} 을 치환한다. 알 수 없는 토큰은 그대로 둔다. */
54
- export function renderTemplate(raw: string, tokens: ProjectTemplateTokens): string {
55
- return raw
56
- .replaceAll('{{PROJECT_NAME}}', tokens.projectName)
57
- .replaceAll('{{GAONJS_VERSION}}', tokens.gaonjsVersion)
58
- .replaceAll('{{PACKAGE_MANAGER}}', tokens.packageManager ?? DEFAULT_PACKAGE_MANAGER)
59
- }
60
-
61
- /** 템플릿 폴더를 재귀 스캔해 파일 목록을 만든다(POSIX 경로 · 정렬). */
62
- export function listTemplateFiles(root: string = TEMPLATE_DIR): string[] {
63
- const out: string[] = []
64
- const walk = (dir: string): void => {
65
- for (const entry of readdirSync(dir, { withFileTypes: true })) {
66
- const abs = join(dir, entry.name)
67
- if (entry.isDirectory()) {
68
- walk(abs)
69
- continue
70
- }
71
- if (!entry.isFile()) continue
72
- out.push(abs)
73
- }
74
- }
75
- walk(root)
76
- return out.sort()
77
- }
78
-
79
- /**
80
- * 스캐폴드 파일 전체를 렌더링해 반환한다.
81
- * `.tpl` 접미사는 벗기고, `{{PROJECT_NAME}}`·`{{GAONJS_VERSION}}` 을 치환한다.
82
- */
83
- export function renderProjectFiles(tokens: ProjectTemplateTokens): ProjectFile[] {
84
- const paths = listTemplateFiles()
85
- return paths.map((abs) => {
86
- const rel = relative(TEMPLATE_DIR, abs).split(sep).join(posix.sep)
87
- const outPath = rel.endsWith('.tpl') ? rel.slice(0, -'.tpl'.length) : rel
88
- const raw = readFileSync(abs, 'utf8')
89
- return { path: outPath, contents: renderTemplate(raw, tokens) }
90
- })
91
- }
92
-
93
- /** 테스트·검증용 — 템플릿 폴더의 절대 경로. */
94
- export function templateDir(): string {
95
- return TEMPLATE_DIR
96
- }
97
-
98
- /** 렌더링된 내용에 미치환 토큰이 남아 있는지 검사(회귀 방지). */
99
- export function findUnresolvedTokens(contents: string): string[] {
100
- const re = /\{\{([A-Z_][A-Z0-9_]*)\}\}/g
101
- const found = new Set<string>()
102
- for (const m of contents.matchAll(re)) {
103
- // Vue 템플릿의 {{ prop }} (소문자·공백 시작) 은 제외 — 위 정규식이 대문자만
104
- // 잡으므로 자연스럽게 걸러진다. 남으면 진짜 미치환.
105
- found.add(m[1]!)
106
- }
107
- return [...found].sort()
108
- }
109
-