@simplysm/sd-cli 13.0.68 → 13.0.70

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 (201) hide show
  1. package/README.md +10 -957
  2. package/dist/builders/BaseBuilder.d.ts +23 -23
  3. package/dist/builders/BaseBuilder.d.ts.map +1 -1
  4. package/dist/builders/BaseBuilder.js +15 -15
  5. package/dist/builders/DtsBuilder.d.ts +4 -4
  6. package/dist/builders/DtsBuilder.js +1 -1
  7. package/dist/builders/LibraryBuilder.d.ts +3 -3
  8. package/dist/builders/types.d.ts +10 -10
  9. package/dist/capacitor/capacitor.d.ts +36 -36
  10. package/dist/capacitor/capacitor.js +63 -63
  11. package/dist/capacitor/capacitor.js.map +1 -1
  12. package/dist/commands/add-client.d.ts +8 -8
  13. package/dist/commands/add-client.js +15 -15
  14. package/dist/commands/add-client.js.map +1 -1
  15. package/dist/commands/add-server.d.ts +9 -9
  16. package/dist/commands/add-server.js +13 -13
  17. package/dist/commands/add-server.js.map +1 -1
  18. package/dist/commands/build.d.ts +9 -9
  19. package/dist/commands/check.js +3 -3
  20. package/dist/commands/check.js.map +1 -1
  21. package/dist/commands/dev.d.ts +9 -9
  22. package/dist/commands/device.d.ts +9 -9
  23. package/dist/commands/device.d.ts.map +1 -1
  24. package/dist/commands/device.js +17 -17
  25. package/dist/commands/device.js.map +1 -1
  26. package/dist/commands/init.d.ts +6 -6
  27. package/dist/commands/init.js +12 -12
  28. package/dist/commands/init.js.map +1 -1
  29. package/dist/commands/lint.d.ts +23 -23
  30. package/dist/commands/lint.d.ts.map +1 -1
  31. package/dist/commands/lint.js +25 -25
  32. package/dist/commands/lint.js.map +1 -1
  33. package/dist/commands/publish.d.ts +13 -13
  34. package/dist/commands/publish.d.ts.map +1 -1
  35. package/dist/commands/publish.js +61 -61
  36. package/dist/commands/publish.js.map +1 -1
  37. package/dist/commands/replace-deps.d.ts +3 -3
  38. package/dist/commands/replace-deps.d.ts.map +1 -1
  39. package/dist/commands/replace-deps.js +1 -1
  40. package/dist/commands/replace-deps.js.map +1 -1
  41. package/dist/commands/typecheck.d.ts +20 -20
  42. package/dist/commands/typecheck.d.ts.map +1 -1
  43. package/dist/commands/typecheck.js +20 -20
  44. package/dist/commands/typecheck.js.map +1 -1
  45. package/dist/commands/watch.d.ts +7 -7
  46. package/dist/electron/electron.d.ts +27 -27
  47. package/dist/electron/electron.js +32 -32
  48. package/dist/electron/electron.js.map +1 -1
  49. package/dist/infra/ResultCollector.d.ts +9 -9
  50. package/dist/infra/ResultCollector.js +5 -5
  51. package/dist/infra/SignalHandler.d.ts +7 -7
  52. package/dist/infra/SignalHandler.js +4 -4
  53. package/dist/infra/WorkerManager.d.ts +14 -14
  54. package/dist/infra/WorkerManager.js +11 -11
  55. package/dist/orchestrators/BuildOrchestrator.d.ts +19 -19
  56. package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
  57. package/dist/orchestrators/BuildOrchestrator.js +26 -26
  58. package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
  59. package/dist/orchestrators/DevOrchestrator.d.ts +25 -25
  60. package/dist/orchestrators/DevOrchestrator.d.ts.map +1 -1
  61. package/dist/orchestrators/DevOrchestrator.js +30 -30
  62. package/dist/orchestrators/DevOrchestrator.js.map +1 -1
  63. package/dist/orchestrators/WatchOrchestrator.d.ts +13 -13
  64. package/dist/orchestrators/WatchOrchestrator.js +17 -17
  65. package/dist/orchestrators/WatchOrchestrator.js.map +1 -1
  66. package/dist/sd-cli-entry.d.ts +2 -2
  67. package/dist/sd-cli-entry.js +38 -38
  68. package/dist/sd-cli-entry.js.map +1 -1
  69. package/dist/sd-cli.d.ts +2 -2
  70. package/dist/sd-cli.js +1 -1
  71. package/dist/sd-cli.js.map +1 -1
  72. package/dist/sd-config.types.d.ts +84 -84
  73. package/dist/sd-config.types.d.ts.map +1 -1
  74. package/dist/utils/build-env.d.ts +1 -1
  75. package/dist/utils/config-editor.d.ts +5 -5
  76. package/dist/utils/config-editor.js +2 -2
  77. package/dist/utils/config-editor.js.map +1 -1
  78. package/dist/utils/copy-public.d.ts +9 -9
  79. package/dist/utils/copy-src.d.ts +9 -9
  80. package/dist/utils/esbuild-config.d.ts +30 -30
  81. package/dist/utils/esbuild-config.d.ts.map +1 -1
  82. package/dist/utils/output-utils.d.ts +6 -6
  83. package/dist/utils/package-utils.d.ts +6 -6
  84. package/dist/utils/package-utils.js +1 -1
  85. package/dist/utils/package-utils.js.map +1 -1
  86. package/dist/utils/rebuild-manager.js +3 -3
  87. package/dist/utils/rebuild-manager.js.map +1 -1
  88. package/dist/utils/replace-deps.d.ts +25 -25
  89. package/dist/utils/replace-deps.js +3 -3
  90. package/dist/utils/replace-deps.js.map +1 -1
  91. package/dist/utils/sd-config.d.ts +3 -3
  92. package/dist/utils/sd-config.js +3 -3
  93. package/dist/utils/sd-config.js.map +1 -1
  94. package/dist/utils/tailwind-config-deps.d.ts +3 -3
  95. package/dist/utils/template.d.ts +8 -8
  96. package/dist/utils/tsconfig.d.ts +16 -16
  97. package/dist/utils/tsconfig.js +2 -2
  98. package/dist/utils/tsconfig.js.map +1 -1
  99. package/dist/utils/typecheck-serialization.d.ts +8 -8
  100. package/dist/utils/vite-config.d.ts +8 -8
  101. package/dist/utils/vite-config.d.ts.map +1 -1
  102. package/dist/utils/vite-config.js +3 -3
  103. package/dist/utils/worker-events.d.ts +12 -12
  104. package/dist/utils/worker-events.d.ts.map +1 -1
  105. package/dist/utils/worker-utils.d.ts +3 -3
  106. package/dist/utils/worker-utils.js +2 -2
  107. package/dist/utils/worker-utils.js.map +1 -1
  108. package/dist/workers/client.worker.d.ts +14 -14
  109. package/dist/workers/client.worker.d.ts.map +1 -1
  110. package/dist/workers/client.worker.js +1 -1
  111. package/dist/workers/client.worker.js.map +1 -1
  112. package/dist/workers/dts.worker.d.ts +13 -13
  113. package/dist/workers/dts.worker.d.ts.map +1 -1
  114. package/dist/workers/dts.worker.js +3 -3
  115. package/dist/workers/dts.worker.js.map +1 -1
  116. package/dist/workers/library.worker.d.ts +12 -12
  117. package/dist/workers/library.worker.js +1 -1
  118. package/dist/workers/library.worker.js.map +1 -1
  119. package/dist/workers/lint.worker.d.ts +1 -1
  120. package/dist/workers/server-runtime.worker.d.ts +6 -6
  121. package/dist/workers/server-runtime.worker.js +6 -6
  122. package/dist/workers/server-runtime.worker.js.map +1 -1
  123. package/dist/workers/server.worker.d.ts +20 -20
  124. package/dist/workers/server.worker.d.ts.map +1 -1
  125. package/dist/workers/server.worker.js +6 -6
  126. package/dist/workers/server.worker.js.map +1 -1
  127. package/package.json +8 -7
  128. package/src/builders/BaseBuilder.ts +33 -33
  129. package/src/builders/DtsBuilder.ts +5 -5
  130. package/src/builders/LibraryBuilder.ts +9 -9
  131. package/src/builders/types.ts +10 -10
  132. package/src/capacitor/capacitor.ts +119 -119
  133. package/src/commands/add-client.ts +31 -31
  134. package/src/commands/add-server.ts +34 -34
  135. package/src/commands/build.ts +9 -9
  136. package/src/commands/check.ts +5 -5
  137. package/src/commands/dev.ts +9 -9
  138. package/src/commands/device.ts +30 -30
  139. package/src/commands/init.ts +25 -25
  140. package/src/commands/lint.ts +64 -64
  141. package/src/commands/publish.ts +139 -139
  142. package/src/commands/replace-deps.ts +4 -4
  143. package/src/commands/typecheck.ts +74 -74
  144. package/src/commands/watch.ts +7 -7
  145. package/src/electron/electron.ts +51 -51
  146. package/src/infra/ResultCollector.ts +9 -9
  147. package/src/infra/SignalHandler.ts +7 -7
  148. package/src/infra/WorkerManager.ts +14 -14
  149. package/src/orchestrators/BuildOrchestrator.ts +76 -76
  150. package/src/orchestrators/DevOrchestrator.ts +88 -88
  151. package/src/orchestrators/WatchOrchestrator.ts +39 -39
  152. package/src/sd-cli-entry.ts +43 -43
  153. package/src/sd-cli.ts +15 -15
  154. package/src/sd-config.types.ts +85 -85
  155. package/src/utils/build-env.ts +1 -1
  156. package/src/utils/config-editor.ts +19 -19
  157. package/src/utils/copy-public.ts +17 -17
  158. package/src/utils/copy-src.ts +11 -11
  159. package/src/utils/esbuild-config.ts +33 -33
  160. package/src/utils/output-utils.ts +11 -11
  161. package/src/utils/package-utils.ts +12 -12
  162. package/src/utils/rebuild-manager.ts +3 -3
  163. package/src/utils/replace-deps.ts +361 -361
  164. package/src/utils/sd-config.ts +44 -44
  165. package/src/utils/tailwind-config-deps.ts +98 -98
  166. package/src/utils/template.ts +56 -56
  167. package/src/utils/tsconfig.ts +127 -127
  168. package/src/utils/typecheck-serialization.ts +86 -86
  169. package/src/utils/vite-config.ts +341 -341
  170. package/src/utils/worker-events.ts +16 -16
  171. package/src/utils/worker-utils.ts +45 -45
  172. package/src/workers/client.worker.ts +34 -34
  173. package/src/workers/dts.worker.ts +467 -467
  174. package/src/workers/library.worker.ts +314 -314
  175. package/src/workers/lint.worker.ts +16 -16
  176. package/src/workers/server-runtime.worker.ts +157 -157
  177. package/src/workers/server.worker.ts +572 -572
  178. package/templates/add-client/__CLIENT__/package.json.hbs +1 -1
  179. package/templates/add-server/__SERVER__/package.json.hbs +2 -2
  180. package/templates/init/package.json.hbs +3 -3
  181. package/tests/config-editor.spec.ts +160 -0
  182. package/tests/copy-src.spec.ts +50 -0
  183. package/tests/get-compiler-options-for-package.spec.ts +139 -0
  184. package/tests/get-package-source-files.spec.ts +181 -0
  185. package/tests/get-types-from-package-json.spec.ts +107 -0
  186. package/tests/infra/ResultCollector.spec.ts +39 -0
  187. package/tests/infra/SignalHandler.spec.ts +38 -0
  188. package/tests/infra/WorkerManager.spec.ts +97 -0
  189. package/tests/load-ignore-patterns.spec.ts +188 -0
  190. package/tests/load-sd-config.spec.ts +137 -0
  191. package/tests/package-utils.spec.ts +188 -0
  192. package/tests/parse-root-tsconfig.spec.ts +89 -0
  193. package/tests/replace-deps.spec.ts +308 -0
  194. package/tests/run-lint.spec.ts +415 -0
  195. package/tests/run-typecheck.spec.ts +653 -0
  196. package/tests/run-watch.spec.ts +75 -0
  197. package/tests/sd-cli.spec.ts +330 -0
  198. package/tests/tailwind-config-deps.spec.ts +30 -0
  199. package/tests/template.spec.ts +70 -0
  200. package/tests/utils/rebuild-manager.spec.ts +43 -0
  201. package/tests/write-changed-output-files.spec.ts +97 -0
@@ -1,32 +1,32 @@
1
1
  /**
2
- * 빌드 타겟 유형 (esbuild로 빌드)
3
- * - node: Node.js 전용 패키지
4
- * - browser: 브라우저 전용 패키지
5
- * - neutral: Node/브라우저 공용 패키지
2
+ * Build target type (built with esbuild)
3
+ * - node: Node.js only package
4
+ * - browser: browser only package
5
+ * - neutral: Node/browser shared package
6
6
  */
7
7
  export type BuildTarget = "node" | "browser" | "neutral";
8
8
 
9
- //#region Publish 설정 타입
9
+ //#region Publish configuration types
10
10
 
11
11
  /**
12
- * 패키지 publish 설정
13
- * - "npm": npm 레지스트리에 배포
14
- * - SdLocalDirectoryPublishConfig: 로컬 디렉토리에 복사
15
- * - SdStoragePublishConfig: FTP/FTPS/SFTP 서버에 업로드
12
+ * Package publish configuration
13
+ * - "npm": deploy to npm registry
14
+ * - SdLocalDirectoryPublishConfig: copy to local directory
15
+ * - SdStoragePublishConfig: upload to FTP/FTPS/SFTP server
16
16
  */
17
17
  export type SdPublishConfig = "npm" | SdLocalDirectoryPublishConfig | SdStoragePublishConfig;
18
18
 
19
19
  /**
20
- * 로컬 디렉토리 publish 설정
20
+ * Local directory publish configuration
21
21
  */
22
22
  export interface SdLocalDirectoryPublishConfig {
23
23
  type: "local-directory";
24
- /** 배포 대상 경로 (환경변수 치환 지원: %VER%, %PROJECT%) */
24
+ /** deployment target path (supports environment variable substitution: %VER%, %PROJECT%) */
25
25
  path: string;
26
26
  }
27
27
 
28
28
  /**
29
- * 스토리지 (FTP/FTPS/SFTP) publish 설정
29
+ * Storage (FTP/FTPS/SFTP) publish configuration
30
30
  */
31
31
  export interface SdStoragePublishConfig {
32
32
  type: "ftp" | "ftps" | "sftp";
@@ -38,168 +38,168 @@ export interface SdStoragePublishConfig {
38
38
  }
39
39
 
40
40
  /**
41
- * postPublish 스크립트 설정
41
+ * postPublish script configuration
42
42
  */
43
43
  export interface SdPostPublishScriptConfig {
44
44
  type: "script";
45
45
  cmd: string;
46
- /** 스크립트 인자 (환경변수 치환 지원: %VER%, %PROJECT%) */
46
+ /** script arguments (supports environment variable substitution: %VER%, %PROJECT%) */
47
47
  args: string[];
48
48
  }
49
49
 
50
50
  //#endregion
51
51
 
52
52
  /**
53
- * 패키지 설정 (node/browser/neutral)
53
+ * Package configuration (node/browser/neutral)
54
54
  */
55
55
  export interface SdBuildPackageConfig {
56
- /** 빌드 타겟 */
56
+ /** build target */
57
57
  target: BuildTarget;
58
- /** publish 설정 */
58
+ /** publish configuration */
59
59
  publish?: SdPublishConfig;
60
- /** src/에서 dist/로 복사할 파일 glob 패턴 (src/ 기준 상대 경로) */
60
+ /** glob patterns for files to copy from src/ to dist/ (relative path based on src/) */
61
61
  copySrc?: string[];
62
62
  }
63
63
 
64
64
  /**
65
- * Capacitor Android 서명 설정
65
+ * Capacitor Android sign configuration
66
66
  */
67
67
  export interface SdCapacitorSignConfig {
68
- /** keystore 파일 경로 (패키지 디렉토리 기준 상대경로) */
68
+ /** keystore file path (relative path based on package directory) */
69
69
  keystore: string;
70
- /** keystore 비밀번호 */
70
+ /** keystore password */
71
71
  storePassword: string;
72
- /** 별칭 */
72
+ /** key alias */
73
73
  alias: string;
74
- /** 비밀번호 */
74
+ /** key password */
75
75
  password: string;
76
- /** keystore 타입 (기본값: "jks") */
76
+ /** keystore type (default: "jks") */
77
77
  keystoreType?: string;
78
78
  }
79
79
 
80
80
  /**
81
- * Capacitor Android 권한 설정
81
+ * Capacitor Android permission configuration
82
82
  */
83
83
  export interface SdCapacitorPermission {
84
- /** 권한 이름 (예: "CAMERA", "WRITE_EXTERNAL_STORAGE") */
84
+ /** permission name (e.g., "CAMERA", "WRITE_EXTERNAL_STORAGE") */
85
85
  name: string;
86
- /** 최대 SDK 버전 */
86
+ /** maximum SDK version */
87
87
  maxSdkVersion?: number;
88
- /** tools:ignore 속성 */
88
+ /** tools:ignore attribute value */
89
89
  ignore?: string;
90
90
  }
91
91
 
92
92
  /**
93
- * Capacitor Android Intent Filter 설정
93
+ * Capacitor Android Intent Filter configuration
94
94
  */
95
95
  export interface SdCapacitorIntentFilter {
96
- /** intent action (예: "android.intent.action.VIEW") */
96
+ /** intent action (e.g., "android.intent.action.VIEW") */
97
97
  action?: string;
98
- /** intent category (예: "android.intent.category.DEFAULT") */
98
+ /** intent category (e.g., "android.intent.category.DEFAULT") */
99
99
  category?: string;
100
100
  }
101
101
 
102
102
  /**
103
- * Capacitor Android 플랫폼 설정
103
+ * Capacitor Android platform configuration
104
104
  */
105
105
  export interface SdCapacitorAndroidConfig {
106
- /** AndroidManifest.xml application 태그 속성 (예: { requestLegacyExternalStorage: "true" }) */
106
+ /** AndroidManifest.xml application tag attributes (e.g., { requestLegacyExternalStorage: "true" }) */
107
107
  config?: Record<string, string>;
108
- /** AAB 번들 빌드 여부 (false APK) */
108
+ /** AAB bundle build flag (false for APK) */
109
109
  bundle?: boolean;
110
- /** Intent Filter 설정 */
110
+ /** Intent Filter configuration */
111
111
  intentFilters?: SdCapacitorIntentFilter[];
112
- /** APK/AAB 서명 설정 */
112
+ /** APK/AAB signing configuration */
113
113
  sign?: SdCapacitorSignConfig;
114
- /** Android SDK 버전 (minSdk, targetSdk) */
114
+ /** Android SDK version (minSdk, targetSdk) */
115
115
  sdkVersion?: number;
116
- /** 추가 권한 설정 */
116
+ /** additional permission configuration */
117
117
  permissions?: SdCapacitorPermission[];
118
118
  }
119
119
 
120
120
  /**
121
- * Capacitor 설정
121
+ * Capacitor configuration
122
122
  */
123
123
  export interface SdCapacitorConfig {
124
- /** ID (예: "com.example.app") */
124
+ /** app ID (e.g., "com.example.app") */
125
125
  appId: string;
126
- /** 이름 */
126
+ /** app name */
127
127
  appName: string;
128
- /** Capacitor 플러그인 설정 (키: 패키지명, 값: true 또는 플러그인 옵션) */
128
+ /** Capacitor plugin configuration (key: package name, value: true or plugin options) */
129
129
  plugins?: Record<string, Record<string, unknown> | true>;
130
- /** 아이콘 경로 (패키지 디렉토리 기준 상대경로) */
130
+ /** app icon path (relative path based on package directory) */
131
131
  icon?: string;
132
- /** 디버그 빌드 여부 */
132
+ /** debug build flag */
133
133
  debug?: boolean;
134
- /** 플랫폼별 설정 */
134
+ /** per-platform configuration */
135
135
  platform?: {
136
136
  android?: SdCapacitorAndroidConfig;
137
137
  };
138
138
  }
139
139
 
140
140
  /**
141
- * Electron 설정
141
+ * Electron configuration
142
142
  */
143
143
  export interface SdElectronConfig {
144
- /** Electron ID (예: "com.example.myapp") */
144
+ /** Electron app ID (e.g., "com.example.myapp") */
145
145
  appId: string;
146
- /** portable .exe (true) 또는 NSIS 인스톨러 (false/미지정) */
146
+ /** portable .exe (true) or NSIS installer (false/unspecified) */
147
147
  portable?: boolean;
148
- /** 인스톨러 아이콘 경로 (.ico, 패키지 디렉토리 기준 상대경로) */
148
+ /** installer icon path (.ico, relative path based on package directory) */
149
149
  installerIcon?: string;
150
- /** Electron에 포함할 npm 패키지 (native 모듈 ) */
150
+ /** npm packages to include in Electron (native modules, etc.) */
151
151
  reinstallDependencies?: string[];
152
- /** npm postinstall 스크립트 */
152
+ /** npm postinstall script */
153
153
  postInstallScript?: string;
154
- /** NSIS 옵션 (portable 아닌 경우) */
154
+ /** NSIS options (when portable is false) */
155
155
  nsisOptions?: Record<string, unknown>;
156
- /** 환경변수 (electron-main.ts에서 process.env로 접근) */
156
+ /** environment variables (accessible via process.env in electron-main.ts) */
157
157
  env?: Record<string, string>;
158
158
  }
159
159
 
160
160
  /**
161
- * 클라이언트 패키지 설정 (Vite 개발 서버)
161
+ * Client package configuration (Vite development server)
162
162
  */
163
163
  export interface SdClientPackageConfig {
164
- /** 빌드 타겟 */
164
+ /** build target */
165
165
  target: "client";
166
166
  /**
167
- * 서버 설정
168
- * - string: 연결할 서버 패키지명 (예: "solid-demo-server")
169
- * - number: Vite 직접 포트 사용 (하위 호환성)
167
+ * server configuration
168
+ * - string: server package name to connect to (e.g., "solid-demo-server")
169
+ * - number: use Vite port directly (backward compatibility)
170
170
  */
171
171
  server: string | number;
172
- /** 빌드 치환할 환경변수 (process.env 객체로 치환) */
172
+ /** environment variables to substitute during build (replace process.env with object) */
173
173
  env?: Record<string, string>;
174
- /** publish 설정 */
174
+ /** publish configuration */
175
175
  publish?: SdPublishConfig;
176
- /** Capacitor 설정 */
176
+ /** Capacitor configuration */
177
177
  capacitor?: SdCapacitorConfig;
178
- /** Electron 설정 */
178
+ /** Electron configuration */
179
179
  electron?: SdElectronConfig;
180
180
  /** runtime config (written to dist/.config.json during build) */
181
181
  configs?: Record<string, unknown>;
182
182
  }
183
183
 
184
184
  /**
185
- * 서버 패키지 설정 (Fastify 서버)
185
+ * Server package configuration (Fastify server)
186
186
  */
187
187
  export interface SdServerPackageConfig {
188
- /** 빌드 타겟 */
188
+ /** build target */
189
189
  target: "server";
190
- /** 빌드 치환할 환경변수 (process.env.KEY 상수로 치환) */
190
+ /** environment variables to substitute during build (replace process.env.KEY with constant) */
191
191
  env?: Record<string, string>;
192
- /** publish 설정 */
192
+ /** publish configuration */
193
193
  publish?: SdPublishConfig;
194
194
  /** runtime config (written to dist/.config.json during build) */
195
195
  configs?: Record<string, unknown>;
196
- /** esbuild에서 번들에 포함하지 않을 외부 모듈 (binding.gyp 자동 감지에 더해 수동 지정) */
196
+ /** external modules not to include in esbuild bundle (in addition to automatic binding.gyp detection) */
197
197
  externals?: string[];
198
- /** PM2 설정 (지정 dist/pm2.config.cjs 생성) */
198
+ /** PM2 configuration (generates dist/pm2.config.cjs when specified) */
199
199
  pm2?: {
200
- /** PM2 프로세스 이름 (미지정 package.json name에서 생성) */
200
+ /** PM2 process name (generated from package.json name if unspecified) */
201
201
  name?: string;
202
- /** PM2 watch에서 제외할 경로 */
202
+ /** paths to exclude from PM2 watch */
203
203
  ignoreWatchPaths?: string[];
204
204
  };
205
205
  /** Package manager to use (affects mise.toml or volta settings generation) */
@@ -207,15 +207,15 @@ export interface SdServerPackageConfig {
207
207
  }
208
208
 
209
209
  /**
210
- * 스크립트 전용 패키지 설정 (watch/typecheck 제외)
210
+ * Scripts-only package configuration (excluded from watch/typecheck)
211
211
  */
212
212
  export interface SdScriptsPackageConfig {
213
- /** 빌드 타겟 */
213
+ /** build target */
214
214
  target: "scripts";
215
215
  }
216
216
 
217
217
  /**
218
- * 패키지 설정
218
+ * Package configuration
219
219
  */
220
220
  export type SdPackageConfig =
221
221
  | SdBuildPackageConfig
@@ -224,36 +224,36 @@ export type SdPackageConfig =
224
224
  | SdScriptsPackageConfig;
225
225
 
226
226
  /**
227
- * sd.config.ts 설정 타입
227
+ * sd.config.ts configuration type
228
228
  */
229
229
  export interface SdConfig {
230
- /** 패키지별 설정 (키: packages/ 하위 디렉토리 이름, 예: "core-common") */
230
+ /** per-package configuration (key: subdirectory name under packages/, e.g., "core-common") */
231
231
  packages: Record<string, SdPackageConfig | undefined>;
232
232
  /**
233
- * 의존성 교체 설정 (node_modules 패키지를 로컬 소스로 symlink 교체)
234
- * - 키: node_modules에서 찾을 패키지 glob 패턴 (예: "@simplysm/*")
235
- * - 값: 소스 디렉토리 경로 (키의 * 캡처값이 값의 *에 치환됨)
236
- * - 예: { "@simplysm/*": "../simplysm/packages/*" }
233
+ * dependency replacement configuration (replace node_modules packages with local sources via symlink)
234
+ * - key: package glob pattern to find in node_modules (e.g., "@simplysm/*")
235
+ * - value: source directory path (captured values from key's * are substituted into value's *)
236
+ * - example: { "@simplysm/*": "../simplysm/packages/*" }
237
237
  */
238
238
  replaceDeps?: Record<string, string>;
239
- /** 배포 완료 실행할 스크립트 */
239
+ /** script to execute after deployment completes */
240
240
  postPublish?: SdPostPublishScriptConfig[];
241
241
  }
242
242
 
243
243
  /**
244
- * sd.config.ts 함수에 전달되는 파라미터
244
+ * parameters passed to sd.config.ts function
245
245
  */
246
246
  export interface SdConfigParams {
247
- /** 현재 작업 디렉토리 */
247
+ /** current working directory */
248
248
  cwd: string;
249
- /** 개발 모드 여부 */
249
+ /** development mode flag */
250
250
  dev: boolean;
251
- /** 추가 옵션 (CLI -o 플래그) */
251
+ /** additional options (from CLI's -o flag) */
252
252
  opt: string[];
253
253
  }
254
254
 
255
255
  /**
256
- * sd.config.ts 다음과 같은 형태의 함수를 default export해야 한다:
256
+ * sd.config.ts must default export a function of the following form:
257
257
  *
258
258
  * ```typescript
259
259
  * import type { SdConfig, SdConfigFn, SdConfigParams } from "@simplysm/sd-cli";
@@ -2,7 +2,7 @@ import path from "path";
2
2
  import fs from "fs/promises";
3
3
 
4
4
  /**
5
- * 루트 package.json에서 version 가져오기
5
+ * Get version from root package.json
6
6
  */
7
7
  export async function getVersion(cwd: string): Promise<string> {
8
8
  const pkgJsonPath = path.join(cwd, "package.json");
@@ -1,9 +1,9 @@
1
1
  import { Project, SyntaxKind, type ObjectLiteralExpression } from "ts-morph";
2
2
 
3
3
  /**
4
- * sd.config.ts에서 packages 객체 리터럴을 찾는다.
4
+ * Find packages object literal in sd.config.ts
5
5
  *
6
- * 구조: const config: SdConfigFn = () => ({ packages: { ... } });
6
+ * Structure: const config: SdConfigFn = () => ({ packages: { ... } });
7
7
  * -> ArrowFunction -> ParenthesizedExpression -> ObjectLiteral -> "packages" property -> ObjectLiteral
8
8
  */
9
9
  function findPackagesObject(configPath: string): {
@@ -13,11 +13,11 @@ function findPackagesObject(configPath: string): {
13
13
  const project = new Project();
14
14
  const sourceFile = project.addSourceFileAtPath(configPath);
15
15
 
16
- // "config" 변수 선언 찾기
16
+ // Find "config" variable declaration
17
17
  const configVar = sourceFile.getVariableDeclarationOrThrow("config");
18
18
  const arrowFn = configVar.getInitializerIfKindOrThrow(SyntaxKind.ArrowFunction);
19
19
 
20
- // 화살표 함수 본문에서 반환 객체 찾기
20
+ // Find return object in arrow function body
21
21
  const body = arrowFn.getBody();
22
22
  let returnObj: ObjectLiteralExpression;
23
23
 
@@ -27,10 +27,10 @@ function findPackagesObject(configPath: string): {
27
27
  const returnStmt = body.getFirstDescendantByKindOrThrow(SyntaxKind.ReturnStatement);
28
28
  returnObj = returnStmt.getExpressionIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
29
29
  } else {
30
- throw new Error("sd.config.ts의 구조를 인식할 수 없습니다.");
30
+ throw new Error("Unable to recognize structure of sd.config.ts");
31
31
  }
32
32
 
33
- // "packages" 프로퍼티 찾기
33
+ // Find "packages" property
34
34
  const packagesProp = returnObj
35
35
  .getPropertyOrThrow("packages")
36
36
  .asKindOrThrow(SyntaxKind.PropertyAssignment);
@@ -40,9 +40,9 @@ function findPackagesObject(configPath: string): {
40
40
  }
41
41
 
42
42
  /**
43
- * sd.config.ts의 packages 객체에 패키지 항목을 추가한다.
43
+ * Add new package entry to packages object in sd.config.ts
44
44
  *
45
- * @returns true: 성공, false: 이미 존재
45
+ * @returns true: success, false: already exists
46
46
  */
47
47
  export function addPackageToSdConfig(
48
48
  configPath: string,
@@ -51,14 +51,14 @@ export function addPackageToSdConfig(
51
51
  ): boolean {
52
52
  const { project, packagesObj } = findPackagesObject(configPath);
53
53
 
54
- // 이미 존재하는지 확인 (따옴표 있는 형태와 없는 형태 모두 체크)
54
+ // Check if already exists (check both quoted and unquoted forms)
55
55
  const existing =
56
56
  packagesObj.getProperty(`"${packageName}"`) ?? packagesObj.getProperty(packageName);
57
57
  if (existing) {
58
58
  return false;
59
59
  }
60
60
 
61
- // 프로퍼티 추가 -- config 객체를 ts-morph initializer 문자열로 변환
61
+ // Add new property -- convert config object to ts-morph initializer string
62
62
  const configStr = JSON.stringify(config)
63
63
  .replace(/"([^"]+)":/g, "$1: ")
64
64
  .replace(/"/g, '"');
@@ -73,7 +73,7 @@ export function addPackageToSdConfig(
73
73
  }
74
74
 
75
75
  /**
76
- * sd.config.ts에서 특정 클라이언트의 server 필드를 설정한다.
76
+ * Set server field for specific client in sd.config.ts
77
77
  */
78
78
  export function setClientServerInSdConfig(
79
79
  configPath: string,
@@ -85,19 +85,19 @@ export function setClientServerInSdConfig(
85
85
  const clientPropNode =
86
86
  packagesObj.getProperty(`"${clientName}"`) ?? packagesObj.getProperty(clientName);
87
87
  if (clientPropNode == null) {
88
- throw new Error(`클라이언트 "${clientName}"을(를) sd.config.ts에서 찾을 수 없습니다.`);
88
+ throw new Error(`Client "${clientName}" not found in sd.config.ts`);
89
89
  }
90
90
 
91
91
  const clientProp = clientPropNode.asKindOrThrow(SyntaxKind.PropertyAssignment);
92
92
  const clientObj = clientProp.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
93
93
 
94
- // 기존 server 프로퍼티가 있으면 제거
94
+ // Remove existing server property if present
95
95
  const serverProp = clientObj.getProperty("server");
96
96
  if (serverProp) {
97
97
  serverProp.remove();
98
98
  }
99
99
 
100
- // server 프로퍼티 추가
100
+ // Add server property
101
101
  clientObj.addPropertyAssignment({
102
102
  name: "server",
103
103
  initializer: `"${serverName}"`,
@@ -107,26 +107,26 @@ export function setClientServerInSdConfig(
107
107
  }
108
108
 
109
109
  /**
110
- * eslint.config.ts에 tailwindcss 설정 블록을 추가한다.
110
+ * Add tailwindcss config block to eslint.config.ts
111
111
  *
112
- * @returns true: 추가됨, false: 이미 존재
112
+ * @returns true: added, false: already exists
113
113
  */
114
114
  export function addTailwindToEslintConfig(configPath: string, clientName: string): boolean {
115
115
  const project = new Project();
116
116
  const sourceFile = project.addSourceFileAtPath(configPath);
117
117
 
118
- // default export 배열 찾기
118
+ // Find default export array
119
119
  const defaultExport = sourceFile.getFirstDescendantByKindOrThrow(
120
120
  SyntaxKind.ArrayLiteralExpression,
121
121
  );
122
122
 
123
- // tailwindcss 설정이 이미 있는지 확인
123
+ // Check if tailwindcss config already exists
124
124
  const text = defaultExport.getText();
125
125
  if (text.includes("tailwindcss")) {
126
126
  return false;
127
127
  }
128
128
 
129
- // 설정 객체 추가
129
+ // Add new config object
130
130
  defaultExport.addElement(`{
131
131
  files: ["**/*.{ts,tsx}"],
132
132
  settings: {
@@ -10,17 +10,17 @@ import {
10
10
  } from "@simplysm/core-node";
11
11
 
12
12
  /**
13
- * public/ public-dev/ 디렉토리의 파일을 dist/로 복사한다.
14
- * public-dev/가 public/보다 우선한다 (overlay).
13
+ * Copy files from public/ and public-dev/ directories to dist/.
14
+ * public-dev/ takes priority over public/ (overlay).
15
15
  *
16
- * @param pkgDir 패키지 루트 디렉토리
17
- * @param includeDev public-dev/ 포함 여부 (dev 모드에서만 true)
16
+ * @param pkgDir Package root directory
17
+ * @param includeDev Whether to include public-dev/ (true only in dev mode)
18
18
  */
19
19
  export async function copyPublicFiles(pkgDir: string, includeDev: boolean): Promise<void> {
20
20
  const distDir = path.join(pkgDir, "dist");
21
21
  await fsMkdir(distDir);
22
22
 
23
- // public/ 복사
23
+ // Copy public/
24
24
  const publicDir = path.join(pkgDir, "public");
25
25
  if (await fsExists(publicDir)) {
26
26
  const files = await fsGlob("**/*", { cwd: publicDir, absolute: true });
@@ -32,7 +32,7 @@ export async function copyPublicFiles(pkgDir: string, includeDev: boolean): Prom
32
32
  }
33
33
  }
34
34
 
35
- // public-dev/ 복사 (overlay: public/ 위에 덮어씀)
35
+ // Copy public-dev/ (overlay: overwrites public/)
36
36
  if (includeDev) {
37
37
  const publicDevDir = path.join(pkgDir, "public-dev");
38
38
  if (await fsExists(publicDevDir)) {
@@ -48,12 +48,12 @@ export async function copyPublicFiles(pkgDir: string, includeDev: boolean): Prom
48
48
  }
49
49
 
50
50
  /**
51
- * public/ public-dev/ 디렉토리를 감시하여 dist/로 실시간 복사한다.
52
- * 초기 복사 변경/추가/삭제를 자동 반영한다.
51
+ * Watch public/ and public-dev/ directories and copy files to dist/ in real-time.
52
+ * Automatically reflects changes/additions/deletions after initial copy.
53
53
  *
54
- * @param pkgDir 패키지 루트 디렉토리
55
- * @param includeDev public-dev/ 포함 여부 (dev 모드에서만 true)
56
- * @returns FsWatcher 인스턴스 (shutdown close() 호출 필요) 또는 watch할 대상이 없으면 undefined
54
+ * @param pkgDir Package root directory
55
+ * @param includeDev Whether to include public-dev/ (true only in dev mode)
56
+ * @returns FsWatcher instance (must call close() on shutdown) or undefined if no watch targets
57
57
  */
58
58
  export async function watchPublicFiles(
59
59
  pkgDir: string,
@@ -63,10 +63,10 @@ export async function watchPublicFiles(
63
63
  const publicDir = path.join(pkgDir, "public");
64
64
  const publicDevDir = path.join(pkgDir, "public-dev");
65
65
 
66
- // 초기 복사
66
+ // Initial copy
67
67
  await copyPublicFiles(pkgDir, includeDev);
68
68
 
69
- // watch 대상 경로 수집
69
+ // Collect watch target paths
70
70
  const watchPaths: string[] = [];
71
71
  if (await fsExists(publicDir)) {
72
72
  watchPaths.push(path.join(publicDir, "**/*"));
@@ -83,7 +83,7 @@ export async function watchPublicFiles(
83
83
 
84
84
  watcher.onChange({ delay: 300 }, async (changes) => {
85
85
  for (const { event, path: filePath } of changes) {
86
- // 어느 소스 디렉토리에서 변경인지 판별
86
+ // Determine which source directory the change came from
87
87
  let sourceDir: string;
88
88
  if (pathIsChildPath(filePath, publicDevDir)) {
89
89
  sourceDir = publicDevDir;
@@ -95,14 +95,14 @@ export async function watchPublicFiles(
95
95
  const distPath = path.join(distDir, relPath);
96
96
 
97
97
  if (event === "unlink") {
98
- // public에서 삭제 시, public-dev에 같은 파일이 있으면 삭제하지 않음
98
+ // If deleted from public, don't delete if same file exists in public-dev
99
99
  if (sourceDir === publicDir && includeDev) {
100
100
  const devOverride = path.join(publicDevDir, relPath);
101
101
  if (await fsExists(devOverride)) {
102
102
  continue;
103
103
  }
104
104
  }
105
- // public-dev에서 삭제 시, public 같은 파일이 있으면 복사 (fallback 복원)
105
+ // If deleted from public-dev, restore from public if it exists (fallback restore)
106
106
  if (sourceDir === publicDevDir && includeDev) {
107
107
  const publicFallback = path.join(publicDir, relPath);
108
108
  if (await fsExists(publicFallback)) {
@@ -113,7 +113,7 @@ export async function watchPublicFiles(
113
113
  }
114
114
  await fsRm(distPath);
115
115
  } else if (event === "add" || event === "change") {
116
- // public에서 변경 시, public-dev 같은 파일이 있으면 overlay 우선이므로 스킵
116
+ // If changed in public, skip if same file exists in public-dev (overlay takes priority)
117
117
  if (sourceDir === publicDir && includeDev) {
118
118
  const devOverride = path.join(publicDevDir, relPath);
119
119
  if (await fsExists(devOverride)) {
@@ -2,11 +2,11 @@ import path from "path";
2
2
  import { fsGlob, fsCopy, fsMkdir, fsRm, FsWatcher } from "@simplysm/core-node";
3
3
 
4
4
  /**
5
- * src/에서 glob 패턴에 매칭되는 파일을 dist/로 복사한다.
6
- * 상대 경로가 유지된다: src/a/b.css → dist/a/b.css
5
+ * Copy files matching glob patterns from src/ to dist/
6
+ * Relative paths are preserved: src/a/b.css → dist/a/b.css
7
7
  *
8
- * @param pkgDir 패키지 루트 디렉토리
9
- * @param patterns glob 패턴 배열 (src/ 기준 상대 경로)
8
+ * @param pkgDir Package root directory
9
+ * @param patterns Array of glob patterns (relative to src/)
10
10
  */
11
11
  export async function copySrcFiles(pkgDir: string, patterns: string[]): Promise<void> {
12
12
  const srcDir = path.join(pkgDir, "src");
@@ -24,21 +24,21 @@ export async function copySrcFiles(pkgDir: string, patterns: string[]): Promise<
24
24
  }
25
25
 
26
26
  /**
27
- * src/에서 glob 패턴에 매칭되는 파일을 감시하여 dist/로 복사한다.
28
- * 초기 복사 변경/추가/삭제를 자동 반영한다.
27
+ * Watch and copy files matching glob patterns from src/ to dist/
28
+ * Automatically reflects changes, additions, and deletions after initial copy.
29
29
  *
30
- * @param pkgDir 패키지 루트 디렉토리
31
- * @param patterns glob 패턴 배열 (src/ 기준 상대 경로)
32
- * @returns FsWatcher 인스턴스 (shutdown close() 호출 필요)
30
+ * @param pkgDir Package root directory
31
+ * @param patterns Array of glob patterns (relative to src/)
32
+ * @returns FsWatcher instance (call close() on shutdown)
33
33
  */
34
34
  export async function watchCopySrcFiles(pkgDir: string, patterns: string[]): Promise<FsWatcher> {
35
35
  const srcDir = path.join(pkgDir, "src");
36
36
  const distDir = path.join(pkgDir, "dist");
37
37
 
38
- // 초기 복사
38
+ // Initial copy
39
39
  await copySrcFiles(pkgDir, patterns);
40
40
 
41
- // watch 시작
41
+ // Start watch
42
42
  const watchPaths = patterns.map((p) => path.join(srcDir, p));
43
43
  const watcher = await FsWatcher.watch(watchPaths);
44
44