@simplysm/sd-cli 12.16.30 → 12.16.31

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 (2) hide show
  1. package/README.md +353 -0
  2. package/package.json +5 -5
package/README.md ADDED
@@ -0,0 +1,353 @@
1
+ # @simplysm/sd-cli
2
+
3
+ Build, check, publish, and deploy tool for Simplysm monorepo projects. Provides a single `sd-cli` binary that orchestrates TypeScript compilation, Angular bundling, ESLint checks, npm publishing, and native mobile packaging (Electron, Cordova, Capacitor).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @simplysm/sd-cli
9
+ # or
10
+ yarn add @simplysm/sd-cli
11
+ ```
12
+
13
+ ## Project Configuration
14
+
15
+ sd-cli reads a JavaScript config file (default: `simplysm.js`) at the project root. The file must export a default function that returns an `ISdProjectConfig` object.
16
+
17
+ ```js
18
+ // simplysm.js
19
+ export default (isDev, options) => ({
20
+ packages: {
21
+ "my-core": {
22
+ type: "library",
23
+ publish: "npm",
24
+ },
25
+ "my-server": {
26
+ type: "server",
27
+ publish: {
28
+ type: "sftp",
29
+ host: "example.com",
30
+ user: "deploy",
31
+ pass: process.env.DEPLOY_PASS,
32
+ },
33
+ },
34
+ "my-client": {
35
+ type: "client",
36
+ server: "my-server",
37
+ builder: {
38
+ web: {},
39
+ electron: {
40
+ appId: "com.example.myapp",
41
+ },
42
+ capacitor: {
43
+ appId: "com.example.myapp",
44
+ appName: "My App",
45
+ platform: { android: {} },
46
+ },
47
+ },
48
+ },
49
+ },
50
+ localUpdates: {
51
+ "@someorg/*": "C:/libs/someorg/*/dist",
52
+ },
53
+ postPublish: [
54
+ { type: "script", cmd: "echo", args: ["done"] },
55
+ ],
56
+ });
57
+ ```
58
+
59
+ ### ISdProjectConfig
60
+
61
+ | Property | Type | Description |
62
+ |---|---|---|
63
+ | `packages` | `Record<string, TSdPackageConfig>` | Package name to config mapping. Keys must match workspace directory names. |
64
+ | `localUpdates` | `Record<string, string>` | Glob-to-path mapping for syncing local library builds into `node_modules`. |
65
+ | `postPublish` | `TSdPostPublishConfig[]` | Scripts to run after all packages are published. Supports `%SD_VERSION%` and `%SD_PROJECT_PATH%` placeholders. |
66
+
67
+ ### Package Types
68
+
69
+ #### Library (`type: "library"`)
70
+
71
+ | Property | Type | Default | Description |
72
+ |---|---|---|---|
73
+ | `type` | `"library"` | | Package type identifier. |
74
+ | `publish` | `"npm"` | | Publish to npm registry. |
75
+ | `polyfills` | `string[]` | | Modules to include as polyfills. |
76
+ | `index` | `{ excludes?: string[] } \| false` | | Auto-generated `index.ts` config. Set `false` to disable. |
77
+ | `dbContext` | `string` | | Database context class name for auto-generated DB context file. |
78
+ | `forceProductionMode` | `boolean` | | Force production mode regardless of dev/prod flag. |
79
+
80
+ #### Server (`type: "server"`)
81
+
82
+ | Property | Type | Default | Description |
83
+ |---|---|---|---|
84
+ | `type` | `"server"` | | Package type identifier. |
85
+ | `publish` | `ISdLocalDirectoryPublishConfig \| ISdFtpPublishConfig` | | Deploy target configuration. |
86
+ | `externals` | `string[]` | | Modules to exclude from the server bundle. |
87
+ | `configs` | `Record<string, any>` | | Arbitrary config values injected at build time. |
88
+ | `env` | `Record<string, string>` | | Environment variables set during build. |
89
+ | `forceProductionMode` | `boolean` | | Force production mode. |
90
+ | `pm2` | `object` | | PM2 process manager settings (`name`, `ignoreWatchPaths`, `noInterpreter`, `noStartScript`). |
91
+ | `iis` | `object` | | IIS hosting settings (`nodeExeFilePath`). |
92
+
93
+ #### Client (`type: "client"`)
94
+
95
+ | Property | Type | Default | Description |
96
+ |---|---|---|---|
97
+ | `type` | `"client"` | | Package type identifier. |
98
+ | `server` | `string \| { port: number }` | | Server package name to proxy to, or a fixed port. |
99
+ | `publish` | `ISdLocalDirectoryPublishConfig \| ISdFtpPublishConfig` | | Deploy target configuration. |
100
+ | `env` | `Record<string, string>` | | Environment variables set during build. |
101
+ | `configs` | `Record<string, any>` | | Arbitrary config values injected at build time. |
102
+ | `noLazyRoute` | `boolean` | | Disable automatic lazy route generation. |
103
+ | `forceProductionMode` | `boolean` | | Force production mode. |
104
+ | `builder.web` | `ISdClientBuilderWebConfig` | | Web build options (environment variables). |
105
+ | `builder.electron` | `ISdClientBuilderElectronConfig` | | Electron desktop build options. |
106
+ | `builder.capacitor` | `ISdClientBuilderCapacitorConfig` | | Capacitor mobile build options. |
107
+ | `builder.cordova` | `ISdClientBuilderCordovaConfig` | | **(Deprecated)** Cordova mobile build options. |
108
+
109
+ ### Publish Targets
110
+
111
+ **Local Directory**
112
+ ```js
113
+ { type: "local-directory", path: "C:/deploy/%SD_VERSION%" }
114
+ ```
115
+
116
+ **FTP / FTPS / SFTP**
117
+ ```js
118
+ { type: "sftp", host: "example.com", port: 22, path: "/var/www", user: "deploy", pass: "secret" }
119
+ ```
120
+
121
+ **npm**
122
+ ```js
123
+ "npm"
124
+ ```
125
+
126
+ ## CLI Commands
127
+
128
+ All commands support the `--debug` flag for verbose logging and `--config <path>` to specify a config file (default: `simplysm.js`).
129
+
130
+ ### watch
131
+
132
+ Watch-build all configured packages with incremental compilation.
133
+
134
+ ```bash
135
+ sd-cli watch [options]
136
+ ```
137
+
138
+ | Option | Type | Default | Description |
139
+ |---|---|---|---|
140
+ | `--config` | `string` | `simplysm.js` | Config file path. |
141
+ | `--options` | `string[]` | | Custom options passed to the config function. |
142
+ | `--packages` | `string[]` | | Filter to specific packages by name. |
143
+ | `--emitOnly` | `boolean` | `false` | Emit output only (skip type checking). |
144
+ | `--noEmit` | `boolean` | `false` | Type check only (skip output emission). |
145
+
146
+ ```bash
147
+ # Watch all packages
148
+ sd-cli watch
149
+
150
+ # Watch a specific package
151
+ sd-cli watch --packages sd-angular
152
+
153
+ # Emit only (faster, no checks)
154
+ sd-cli watch --emitOnly
155
+
156
+ # Check only (no emit)
157
+ sd-cli watch --noEmit
158
+ ```
159
+
160
+ ### build
161
+
162
+ Production build for all configured packages. Automatically increments the patch version.
163
+
164
+ ```bash
165
+ sd-cli build [options]
166
+ ```
167
+
168
+ | Option | Type | Default | Description |
169
+ |---|---|---|---|
170
+ | `--config` | `string` | `simplysm.js` | Config file path. |
171
+ | `--options` | `string[]` | | Custom options passed to the config function. |
172
+ | `--packages` | `string[]` | | Filter to specific packages by name. |
173
+
174
+ ### check
175
+
176
+ Run type checking and/or linting on packages.
177
+
178
+ ```bash
179
+ sd-cli check [path] [options]
180
+ ```
181
+
182
+ | Option | Type | Default | Description |
183
+ |---|---|---|---|
184
+ | `[path]` | `string` | | Package directory or file path to check. If omitted, checks all packages. |
185
+ | `--config` | `string` | `simplysm.js` | Config file path. |
186
+ | `--options` | `string[]` | | Custom options passed to the config function. |
187
+ | `--type` | `"lint" \| "typecheck"` | *(both)* | Run only lint or only typecheck. |
188
+
189
+ ```bash
190
+ # Check all packages (typecheck + lint)
191
+ sd-cli check
192
+
193
+ # Check a specific package
194
+ sd-cli check packages/sd-core-common
195
+
196
+ # Lint only
197
+ sd-cli check --type lint
198
+
199
+ # Typecheck only
200
+ sd-cli check --type typecheck
201
+ ```
202
+
203
+ ### publish
204
+
205
+ Build and publish all configured packages. Handles version bumping, git tagging, and deployment to npm / FTP / local directory.
206
+
207
+ ```bash
208
+ sd-cli publish [options]
209
+ ```
210
+
211
+ | Option | Type | Default | Description |
212
+ |---|---|---|---|
213
+ | `--config` | `string` | `simplysm.js` | Config file path. |
214
+ | `--options` | `string[]` | | Custom options passed to the config function. |
215
+ | `--packages` | `string[]` | | Filter to specific packages by name. |
216
+ | `--noBuild` | `boolean` | `false` | Skip building before publishing (dangerous). |
217
+
218
+ The publish workflow:
219
+ 1. Validates npm/yarn authentication tokens (for npm targets).
220
+ 2. Checks for uncommitted git changes.
221
+ 3. Increments the patch version across all workspace packages.
222
+ 4. Builds all packages.
223
+ 5. Creates a git commit and tag for the new version.
224
+ 6. Pushes to the remote repository.
225
+ 7. Publishes each package to its configured target.
226
+ 8. Runs `postPublish` scripts if configured.
227
+
228
+ ### local-update
229
+
230
+ Copy local library builds into `node_modules` based on the `localUpdates` config.
231
+
232
+ ```bash
233
+ sd-cli local-update [options]
234
+ ```
235
+
236
+ | Option | Type | Default | Description |
237
+ |---|---|---|---|
238
+ | `--config` | `string` | `simplysm.js` | Config file path. |
239
+ | `--options` | `string[]` | | Custom options passed to the config function. |
240
+
241
+ ### run-electron
242
+
243
+ Launch a watched client package as an Electron desktop app (development mode).
244
+
245
+ ```bash
246
+ sd-cli run-electron <package> [options]
247
+ ```
248
+
249
+ | Option | Type | Description |
250
+ |---|---|---|
251
+ | `<package>` | `string` | Package name (required). |
252
+ | `--config` | `string` | Config file path. |
253
+ | `--options` | `string[]` | Custom options passed to the config function. |
254
+
255
+ ### build-electron-for-dev
256
+
257
+ Build an Electron installer from a watched client package (development build).
258
+
259
+ ```bash
260
+ sd-cli build-electron-for-dev <package> [options]
261
+ ```
262
+
263
+ | Option | Type | Description |
264
+ |---|---|---|
265
+ | `<package>` | `string` | Package name (required). |
266
+ | `--config` | `string` | Config file path. |
267
+ | `--options` | `string[]` | Custom options passed to the config function. |
268
+
269
+ ### run-cordova *(deprecated)*
270
+
271
+ Deploy a watched client package to a Cordova device.
272
+
273
+ ```bash
274
+ sd-cli run-cordova <platform> <package> [url]
275
+ ```
276
+
277
+ | Option | Type | Description |
278
+ |---|---|---|
279
+ | `<platform>` | `string` | Target platform (e.g., `android`). |
280
+ | `<package>` | `string` | Package name. |
281
+ | `[url]` | `string` | URL to open in the webview. |
282
+
283
+ ### run-capacitor
284
+
285
+ Deploy a watched client package to a Capacitor device.
286
+
287
+ ```bash
288
+ sd-cli run-capacitor <platform> <package> [url]
289
+ ```
290
+
291
+ | Option | Type | Description |
292
+ |---|---|---|
293
+ | `<platform>` | `string` | Target platform (e.g., `android`). |
294
+ | `<package>` | `string` | Package name. |
295
+ | `[url]` | `string` | URL to open in the webview. |
296
+
297
+ ### commit
298
+
299
+ Use AI (Claude Haiku) to generate a commit message from staged changes, then commit automatically.
300
+
301
+ ```bash
302
+ sd-cli commit
303
+ ```
304
+
305
+ Requires the `ANTHROPIC_API_KEY` environment variable to be set.
306
+
307
+ ### postinstall
308
+
309
+ Run post-install patches on dependencies. This is typically called automatically after `yarn install`.
310
+
311
+ ```bash
312
+ sd-cli postinstall
313
+ ```
314
+
315
+ ## Electron Builder Configuration
316
+
317
+ The `builder.electron` config for client packages supports:
318
+
319
+ | Property | Type | Description |
320
+ |---|---|---|
321
+ | `appId` | `string` | Application identifier (e.g., `com.example.app`). |
322
+ | `installerIcon` | `string` | Path to the installer icon file (relative to the package). |
323
+ | `portable` | `boolean` | Build a portable `.exe` instead of an NSIS installer. |
324
+ | `postInstallScript` | `string` | Script to run after npm install in the Electron context. |
325
+ | `nsisOptions` | `electronBuilder.NsisOptions` | NSIS installer options (pass-through to electron-builder). |
326
+ | `reinstallDependencies` | `string[]` | Dependencies to reinstall with native rebuild in the Electron context. |
327
+ | `env` | `Record<string, string>` | Environment variables for the Electron build. |
328
+
329
+ ## Capacitor Builder Configuration
330
+
331
+ The `builder.capacitor` config for client packages supports:
332
+
333
+ | Property | Type | Description |
334
+ |---|---|---|
335
+ | `appId` | `string` | Application identifier (e.g., `com.example.app`). |
336
+ | `appName` | `string` | Display name of the application. |
337
+ | `plugins` | `Record<string, Record<string, unknown> \| true>` | Capacitor plugins with their configuration. Use `true` for no-config plugins. |
338
+ | `icon` | `string` | Path to the app icon (relative to the package). |
339
+ | `debug` | `boolean` | Build in debug mode. |
340
+ | `platform.android.config` | `Record<string, string>` | Additional Android application manifest attributes. |
341
+ | `platform.android.bundle` | `boolean` | Build an AAB bundle instead of APK. |
342
+ | `platform.android.sign` | `object` | Signing configuration (`keystore`, `storePassword`, `alias`, `password`, `keystoreType`). |
343
+ | `platform.android.sdkVersion` | `number` | Target Android SDK version. |
344
+ | `platform.android.permissions` | `array` | Android permissions (`name`, `maxSdkVersion`, `ignore`). |
345
+ | `platform.android.intentFilters` | `array` | Android intent filters (`action`, `category`). |
346
+ | `env` | `Record<string, string>` | Environment variables. |
347
+ | `browserslist` | `string[]` | Browserslist targets. |
348
+
349
+ ## Process Behavior
350
+
351
+ - On Windows, sd-cli automatically configures processor affinity (reserves 1 out of every 4 cores for the OS) and sets process priority to BelowNormal to avoid monopolizing system resources.
352
+ - Node.js is launched with `--max-old-space-size=8192` for large project builds.
353
+ - The `local-update` command runs automatically before other commands in production builds.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplysm/sd-cli",
3
- "version": "12.16.30",
3
+ "version": "12.16.31",
4
4
  "description": "심플리즘 패키지 - CLI",
5
5
  "author": "김석래",
6
6
  "repository": {
@@ -17,10 +17,10 @@
17
17
  "@angular/compiler-cli": "^20.3.18",
18
18
  "@anthropic-ai/sdk": "^0.78.0",
19
19
  "@electron/rebuild": "^4.0.3",
20
- "@simplysm/sd-core-common": "12.16.30",
21
- "@simplysm/sd-core-node": "12.16.30",
22
- "@simplysm/sd-service-server": "12.16.30",
23
- "@simplysm/sd-storage": "12.16.30",
20
+ "@simplysm/sd-core-common": "12.16.31",
21
+ "@simplysm/sd-core-node": "12.16.31",
22
+ "@simplysm/sd-service-server": "12.16.31",
23
+ "@simplysm/sd-storage": "12.16.31",
24
24
  "browserslist": "^4.28.1",
25
25
  "cordova": "^13.0.0",
26
26
  "electron": "^33.4.11",