@simplysm/sd-claude 14.0.88 โ 14.0.89
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.
- package/claude/references/sd-simplysm14/README.md +17 -17
- package/claude/references/sd-simplysm14/apis/angular/README.md +27 -53
- package/claude/references/sd-simplysm14/apis/angular/controls.md +37 -105
- package/claude/references/sd-simplysm14/apis/angular/crud.md +46 -43
- package/claude/references/sd-simplysm14/apis/angular/directives.md +22 -32
- package/claude/references/sd-simplysm14/apis/angular/features.md +40 -55
- package/claude/references/sd-simplysm14/apis/angular/infra.md +40 -40
- package/claude/references/sd-simplysm14/apis/angular/layout.md +25 -53
- package/claude/references/sd-simplysm14/apis/angular/overlay.md +70 -82
- package/claude/references/sd-simplysm14/apis/angular/routing-appstructure.md +44 -39
- package/claude/references/sd-simplysm14/apis/angular/selection-managers.md +21 -36
- package/claude/references/sd-simplysm14/apis/angular/shared-data.md +52 -65
- package/claude/references/sd-simplysm14/apis/angular/sheet.md +65 -70
- package/claude/references/sd-simplysm14/apis/capacitor-plugin-auto-update/README.md +33 -35
- package/claude/references/sd-simplysm14/apis/capacitor-plugin-file-system/README.md +7 -7
- package/claude/references/sd-simplysm14/apis/capacitor-plugin-intent/README.md +29 -29
- package/claude/references/sd-simplysm14/apis/capacitor-plugin-usb-storage/README.md +45 -50
- package/claude/references/sd-simplysm14/apis/core-browser/README.md +42 -55
- package/claude/references/sd-simplysm14/apis/core-browser/dom-element.md +62 -0
- package/claude/references/sd-simplysm14/apis/core-browser/indexed-db.md +13 -12
- package/claude/references/sd-simplysm14/apis/core-common/README.md +222 -98
- package/claude/references/sd-simplysm14/apis/core-common/array-ext.md +102 -53
- package/claude/references/sd-simplysm14/apis/core-common/async-runtime.md +128 -0
- package/claude/references/sd-simplysm14/apis/core-common/datetime.md +98 -64
- package/claude/references/sd-simplysm14/apis/core-common/errors.md +91 -0
- package/claude/references/sd-simplysm14/apis/core-common/json-transfer.md +34 -28
- package/claude/references/sd-simplysm14/apis/core-common/obj.md +104 -40
- package/claude/references/sd-simplysm14/apis/core-node/README.md +11 -8
- package/claude/references/sd-simplysm14/apis/core-node/consola.md +23 -31
- package/claude/references/sd-simplysm14/apis/core-node/cpx.md +33 -22
- package/claude/references/sd-simplysm14/apis/core-node/fs-watcher.md +28 -25
- package/claude/references/sd-simplysm14/apis/core-node/fsx.md +39 -53
- package/claude/references/sd-simplysm14/apis/core-node/pathx.md +26 -29
- package/claude/references/sd-simplysm14/apis/core-node/worker.md +27 -29
- package/claude/references/sd-simplysm14/apis/excel/README.md +14 -14
- package/claude/references/sd-simplysm14/apis/lint/README.md +27 -21
- package/claude/references/sd-simplysm14/apis/lint/rules.md +89 -49
- package/claude/references/sd-simplysm14/apis/orm-common/README.md +5 -59
- package/claude/references/sd-simplysm14/apis/orm-common/db-context.md +98 -67
- package/claude/references/sd-simplysm14/apis/orm-common/expr.md +107 -92
- package/claude/references/sd-simplysm14/apis/orm-common/queryable.md +99 -65
- package/claude/references/sd-simplysm14/apis/orm-common/schema.md +83 -98
- package/claude/references/sd-simplysm14/apis/orm-common/types.md +62 -52
- package/claude/references/sd-simplysm14/apis/orm-node/README.md +62 -25
- package/claude/references/sd-simplysm14/apis/orm-node/db-conn.md +27 -27
- package/claude/references/sd-simplysm14/apis/sd-cli/README.md +12 -15
- package/claude/references/sd-simplysm14/apis/sd-cli/SdTsCompiler.md +92 -45
- package/claude/references/sd-simplysm14/apis/sd-cli/sd-config-types.md +226 -108
- package/claude/references/sd-simplysm14/apis/service-client/README.md +84 -86
- package/claude/references/sd-simplysm14/apis/service-client/orm.md +14 -11
- package/claude/references/sd-simplysm14/apis/service-client/transport.md +33 -10
- package/claude/references/sd-simplysm14/apis/service-common/README.md +37 -23
- package/claude/references/sd-simplysm14/apis/service-common/app-structure.md +9 -9
- package/claude/references/sd-simplysm14/apis/service-common/protocol.md +13 -13
- package/claude/references/sd-simplysm14/apis/service-server/README.md +81 -65
- package/claude/references/sd-simplysm14/apis/service-server/service-authoring.md +32 -35
- package/claude/references/sd-simplysm14/apis/service-server/transport-internals.md +44 -33
- package/claude/references/sd-simplysm14/apis/service-server/v1-legacy.md +34 -45
- package/claude/references/sd-simplysm14/apis/storage/README.md +24 -18
- package/claude/skills/sd-demo/SKILL.md +6 -0
- package/claude/skills/sd-impl/SKILL.md +4 -7
- package/claude/skills/sd-spec/SKILL.md +31 -858
- package/claude/skills/sd-spec/references/spec-authoring.md +519 -0
- package/claude/workflows/sd-docs.js +84 -0
- package/package.json +1 -1
- package/claude/references/sd-simplysm14/apis/orm-common/query-builder.md +0 -29
- package/claude/skills/sd-demo/evals/fixtures/inventory-list/.specs/inventory/spec.md +0 -99
- package/claude/skills/sd-demo/evals/fixtures/inventory-list/packages/demo-client/package.json +0 -12
- package/claude/skills/sd-demo/evals/fixtures/inventory-list/packages/demo-client/src/index.ts +0 -3
- package/claude/skills/sd-demo/evals/fixtures/inventory-list/packages/demo-client/src/screens/inbound/inbound.list.ts +0 -150
- package/claude/skills/sd-demo/evals/fixtures/inventory-list/packages/demo-client/src/screens/inventory/inventory-master.list.ts +0 -143
- package/claude/skills/sd-demo/evals/fixtures/inventory-list/packages/demo-client/src/screens/outbound/outbound.list.ts +0 -150
- package/claude/skills/sd-demo/evals/fixtures/inventory-list/pnpm-workspace.yaml +0 -2
- package/claude/skills/sd-demo/evals/fixtures/inventory-list/sd.config.ts +0 -12
- package/claude/skills/sd-demo/evals/golden.jsonl +0 -1
- package/claude/skills/sd-dev/evals/fixtures/minimal-ts-pkg/package.json +0 -8
- package/claude/skills/sd-dev/evals/fixtures/minimal-ts-pkg/src/.gitkeep +0 -0
- package/claude/skills/sd-dev/evals/fixtures/minimal-ts-pkg/tests/.gitkeep +0 -0
- package/claude/skills/sd-dev/evals/fixtures/minimal-ts-pkg/tsconfig.json +0 -10
- package/claude/skills/sd-dev/evals/golden.jsonl +0 -1
- package/claude/skills/sd-docs/SKILL.md +0 -46
- package/claude/skills/sd-docs/evals/fixtures/new-write/.claude/references/sd-simplysm14/README.md +0 -7
- package/claude/skills/sd-docs/evals/fixtures/new-write/packages/bar/package.json +0 -5
- package/claude/skills/sd-docs/evals/fixtures/new-write/packages/bar/src/index.ts +0 -3
- package/claude/skills/sd-docs/evals/fixtures/new-write/packages/baz/package.json +0 -6
- package/claude/skills/sd-docs/evals/fixtures/new-write/packages/baz/src/index.ts +0 -1
- package/claude/skills/sd-docs/evals/fixtures/new-write/packages/foo/package.json +0 -5
- package/claude/skills/sd-docs/evals/fixtures/new-write/packages/foo/src/index.ts +0 -8
- package/claude/skills/sd-docs/evals/fixtures/update-mixed/.claude/references/sd-simplysm14/README.md +0 -7
- package/claude/skills/sd-docs/evals/fixtures/update-mixed/.claude/references/sd-simplysm14/apis/foo/README.md +0 -3
- package/claude/skills/sd-docs/evals/fixtures/update-mixed/packages/bar/package.json +0 -5
- package/claude/skills/sd-docs/evals/fixtures/update-mixed/packages/bar/src/index.ts +0 -3
- package/claude/skills/sd-docs/evals/fixtures/update-mixed/packages/baz/package.json +0 -6
- package/claude/skills/sd-docs/evals/fixtures/update-mixed/packages/baz/src/index.ts +0 -1
- package/claude/skills/sd-docs/evals/fixtures/update-mixed/packages/foo/package.json +0 -5
- package/claude/skills/sd-docs/evals/fixtures/update-mixed/packages/foo/src/index.ts +0 -8
- package/claude/skills/sd-docs/evals/golden.jsonl +0 -2
- package/claude/skills/sd-impl/evals/fixtures/case-a-new-screen/.specs/260513120000_warehouse/spec.md +0 -101
- package/claude/skills/sd-impl/evals/fixtures/case-b-update-with-demo/.specs/260513120000_warehouse/spec.md +0 -101
- package/claude/skills/sd-impl/evals/fixtures/case-b-update-with-demo/packages/app/src/screens/box-register/box-register.view.ts +0 -46
- package/claude/skills/sd-impl/evals/fixtures/case-c-new-cross/.specs/260513120000_warehouse/spec.md +0 -89
- package/claude/skills/sd-impl/evals/fixtures/case-d-spec-modify/.specs/260513120000_warehouse/spec.md +0 -101
- package/claude/skills/sd-impl/evals/golden.jsonl +0 -4
- package/claude/skills/sd-manual/evals/fixtures/new-manual/src/notification.ts +0 -25
- package/claude/skills/sd-manual/evals/fixtures/update-manual/.claude/references/sd-simplysm14/manuals/notification.md +0 -14
- package/claude/skills/sd-manual/evals/fixtures/update-manual/src/notification.ts +0 -37
- package/claude/skills/sd-manual/evals/golden.jsonl +0 -2
- package/claude/skills/sd-review/evals/fixtures/code-review/src/foo.ts +0 -7
- package/claude/skills/sd-review/evals/fixtures/doc-review/docs/foo.md +0 -4
- package/claude/skills/sd-review/evals/golden.jsonl +0 -2
- package/claude/skills/sd-skill/evals/fixtures/existing-skill/.claude/skills/todo-format/SKILL.md +0 -14
- package/claude/skills/sd-skill/evals/fixtures/new-skill/.gitkeep +0 -0
- package/claude/skills/sd-skill/evals/golden.jsonl +0 -2
- package/claude/skills/sd-spec/evals/fixtures/case-a-split//355/232/214/354/235/230/353/241/235.md +0 -20
- package/claude/skills/sd-spec/evals/fixtures/case-b-detail/.specs/260513120000_warehouse/spec.md +0 -95
- package/claude/skills/sd-spec/evals/golden.jsonl +0 -2
- package/claude/skills/sd-unpack/evals/fixtures/eml-with-text-attachment/meeting.eml +0 -21
- package/claude/skills/sd-unpack/evals/fixtures/simple-eml/meeting.eml +0 -10
- package/claude/skills/sd-unpack/evals/golden.jsonl +0 -2
- package/claude/skills/sd-use/evals/fixtures/empty/.gitkeep +0 -0
- package/claude/skills/sd-use/evals/golden.jsonl +0 -6
- /package/claude/{skills/sd-docs/references/doc-rules.md โ workflows/sd-docs.rules.md} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# @simplysm/orm-node โ ์ ์์ค DB ์ฐ๊ฒฐ
|
|
2
2
|
|
|
3
|
-
`createOrm`
|
|
3
|
+
`createOrm` ์ถ์ํ๋ฅผ ๊ฑฐ์น์ง ์๊ณ raw SQLยทํ๋ผ๋ฏธํฐ ์ฟผ๋ฆฌยทbulk insertยท์๋ ํธ๋์ญ์
์ ์ง์ ๋ค๋ฃจ๊ฑฐ๋, dialect๋ณ ์ ์ ์ค์ ํ์
์ ์์ฑํ๊ฑฐ๋, `DbContext` ์ executor ๋ฅผ ์ง์ ๊ตฌ์ฑํ ๋ ๊ฐ์ด ์ฝํ๋ ๋ฌถ์. ์ฐ๊ฒฐ ์ธ์คํด์ค ์์ฑยท์ฐ๊ฒฐ ์ธํฐํ์ด์คยท์ ์ ์ค์ ยทexecutorยทdialect ํฌํผยท์์๋ก ๊ตฌ์ฑ.
|
|
4
4
|
|
|
5
5
|
## createDbConn
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
|
-
createDbConn(config: DbConnConfig): Promise<DbConn>
|
|
8
|
+
function createDbConn(config: DbConnConfig): Promise<DbConn>
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
`config.dialect` ์ ๋ง๋ ๋๋ผ์ด๋ฒ๋ฅผ **์ง์ฐ import** ํด ์ฐ๊ฒฐ ์ธ์คํด์ค๋ฅผ ๋ง๋ ๋ค(mysql โ `mysql2/promise`, postgresql โ `pg` + `pg-copy-streams`, mssql/mssql-azure โ `tedious`). ํ ๋ฒ ๋ก๋ํ ๋๋ผ์ด๋ฒ๋ ๋ชจ๋ ์บ์์
|
|
11
|
+
`config.dialect` ์ ๋ง๋ ๋๋ผ์ด๋ฒ๋ฅผ **์ง์ฐ import** ํด ์ฐ๊ฒฐ ์ธ์คํด์ค๋ฅผ ๋ง๋ ๋ค(mysql โ `mysql2/promise`, postgresql โ `pg` + `pg-copy-streams`, mssql/mssql-azure โ `tedious`). ํ ๋ฒ ๋ก๋ํ ๋๋ผ์ด๋ฒ๋ ๋ชจ๋ ์บ์์ ๋ณด๊ดํด ์ฌ์ฌ์ฉ. ๋ฐํ ๊ฐ์ฒด๋ ์์ง **๋ฏธ์ฐ๊ฒฐ** ์ํ์ด๋ฏ๋ก `connect()` ๋ฅผ ๋ณ๋ ํธ์ถํด์ผ ํจ.
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
const conn = await createDbConn({ dialect: "postgresql", host: "localhost", username: "u", password: "p", database: "db" });
|
|
@@ -17,22 +17,22 @@ await conn.connect();
|
|
|
17
17
|
|
|
18
18
|
## DbConn
|
|
19
19
|
|
|
20
|
-
์ ์์ค ์ฐ๊ฒฐ ์ธํฐํ์ด์ค. `EventEmitter<{ close: void }>` ๋ฅผ ์์ํ๋ฉฐ ์ฐ๊ฒฐ ์ข
๋ฃ ์ `close` ์ด๋ฒคํธ๋ฅผ ๋ฐ์์ํจ๋ค. ๊ตฌํ์ฒด `MysqlDbConn`/`
|
|
20
|
+
์ ์์ค ์ฐ๊ฒฐ ์ธํฐํ์ด์ค. `EventEmitter<{ close: void }>` ๋ฅผ ์์ํ๋ฉฐ ์ฐ๊ฒฐ ์ข
๋ฃ ์ `close` ์ด๋ฒคํธ๋ฅผ ๋ฐ์์ํจ๋ค. ๊ตฌํ์ฒด `MssqlDbConn`/`MysqlDbConn`/`PostgresqlDbConn` ๋ ์ง์ export ๋์ง ์๊ณ `createDbConn` ์ผ๋ก๋ง ํ๋(ํ์
import ๋ง ๊ฐ๋ฅ).
|
|
21
21
|
|
|
22
|
-
- `config: DbConnConfig` โ ์ด ์ฐ๊ฒฐ์
|
|
23
|
-
- `isConnected: boolean` โ ํ์ฌ ์ฐ๊ฒฐ ์ฌ๋ถ. `connect` ์ฑ๊ณต ์ `true`, `close`/์ข
๋ฃ ์ด๋ฒคํธ ์ `false`.
|
|
24
|
-
- `isInTransaction: boolean` โ ํธ๋์ญ์
์งํ ์ฌ๋ถ. `beginTransaction` ํ `true`,
|
|
22
|
+
- `config: DbConnConfig` โ ์ด ์ฐ๊ฒฐ์ ์ ์ ์ค์ (์ฝ๊ธฐ ์ ์ฉ).
|
|
23
|
+
- `isConnected: boolean` โ ํ์ฌ ์ฐ๊ฒฐ ์ฌ๋ถ. `connect` ์ฑ๊ณต ์ `true`, `close`/์ข
๋ฃ(`end`) ์ด๋ฒคํธ ์ `false`. ์ํ ํ์ธยท์ฌ์ฐ๊ฒฐ ํ๋จ์ ์ฌ์ฉ.
|
|
24
|
+
- `isInTransaction: boolean` โ ํธ๋์ญ์
์งํ ์ฌ๋ถ. `beginTransaction` ํ `true`, ์ปค๋ฐยท๋กค๋ฐฑ ํ `false`.
|
|
25
25
|
- `connect(): Promise<void>` โ ์ฐ๊ฒฐ ์๋ฆฝ. ์ด๋ฏธ ์ฐ๊ฒฐ๋ผ ์์ผ๋ฉด `DB_CONN_ERRORS.ALREADY_CONNECTED` throw.
|
|
26
|
-
- `close(): Promise<void>` โ ์ฐ๊ฒฐ ์ข
๋ฃ. ๋ฏธ์ฐ๊ฒฐ ์ํ๋ฉด ์๋ฌด ๋์ ์์ด
|
|
27
|
-
- `beginTransaction(isolationLevel?: IsolationLevel): Promise<void>` โ ํธ๋์ญ์
์์. `isolationLevel` ๋ฏธ์ง์ ์ `config.defaultIsolationLevel`, ๊ทธ๊ฒ๋ ์์ผ๋ฉด `READ_UNCOMMITTED`.
|
|
26
|
+
- `close(): Promise<void>` โ ์ฐ๊ฒฐ ์ข
๋ฃ. ๋ฏธ์ฐ๊ฒฐ ์ํ๋ฉด ์๋ฌด ๋์ ์์ด ๋ฐํ(throw ์ ํจ).
|
|
27
|
+
- `beginTransaction(isolationLevel?: IsolationLevel): Promise<void>` โ ํธ๋์ญ์
์์. `isolationLevel` ๋ฏธ์ง์ ์ `config.defaultIsolationLevel`, ๊ทธ๊ฒ๋ ์์ผ๋ฉด `READ_UNCOMMITTED` ๋ก ์์. ํ
์คํธ๋ก ํ์ธ๋ ํ์ฉ ๊ฐ: `"READ_UNCOMMITTED"|"READ_COMMITTED"|"REPEATABLE_READ"|"SERIALIZABLE"`.
|
|
28
28
|
- `commitTransaction(): Promise<void>` โ ์ปค๋ฐ.
|
|
29
29
|
- `rollbackTransaction(): Promise<void>` โ ๋กค๋ฐฑ.
|
|
30
|
-
- `execute(queries: string[]): Promise<Record<string, unknown>[][]>` โ ์์ SQL ๋ฌธ์์ด ๋ฐฐ์ด์ ์์ฐจ ์คํ.
|
|
31
|
-
- `executeParametrized(query: string, params?: unknown[]): Promise<Record<string, unknown>[][]>` โ ํ๋ผ๋ฏธํฐ ๋ฐ์ธ๋ฉ ์ฟผ๋ฆฌ ์คํ. SQL ์ธ์ ์
ํํผยท๊ฐ ์ฌ๋ฐ์ธ๋ฉ ์. ๋ฐํ์ ๊ฒฐ๊ณผ์
๋ฐฐ์ด(MySQL ๋ฉํฐ์คํ
์ดํธ๋จผํธ๋ statement๋ณ๋ก
|
|
32
|
-
- `bulkInsert(tableName: string, columnMetas: Record<string, ColumnMeta>, records: Record<string, unknown>[]): Promise<void>` โ ๋ค์ดํฐ๋ธ bulk API ๋ก ๋๋ ์ฝ์
. `tableName` ์ `database.table` ๋๋ `database.schema.table
|
|
30
|
+
- `execute(queries: string[]): Promise<Record<string, unknown>[][]>` โ ์์ SQL ๋ฌธ์์ด ๋ฐฐ์ด์ ์์ฐจ ์คํ. ๋น/๊ณต๋ฐฑ ๋ฌธ์์ด์ ๊ฑด๋๋. ๊ฐ ์ฟผ๋ฆฌ์ ๊ฒฐ๊ณผ์
๋ค์ ํํํํด ํ๋์ ๋ฐฐ์ด๋ก ๋ฌถ์ด ๋ฐํ. DDLยท๋ค๊ฑด SQL ์ผ๊ด ์คํ์ ์ฌ์ฉ.
|
|
31
|
+
- `executeParametrized(query: string, params?: unknown[]): Promise<Record<string, unknown>[][]>` โ ํ๋ผ๋ฏธํฐ ๋ฐ์ธ๋ฉ ์ฟผ๋ฆฌ ์คํ. SQL ์ธ์ ์
ํํผยท๊ฐ ์ฌ๋ฐ์ธ๋ฉ ์. ๋ฐํ์ ๊ฒฐ๊ณผ์
๋ฐฐ์ด(MySQL ๋ฉํฐ์คํ
์ดํธ๋จผํธ๋ statement๋ณ๋ก ๋ถ๋ฆฌ๋๋ฉฐ INSERT/UPDATE/DELETE ์๋ฆฌ๋ ๋น ๋ฐฐ์ด, PostgreSQL ์ ๋จ์ผ ๊ฒฐ๊ณผ์
). `params` ๋ฏธ์ง์ ์ MSSQL ์ ๋ฐฐ์น(`execSqlBatch`) ๊ฒฝ๋ก๋ก ์คํ.
|
|
32
|
+
- `bulkInsert(tableName: string, columnMetas: Record<string, ColumnMeta>, records: Record<string, unknown>[]): Promise<void>` โ ๋ค์ดํฐ๋ธ bulk API ๋ก ๋๋ ์ฝ์
. `tableName` ์ `database.table` ๋๋ `database.schema.table`(dialect๋ณ ์ธ์ฉ ๋ถํธ ํฌํจ๋ ์์ ์์๋ช
). `columnMetas` ๋ ์ปฌ๋ผ๋ช
โ `ColumnMeta`(`dataType`ยท`nullable`) ๋งคํ์ด๋ฉฐ **ํค ์์๊ฐ ์ปฌ๋ผ ์์๋ฅผ ๊ฒฐ์ **, `records` ์ ๊ฐ ๊ฐ์ฒด๋ ์ด ํค๋ค๋ก ๊ฐ ์ถ์ถ. `records` ๊ฐ ๋น ๋ฐฐ์ด์ด๋ฉด ์๋ฌด ๋์ ์์ด ๋ฐํ. dialect๋ณ ๊ฒฝ๋ก: MSSQL tedious `BulkLoad`, MySQL `LOAD DATA LOCAL INFILE`(์์ CSV ํ์ผ ์์ฑยท์ญ์ , UUID/binary ๋ `UNHEX`), PostgreSQL `COPY FROM STDIN`(CSV ์คํธ๋ฆผ). `DateTime`/`DateOnly`/`Time`/`Uuid`/`Uint8Array` ๊ฐ์ dialect๋ณ๋ก ์ ์ ํ ๋ณํ๋จ.
|
|
33
33
|
|
|
34
34
|
```typescript
|
|
35
|
-
await conn.beginTransaction();
|
|
35
|
+
await conn.beginTransaction("READ_COMMITTED");
|
|
36
36
|
const [rows] = await conn.executeParametrized('SELECT * FROM "User" WHERE id = $1', [1]);
|
|
37
37
|
await conn.commitTransaction();
|
|
38
38
|
```
|
|
@@ -43,13 +43,13 @@ await conn.commitTransaction();
|
|
|
43
43
|
|
|
44
44
|
๊ณตํต ํ๋:
|
|
45
45
|
|
|
46
|
-
- `dialect` โ `"mysql"` | `"mssql"` | `"mssql-azure"` | `"postgresql"`. DBMS ์ ํ. `"mssql-azure"` ๋ Azure SQL ์ฉ์ผ๋ก ๋๋ผ์ด๋ฒ๋ mssql ๊ณผ ๋์ผํ๋ ์ฐ๊ฒฐ ์ `encrypt` ํ์ฑํ. ์ฟผ๋ฆฌ
|
|
46
|
+
- `dialect` โ `"mysql"` | `"mssql"` | `"mssql-azure"` | `"postgresql"`. DBMS ์ ํ. `"mssql-azure"` ๋ Azure SQL ์ฉ์ผ๋ก ๋๋ผ์ด๋ฒ๋ mssql ๊ณผ ๋์ผํ๋ ์ฐ๊ฒฐ ์ `encrypt` ํ์ฑํ. ์ฟผ๋ฆฌ ๋น๋์ฉ dialect ๋ก๋ `getDialectFromConfig` ๊ฐ `"mssql"` ๋ก ์ ๊ทํ.
|
|
47
47
|
- `host: string` โ ์ ์ ํธ์คํธ.
|
|
48
|
-
- `port?: number` โ ํฌํธ. ๋ฏธ์ง์ ์ ๋๋ผ์ด๋ฒ ๊ธฐ๋ณธ๊ฐ(PostgreSQL ์ 5432 ๋ก ๋ณด์ ).
|
|
48
|
+
- `port?: number` โ ํฌํธ. ๋ฏธ์ง์ ์ ๋๋ผ์ด๋ฒ ๊ธฐ๋ณธ๊ฐ(PostgreSQL ์ ๋ฏธ์ง์ ์ 5432 ๋ก ๋ณด์ ).
|
|
49
49
|
- `username: string` โ ์ธ์ฆ ์ฌ์ฉ์.
|
|
50
50
|
- `password: string` โ ์ธ์ฆ ๋น๋ฐ๋ฒํธ.
|
|
51
|
-
- `database?: string` โ ๊ธฐ๋ณธ DB ์ด๋ฆ.
|
|
52
|
-
- `defaultIsolationLevel?: IsolationLevel` โ `beginTransaction` ์ `isolationLevel` ๋ฏธ์ง์ ์ ์ ์ฉํ ๊ธฐ๋ณธ
|
|
51
|
+
- `database?: string` โ ์ ์ ๊ธฐ๋ณธ DB ์ด๋ฆ.
|
|
52
|
+
- `defaultIsolationLevel?: IsolationLevel` โ `beginTransaction` ์ `isolationLevel` ๋ฏธ์ง์ ์ ์ ์ฉํ ๊ธฐ๋ณธ ๊ฒฉ๋ฆฌ ์์ค.
|
|
53
53
|
|
|
54
54
|
dialect๋ณ ์ถ๊ฐ ํ๋:
|
|
55
55
|
|
|
@@ -60,10 +60,10 @@ dialect๋ณ ์ถ๊ฐ ํ๋:
|
|
|
60
60
|
## getDialectFromConfig
|
|
61
61
|
|
|
62
62
|
```typescript
|
|
63
|
-
getDialectFromConfig(config: DbConnConfig): Dialect
|
|
63
|
+
function getDialectFromConfig(config: DbConnConfig): Dialect
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
`config.dialect` ๋ฅผ `@simplysm/orm-common` ์ `Dialect` ๋ก ๋ณํ. `"mssql-azure"` โ `"mssql"` ๋ก ์ ๊ทํํ๊ณ ๋๋จธ์ง๋ ๊ทธ๋๋ก ๋ฐํ. ์ฟผ๋ฆฌ ๋น๋์ dialect ๊ฒฐ์ ์ ์ฌ์ฉ.
|
|
66
|
+
`config.dialect` ๋ฅผ `@simplysm/orm-common` ์ `Dialect` ๋ก ๋ณํ. `"mssql-azure"` โ `"mssql"` ๋ก ์ ๊ทํํ๊ณ ๋๋จธ์ง๋ ๊ทธ๋๋ก ๋ฐํ. ์ฟผ๋ฆฌ ๋น๋์ dialect ๊ฒฐ์ ์ ์ฌ์ฉ. Azure ์ฌ๋ถ์ ๋ฌด๊ดํ๊ฒ ๊ฐ์ SQL ๋ฐฉ์ธ์ ์จ์ผ ํ ๋.
|
|
67
67
|
|
|
68
68
|
## NodeDbContextExecutor
|
|
69
69
|
|
|
@@ -71,24 +71,24 @@ getDialectFromConfig(config: DbConnConfig): Dialect
|
|
|
71
71
|
new NodeDbContextExecutor(config: DbConnConfig)
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
`@simplysm/orm-common` ์ `DbContextExecutor` ๋ฅผ Node ํ๊ฒฝ์์ ๊ตฌํํ ํด๋์ค. `createOrm` ์ด ๋ด๋ถ์์ ์๋ ์ฃผ์
ํ๋ฏ๋ก ๋ณดํต ์ง์ ์ธ ์ผ์ ์๊ณ , `DbContext` ๋ฅผ `createOrm` ์์ด ์๋ ์ธ์คํด์คํํ ๋๋ง ์ฌ์ฉ.
|
|
74
|
+
`@simplysm/orm-common` ์ `DbContextExecutor` ๋ฅผ Node ํ๊ฒฝ์์ ๊ตฌํํ ํด๋์ค. `createOrm` ์ด ๋ด๋ถ์์ ์๋ ์ฃผ์
ํ๋ฏ๋ก ๋ณดํต ์ง์ ์ธ ์ผ์ ์๊ณ , `DbContext` ๋ฅผ `createOrm` ์์ด ์๋ ์ธ์คํด์คํํ ๋๋ง ์ฌ์ฉ. ์์ฑ์๋ `DbConnConfig` ๋ง ๋ฐ๊ณ , ์ค์ ์ฐ๊ฒฐ์ `connect()` ์์ ์ `createDbConn` ์ผ๋ก ์ง์ฐ ์์ฑํ๋ค.
|
|
75
75
|
|
|
76
76
|
- `connect(): Promise<void>` โ `createDbConn(config)` ๋ก ์ฐ๊ฒฐ ์์ฑ ํ ์๋ฆฝ.
|
|
77
77
|
- `close(): Promise<void>` โ ์ฐ๊ฒฐ ์ข
๋ฃ ํ ๋ด๋ถ ์ฐธ์กฐ ํด์ .
|
|
78
|
-
- `beginTransaction(isolationLevel?: IsolationLevel)` / `commitTransaction()` / `rollbackTransaction()` โ ํธ๋์ญ์
์์.
|
|
78
|
+
- `beginTransaction(isolationLevel?: IsolationLevel)` / `commitTransaction()` / `rollbackTransaction()` โ ๋ด๋ถ `DbConn` ์ ํธ๋์ญ์
์์.
|
|
79
79
|
- `executeParametrized(query: string, params?: unknown[]): Promise<Record<string, unknown>[][]>` โ ํ๋ผ๋ฏธํฐ ์ฟผ๋ฆฌ ์์.
|
|
80
80
|
- `bulkInsert(tableName: string, columnMetas: Record<string, ColumnMeta>, records: DataRecord[]): Promise<void>` โ bulk insert ์์.
|
|
81
|
-
- `executeDefs<T>(defs: QueryDef[], resultMetas?: (ResultMeta | undefined)[]): Promise<T[][]>` โ `QueryDef` ๋ฐฐ์ด์ dialect ์ฟผ๋ฆฌ ๋น๋๋ก SQL ๋ณํํด ์คํ. `resultMetas` ๊ฐ ์ ๋ถ `null`/๋ฏธ์ง์ ์ด๋ฉด(๊ฒฐ๊ณผ ๋ถํ์) ๋ชจ๋ def ๋ฅผ ํ๋์ SQL ๋ก ํฉ์ณ ๋จ์ผ ์์ฒญ์ผ๋ก ๋ณด๋ด๊ณ def ์๋งํผ ๋น ๋ฐฐ์ด ๋ฐํ(์ฐ๊ธฐ ์ ์ฉ ์ต์ ํ). ๊ทธ ์ธ์ def ๋ง๋ค ๊ฐ๋ณ ์คํ ํ, ํด๋น ์์น์ `resultMeta` ๊ฐ ์์ผ๋ฉด `parseQueryResult` ๋ก ํ์
๋ณํํด ๋ฐํ.
|
|
81
|
+
- `executeDefs<T>(defs: QueryDef[], resultMetas?: (ResultMeta | undefined)[]): Promise<T[][]>` โ `QueryDef` ๋ฐฐ์ด์ dialect ์ฟผ๋ฆฌ ๋น๋๋ก SQL ๋ณํํด ์คํ. `resultMetas` ๊ฐ ์ ๋ถ `null`/๋ฏธ์ง์ ์ด๋ฉด(๊ฒฐ๊ณผ ๋ถํ์) ๋ชจ๋ def ๋ฅผ ํ๋์ SQL ๋ก ํฉ์ณ ๋จ์ผ ์์ฒญ์ผ๋ก ๋ณด๋ด๊ณ def ์๋งํผ ๋น ๋ฐฐ์ด ๋ฐํ(์ฐ๊ธฐ ์ ์ฉ ์ต์ ํ). ๊ทธ ์ธ์ def ๋ง๋ค ๊ฐ๋ณ ์คํ ํ, ํด๋น ์์น์ `resultMeta` ๊ฐ ์์ผ๋ฉด `parseQueryResult` ๋ก ํ์
๋ณํํด ๋ฐํ, ์์ผ๋ฉด raw ๊ฒฐ๊ณผ์
๊ทธ๋๋ก ๋ฐํ.
|
|
82
82
|
- ๋ชจ๋ ์คํ ๋ฉ์๋๋ ๋ฏธ์ฐ๊ฒฐ ์ํ์์ ํธ์ถ ์ `SdError(DB_CONN_ERRORS.NOT_CONNECTED)` throw.
|
|
83
83
|
|
|
84
84
|
## ์์
|
|
85
85
|
|
|
86
|
-
- `DB_CONN_CONNECT_TIMEOUT` โ ์ฐ๊ฒฐ ์๋ฆฝ ํ์์์. `10 * 1000`(10์ด).
|
|
87
|
-
- `DB_CONN_DEFAULT_TIMEOUT` โ ์ฟผ๋ฆฌ ๊ธฐ๋ณธ ํ์์์. `10 * 60 * 1000`(10๋ถ). ๋ง์ง๋ง ํ๋ ํ ์ด ๊ฐ์ 2๋ฐฐ๊ฐ ์ง๋๋ฉด ์ฐ๊ฒฐ์ ์๋ ์ข
๋ฃ(idle ํ์์์)
|
|
88
|
-
- `DB_CONN_ERRORS` โ ์ค๋ฅ ๋ฉ์์ง ์์
|
|
86
|
+
- `DB_CONN_CONNECT_TIMEOUT` โ ์ฐ๊ฒฐ ์๋ฆฝ ํ์์์. `10 * 1000`(10์ด). ์ฐ๊ฒฐ ๋๋ผ์ด๋ฒ์ connect ํ์์์์ผ๋ก ์ ๋ฌ.
|
|
87
|
+
- `DB_CONN_DEFAULT_TIMEOUT` โ ์ฟผ๋ฆฌ ๊ธฐ๋ณธ ํ์์์. `10 * 60 * 1000`(10๋ถ). ๋ง์ง๋ง ํ๋ ํ ์ด ๊ฐ์ 2๋ฐฐ๊ฐ ์ง๋๋ฉด ์ฐ๊ฒฐ์ ์๋ ์ข
๋ฃ(idle ํ์์์)ํ๋ ๋ฐ๋ ์ฌ์ฉ.
|
|
88
|
+
- `DB_CONN_ERRORS` โ ์ค๋ฅ ๋ฉ์์ง ์์ ๊ฐ์ฒด(`as const`). `NOT_CONNECTED`(๋ฏธ์ฐ๊ฒฐ ์ํ์์ ์คํ ์), `ALREADY_CONNECTED`(์ด๋ฏธ ์ฐ๊ฒฐ๋ ์ํ์์ ์ฌ์ฐ๊ฒฐ ์). `expect(...).rejects.toThrow(DB_CONN_ERRORS.NOT_CONNECTED)` ์ฒ๋ผ throw ๋น๊ตยท๋ฉ์์ง ๋งค์นญ์ ์ฌ์ฉ.
|
|
89
89
|
|
|
90
90
|
## ์ฃผ์์ฌํญ
|
|
91
91
|
|
|
92
92
|
- `createDbConn` ๋ฐํ ๊ฐ์ฒด๋ ๋ฏธ์ฐ๊ฒฐ ์ํ โ ๋ฐ๋์ `connect()` ํธ์ถ ํ ์ฌ์ฉ.
|
|
93
|
-
- bulk insert ๋ dialect๋ณ ๋ค์ดํฐ๋ธ ๊ฒฝ๋ก๊ฐ ๋ฌ๋ผ(MySQL
|
|
94
|
-
- ๋๋ถ๋ถ์ ์์
์ `createOrm`(README)์ผ๋ก ์ถฉ๋ถ. ์ด ๊ณ์ธต์
|
|
93
|
+
- bulk insert ๋ dialect๋ณ ๋ค์ดํฐ๋ธ ๊ฒฝ๋ก๊ฐ ๋ฌ๋ผ(MySQL ์์ํ์ผ + `LOCAL INFILE`, PostgreSQL `COPY`, MSSQL `BulkLoad`) ์๋ฒ ์ธก ๊ถํยท์ค์ ์ ์์กดํ ์ ์์.
|
|
94
|
+
- ๋๋ถ๋ถ์ ์์
์ `createOrm`(README)์ผ๋ก ์ถฉ๋ถ. ์ด ๊ณ์ธต์ raw SQLยทexecutor ์ปค์คํฐ๋ง์ด์ง์ด ํ์ํ ๊ฒฝ์ฐ์๋ง.
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
# @simplysm/sd-cli
|
|
2
2
|
|
|
3
|
-
simplysm
|
|
3
|
+
simplysm ๋น๋/๋ฐฐํฌ ์ค์ผ์คํธ๋ ์ดํฐ CLI. entry ์์ ๊ณต๊ฐ๋๋ ๊ฒ์ CLI ์คํ ์ฝ๋๊ฐ ์๋๋ผ โ `sd.config.ts` ์์ฑ์ฉ ์ค์ ํ์
, โก ๋ด๋ถ TypeScript/Angular ์ปดํ์ผ๋ฌ(`SdTsCompiler`), โข Vitest ์ ์ฉ Angular Vite ํ๋ฌ๊ทธ์ธ(`sdAngularPlugin`) ์ธ ๊ฐ์ง๋ฟ์ด๋ค.
|
|
4
4
|
|
|
5
5
|
## ์ฌ์ฉ ํธ๋ฆฌ๊ฑฐ ์ธ๋ฑ์ค
|
|
6
6
|
|
|
7
|
-
- **sd.config.ts ์ค์ ํ์
**
|
|
8
|
-
- **SdTsCompiler
|
|
9
|
-
- **sdAngularPlugin** โ Vitest
|
|
7
|
+
- **sd.config.ts ์ค์ ํ์
** โ ํ๋ก์ ํธ ๋ฃจํธ `sd.config.ts` ๋ฅผ ์์ฑยท์์ ํ๋ฉฐ ํจํค์ง ๋น๋ ํ๊ฒยท๋ฐฐํฌยทCapacitor/Electron/PWAยท์๋ฒ ์ต์
์ ์ง์ ํ ๋. ์์ธํ: [sd-config-types.md](./sd-config-types.md)
|
|
8
|
+
- **SdTsCompiler / ISdTsCompilerOptions / ISdTsCompilerResult** โ sd-cli ์ธ๋ถ์์ ํจํค์ง ๋จ์ TS(๋๋ Angular AOT) ์ฆ๋ถ ์ปดํ์ผ์ ์ง์ ๊ตฌ๋ํ๊ฑฐ๋ ๊ทธ ๊ฒฐ๊ณผ(emitยท์ง๋จยทlintยทSCSS)๋ฅผ ๋ค๋ฃฐ ๋. ์์ธํ: [SdTsCompiler.md](./SdTsCompiler.md)
|
|
9
|
+
- **sdAngularPlugin / SdAngularPluginOptions** โ Vitest ์ Angular project ์์ `.ts` ๋ฅผ AOT ์ปดํ์ผํด ์ฃผ์
ํ๋ Vite ํ๋ฌ๊ทธ์ธ์ ์ค์ ํ ๋. (์ธ๋ผ์ธ, ์๋ ์ฐธ์กฐ)
|
|
10
10
|
|
|
11
11
|
## sdAngularPlugin
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function sdAngularPlugin(options: SdAngularPluginOptions): Plugin
|
|
13
|
+
```ts
|
|
14
|
+
function sdAngularPlugin(options: SdAngularPluginOptions): Plugin // vite Plugin ๋ฐํ
|
|
15
|
+
interface SdAngularPluginOptions { pkg: string }
|
|
17
16
|
```
|
|
18
17
|
|
|
19
|
-
`
|
|
20
|
-
|
|
21
|
-
- pkg: string โ `sd.config.ts` ์ `packages` ํค(ํจํค์ง ๋๋ ํ ๋ฆฌ๋ช
, `@simplysm/` ์ ๋์ฌ ์ ์ธ). `config()` ํ
์์ `packages/<pkg>` ๋ฅผ ์ปดํ์ผ ๋ฃจํธ๋ก ํด์ํ๋ค. ์ด๋ Angular ํจํค์ง๋ฅผ ํ
์คํธ ๋น๋ํ ์ง ์ง์ .
|
|
18
|
+
Angular AOT ์ปดํ์ผ์ ์ํํ๋ Vite ํ๋ฌ๊ทธ์ธ. **Vitest ์ ์ฉ**(`vitest.config.ts` ์ `angular` project plugins ์ ๋ฑ๋ก). ๋ด๋ถ์ ์ผ๋ก `SdTsCompiler` ๋ก ๋์ ํจํค์ง์ `.ts`(tests ํฌํจ, `includeTests: true`)๋ฅผ AOT ์ปดํ์ผํ๊ณ , Vite `transform` ํ
์์ ์ปดํ์ผ๋ JS ๋ฅผ ๋ฐํํ๋ค. `enforce: "pre"` ๋ก ๋ค๋ฅธ transform ๋ณด๋ค ๋จผ์ ๋์ํ๋ฉฐ, ์ปดํ์ผ๋ฌ๊ฐ ๋ง๋ ์ธ๋ผ์ธ base64 ์์ค๋งต์ ๋ถ๋ฆฌํด Vite ํธํ ํํ(`{ code, map }`)๋ก ๋๊ธด๋ค. `buildEnd` ๋ง๋ค ๋ด๋ถ ์ปดํ์ผ๋ฌ๋ฅผ ํ๊ธฐํด ๋ค์ watch ์ฌ๋น๋ ๋ ์ฌ์์ฑํ๊ณ , watch ๋ณ๊ฒฝ ํ์ผ์ `buildStart` ์ ์บ์ ๋ฌดํจํ์ ์ฌ์ฉํ๋ค.
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
- pkg: string โ ์ปดํ์ผ ๋์ ํจํค์ง ๋๋ ํ ๋ฆฌ๋ช
. `sd.config.ts` ์ `packages` ํค์ ๋์ผ(`@simplysm/` ์ ๋์ฌ ์ ์ธํ ์งง์ ์ด๋ฆ, ์: `"angular"`). ํ๋ฌ๊ทธ์ธ์ `process.cwd()/packages/<pkg>` ๋ฅผ ์ปดํ์ผ ๋ฃจํธ๋ก ์ก์ผ๋ฏ๋ก, ํ
์คํธํ๋ ค๋ Angular ํจํค์ง๋ช
์ ๊ทธ๋๋ก ๋ฃ๋๋ค.
|
|
24
21
|
|
|
25
|
-
```
|
|
22
|
+
```ts
|
|
23
|
+
// vitest.config.ts
|
|
26
24
|
import { sdAngularPlugin } from "@simplysm/sd-cli";
|
|
27
|
-
|
|
28
|
-
plugins: [sdAngularPlugin({ pkg: "angular" })];
|
|
25
|
+
plugins: [sdAngularPlugin({ pkg: "angular" })]
|
|
29
26
|
```
|
|
@@ -1,70 +1,117 @@
|
|
|
1
1
|
# @simplysm/sd-cli โ SdTsCompiler
|
|
2
2
|
|
|
3
|
-
ํจํค์ง ๋๋ ํ ๋ฆฌ์ `.ts` ๋ฅผ
|
|
3
|
+
ํจํค์ง ๋๋ ํ ๋ฆฌ์ `.ts` ๋ฅผ TypeScript ๋๋ Angular AOT ๋ก **์ฆ๋ถ** ์ปดํ์ผํ๋ ํด๋์ค. ํ ๋ฒ์ `compileAsync` ํธ์ถ๋ก ์ง๋ ฌํ๋ ์ง๋จ + emit ๊ฒฐ๊ณผ + lint + SCSS ๊ฒฐ๊ณผ๋ฅผ ํ ๋ฌถ์(`ISdTsCompilerResult`)์ผ๋ก ๋ฐํํ๋ค. tsconfig ์ `angularCompilerOptions` ์กด์ฌ ์ฌ๋ถ๋ก Angular/์ผ๋ฐ ๋ชจ๋๋ฅผ ์๋ ํ๋ณ. ๋น๋ ์์ง๊ณผ `sdAngularPlugin` ๋ด๋ถ์์ ์ฌ์ฉ. ์ง๋จ์ worker ๊ฒฝ๊ณ๋ฅผ ํต๊ณผํ๋๋ก `SerializedDiagnostic` ์ผ๋ก ์ง๋ ฌํ๋๋ฉฐ, ๋ด๋ถ ํฌ๋์๋ ๋จ๊ณ๋ณ๋ก ์ก์ ์ง๋จ์ผ๋ก ๋ณด๊ณ (๋ถ๋ถ ๋ณต๊ตฌ)ํ๋ค.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## ISdTsCompilerOptions (์์ฑ์ ์ธ์)
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
interface ISdTsCompilerOptions {
|
|
9
|
+
pkgDir: string;
|
|
10
|
+
cwd: string;
|
|
11
|
+
output: { js: boolean; dts: boolean };
|
|
12
|
+
includeTests?: boolean;
|
|
13
|
+
env?: TypecheckEnv;
|
|
14
|
+
// Angular ์ ์ฉ (isForAngular ์ ํ์ฑ)
|
|
15
|
+
sourceFileCache?: AngularSourceFileCache;
|
|
16
|
+
transformStylesheet?: (data: string, containingFile: string, stylesheetFile?: string) => Promise<string | null>;
|
|
17
|
+
externalStylesheets?: Map<string, string>;
|
|
18
|
+
compilerOptionsTransformer?: (options: ts.CompilerOptions) => ts.CompilerOptions;
|
|
19
|
+
// SCSS/lint ํตํฉ
|
|
20
|
+
lint?: boolean;
|
|
21
|
+
globalScss?: boolean;
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- pkgDir: string โ ์ปดํ์ผ ๋์ ํจํค์ง ๋๋ ํ ๋ฆฌ. `<pkgDir>/tsconfig.json` ์ ํ์ฑํ๊ณ `<pkgDir>/dist` ๋ก emit, `<pkgDir>/.cache` ์ tsbuildinfo ๋ฅผ ๋๋ค.
|
|
26
|
+
- cwd: string โ ์ํฌ์คํ์ด์ค ๋ฃจํธ. ์ง๋จ ํํฐ๋ง(`isWorkspaceDiagnostic`)ยท๊ฒฝ๋ก ์๋ํยท์๋ฌ ํฌ๋งท ๊ธฐ์ค์ .
|
|
27
|
+
- output.js: boolean โ JS emit ์ฌ๋ถ. true ๋ฉด `.js` ์ฐ์ถ(non-Angular ์ import ์ `.js` ํ์ฅ์ ๋ถ์ฐฉ + ๊ฒฝ๋ก ์ฌ์์ฑ, Angular ์ `emitResults` ๋ก ๋ฐํ).
|
|
28
|
+
- output.dts: boolean โ `.d.ts` emit ์ฌ๋ถ. `js`/`dts` ์กฐํฉ์ ๋ฐ๋ผ emit-onlyยทdeclaration-onlyยทnoEmit(๋ ๋ค false = ํ์
์ฒดํฌ๋ง) ์ผ๋ก ๋ถ๊ธฐ.
|
|
29
|
+
- includeTests?: boolean โ `tests/` ํ์ผ์ rootNames ์ ํฌํจํ ์ง. ๊ธฐ๋ณธ false. ํ
์คํธ๊น์ง ์ปดํ์ผํด์ผ ํ๋ฉด true(์: `sdAngularPlugin`).
|
|
30
|
+
- env?: TypecheckEnv โ ํ์
์ฒดํฌ ํ๊ฒฝ. ์ง์ ์ `getCompilerOptionsForEnv()` ๋ก ํ๊ฒฝ๋ณ compilerOptions ๋ฅผ ์ ์ฉํ๊ณ tsbuildinfo ํ์ผ๋ช
์ ์ ๋ฏธ์ฌ๋ฅผ ๋ถ์. ํ๊ฒฝ ๋ถ๋ฆฌ ํ์
์ฒดํฌ์ ์ด๋ค.
|
|
31
|
+
- sourceFileCache?: AngularSourceFileCache โ Angular ์ฆ๋ถ์ฉ SourceFile ์บ์. ๋ฏธ์ ๊ณต ์ ๋ด๋ถ ์์ฑ. ์ฌ๋ฌ `compileAsync` ๋ผ์ด๋ ๊ฐ ์บ์๋ฅผ ๊ณต์ ํ๋ ค๋ฉด ์ธ๋ถ์์ ์ฃผ์
.
|
|
32
|
+
- transformStylesheet?: (data, containingFile, stylesheetFile?) => Promise<string|null> โ ์ปดํฌ๋ํธ ์คํ์ผ ๋ณํ ์ฝ๋ฐฑ(Angular only). `null` ๋ฐํ ์ ๋ณํ ์ ํจ. ๋ฏธ์ ๊ณต์ด๊ณ Angular ๋ฉด ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ฉ SCSS ๋ณํ ์ฝ๋ฐฑ์ ์๋ ์์ฑ. ํด๋ผ์ด์ธํธ ๋น๋์ฒ๋ผ ์ปค์คํ
์คํ์ผ ํ์ดํ๋ผ์ธ์ด ํ์ํ ๋ ์ง์ ์ ๊ณต.
|
|
33
|
+
- externalStylesheets?: Map<string, string> โ ์ธ๋ถ ์คํ์ผ์ํธ ๋งต(ํด๋ผ์ด์ธํธ ๋น๋์ฉ). ์ง์ ์ ๋น-ํ
ํ๋ฆฟ ์คํ์ผ ๋ฆฌ์์ค๋ฅผ ํด์ ๊ธฐ๋ฐ `.css` ์ธ๋ถ ํ์ผ๋ช
์ผ๋ก ๋งคํ(`resourceNameToFileName`). ์คํ์ผ์ ๋ณ๋ ์ฒญํฌ๋ก ๋ฝ์ ๋.
|
|
34
|
+
- compilerOptionsTransformer?: (options) => ts.CompilerOptions โ ์ต์ข
compilerOptions ํ์ฒ๋ฆฌ ํ
. ํด๋ผ์ด์ธํธ์ `target`/`module`/`rootDir` ๊ฐ์ ๋ฑ์ ์ด๋ค.
|
|
35
|
+
- lint?: boolean โ true ๋ฉด `compileAsync` ๊ฐ program ๊ธฐ๋ฐ lint ๋ฅผ ํจ๊ป ๋๋ ค ๊ฒฐ๊ณผ๋ฅผ `result.lint` ์ ๋ด๋๋ค(affected ํ์ผ๋ง ๋์). ์ปดํ์ผ๊ณผ ๋์์ lint ํ๊ณ ์ถ์ ๋.
|
|
36
|
+
- globalScss?: boolean โ true ๋ฉด `scss/styles.scss` โ `dist/styles.css` ๊ธ๋ก๋ฒ SCSS ๋ฅผ ์ปดํ์ผํ๊ณ ์๋ฌ๋ฅผ `result.scssErrors` ์ ๋ํ๋ค.
|
|
37
|
+
|
|
38
|
+
## ISdTsCompilerEmitOptions (compileAsync 2๋ฒ์งธ ์ธ์)
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
interface ISdTsCompilerEmitOptions {
|
|
42
|
+
sourceFilter?: (fileName: string) => boolean;
|
|
43
|
+
additionalTransformers?: {
|
|
44
|
+
before?: ts.TransformerFactory<ts.SourceFile>[];
|
|
45
|
+
after?: ts.TransformerFactory<ts.SourceFile>[];
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- sourceFilter?: (fileName) => boolean โ emit ๊ฒฐ๊ณผ ํํฐ(Angular only). true ์ธ ์์ค๋ง `emitResults` ์ ๋จ๊ธด๋ค. ํน์ ํ์ผ์ emit ๋ง ํ์ํ ๋(์: HMR ๋จ์ผ ํ์ผ).
|
|
51
|
+
- additionalTransformers?.before / .after โ Angular ๊ธฐ๋ณธ transformers ์/๋ค์ ๋ผ์ธ ์ถ๊ฐ TS transformer ๋ฐฐ์ด(Angular only). ์ปค์คํ
์ฝ๋ ๋ณํ์ ์ฃผ์
ํ ๋.
|
|
52
|
+
|
|
53
|
+
## SdTsCompiler โ ๋ฉ์๋
|
|
6
54
|
|
|
7
55
|
```typescript
|
|
8
56
|
class SdTsCompiler {
|
|
9
57
|
constructor(options: ISdTsCompilerOptions);
|
|
10
58
|
compileAsync(modifiedFiles?: ReadonlySet<string>, emitOptions?: ISdTsCompilerEmitOptions): Promise<ISdTsCompilerResult>;
|
|
59
|
+
get sideEffectScssRegistry(): Map<string, SideEffectScssEntry>;
|
|
11
60
|
compileSideEffectScss(): void;
|
|
12
61
|
findAffectedByScss(scssPath: string): string[];
|
|
13
|
-
get sideEffectScssRegistry(): Map<string, SideEffectScssEntry>;
|
|
14
62
|
}
|
|
15
63
|
```
|
|
16
64
|
|
|
17
|
-
- compileAsync(modifiedFiles?, emitOptions?) โ 1ํ ์ฆ๋ถ
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
65
|
+
- compileAsync(modifiedFiles?, emitOptions?) โ 1ํ ์ฆ๋ถ ์ปดํ์ผ ์คํ. `modifiedFiles` = ์ง์ ๋ณ๊ฒฝ๋ ํ์ผ ์ ๋๊ฒฝ๋ก ์งํฉ(์ฆ๋ถ ๋ฌดํจํ์ฉ, ๋ฏธ์ง์ ยท๋น ์งํฉ์ด๋ฉด ์บ์ ๊ทธ๋๋ก ์ฌ์ฉ; node_modules ํฌํจ ๋ณ๊ฒฝ ์ packageJsonCache ํด๋ฆฌ์ด). `emitOptions` ๋ ์ emit ํํฐ/transformer. ๊ฐ์ ์ธ์คํด์ค๋ก ๋ฐ๋ณต ํธ์ถํด ์ฆ๋ถ ๋น๋๋ฅผ ์ด์ด๊ฐ๋ค.
|
|
66
|
+
- sideEffectScssRegistry (getter) โ side-effect SCSS ๋ฑ๋ก๋ถ(`Map<์์ค, SideEffectScssEntry>`) ์ฐธ์กฐ. emit ์ฝ๋๊ฐ ํญ๋ชฉ์ ๋ฑ๋กํ๋ ํต๋ก.
|
|
67
|
+
- compileSideEffectScss() โ ์ ๋ ์ง์คํธ๋ฆฌ์ ๋ชจ๋ ํญ๋ชฉ์ CSS ๋ก ์ปดํ์ผํ๊ณ ์๋ฌ/์์กด์ฑ์ ๋ด๋ถ ์ํ์ ๋ฐ์.
|
|
68
|
+
- findAffectedByScss(scssPath) โ ์ฃผ์ด์ง SCSS ๊ฒฝ๋ก์ ์์กดํ๋ ์์ ์ ํ์ผ ๊ฒฝ๋ก ๋ฐฐ์ด์ ๋ฐํ(์ญ๋ฐฉํฅ ํ์). watch ์์ SCSS ๋ณ๊ฒฝ ์ ์ฌ์ปดํ์ผ ๋์ ์ฐ์ถ์ ์ด๋ค.
|
|
21
69
|
|
|
22
|
-
|
|
70
|
+
์ฌ์ฉ ์:
|
|
23
71
|
|
|
24
72
|
```typescript
|
|
25
73
|
import { SdTsCompiler } from "@simplysm/sd-cli";
|
|
26
|
-
|
|
74
|
+
|
|
75
|
+
const compiler = new SdTsCompiler({
|
|
76
|
+
pkgDir: "/repo/packages/core-common",
|
|
77
|
+
cwd: "/repo",
|
|
78
|
+
output: { js: true, dts: true },
|
|
79
|
+
});
|
|
27
80
|
const result = await compiler.compileAsync();
|
|
28
81
|
if (result.errorCount > 0) console.error(result.errors);
|
|
82
|
+
// watch ๋ผ์ด๋: ๋ณ๊ฒฝ ํ์ผ๋ง ๋๊ฒจ ์ฆ๋ถ ์ปดํ์ผ
|
|
83
|
+
const next = await compiler.compileAsync(new Set(["/repo/packages/core-common/src/foo.ts"]));
|
|
29
84
|
```
|
|
30
85
|
|
|
31
|
-
##
|
|
32
|
-
|
|
33
|
-
์์ฑ์ ์ต์
.
|
|
34
|
-
|
|
35
|
-
- pkgDir: string โ ์ปดํ์ผ ๋์ ํจํค์ง ๋๋ ํ ๋ฆฌ ์ ๋๊ฒฝ๋ก. rootNamesยทoutDirยทSCSS loadPath ๊ธฐ์ค.
|
|
36
|
-
- cwd: string โ workspace ๋ฃจํธ. diagnostics ํํฐ๋ง(์ํฌ์คํ์ด์ค ๋ด๋ถ ์ง๋จ๋ง ๋จ๊น)ยท์๋๊ฒฝ๋ก ๋ก๊น
๊ธฐ์ค.
|
|
37
|
-
- output: { js: boolean; dts: boolean } โ ์ถ๋ ฅ ์ ์ด. `js` = `.js` emit ์ฌ๋ถ, `dts` = `.d.ts` emit ์ฌ๋ถ. ๋ ๋ค false ๋ฉด noEmit(ํ์
์ฒดํฌ๋ง). ์กฐํฉ์ ๋ฐ๋ผ declaration/sourceMap/tsBuildInfoFile ์ด๋ฆ์ด ๋ฌ๋ผ์ง.
|
|
38
|
-
- includeTests?: boolean โ `tests/` ํ์ผ์ rootNames ์ ํฌํจํ ์ง. ๊ธฐ๋ณธ false. ํ
์คํธ AOT ์ปดํ์ผ(Vitest)์์ true.
|
|
39
|
-
- env?: "node" | "browser" โ ํ์
์ฒดํฌ ํ๊ฒฝ. ์ค์ ์ ํ๊ฒฝ๋ณ compilerOptions ์กฐ์ (`getCompilerOptionsForEnv`) ์ ์ฉ. ๋์ผ ํจํค์ง๋ฅผ ํ๊ฒฝ๋ณ๋ก ๋ถ๋ฆฌ ๊ฒ์ฆํ ๋.
|
|
40
|
-
- sourceFileCache?: AngularSourceFileCache โ Angular ์ฆ๋ถ ๋น๋์ฉ SourceFile ์บ์. ๋ฏธ์ ๊ณต ์ ๋ด๋ถ ์์ฑ. ์ธ์คํด์ค ๊ฐ ์บ์ ๊ณต์ ๋ก ์ฆ๋ถ ์๋ ํ๋ณด.
|
|
41
|
-
- transformStylesheet?: (data, containingFile, stylesheetFile?) => Promise<string | null> โ ์คํ์ผ์ํธ ๋ณํ ์ฝ๋ฐฑ(Angular ์ ์ฉ). ์ธ๋ผ์ธ/์ธ๋ถ ์คํ์ผ์ ๊ฐ๊ณตํด ๋ฐํ, `null` ์ด๋ฉด ๋ฏธ๋ณํ. ๋ฏธ์ ๊ณต + Angular ๋ฉด ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ฉ SCSS ๋ณํ ์ฝ๋ฐฑ์ด ์๋ ์์ฑ๋จ.
|
|
42
|
-
- externalStylesheets?: Map<string, string> โ ์ธ๋ถ ์คํ์ผ์ํธ ๋งต(ํด๋ผ์ด์ธํธ ๋น๋์ฉ). `resourceNameToFileName` ์์ ๋น-ํ
ํ๋ฆฟ ๋ฆฌ์์ค๋ฅผ ํด์ ๊ธฐ๋ฐ `.css` ์ธ๋ถ ID ๋ก ์นํํ ๋ ์ฑ์์ง.
|
|
43
|
-
- compilerOptionsTransformer?: (options) => ts.CompilerOptions โ compilerOptions ์ต์ข
ํ์ฒ๋ฆฌ. ๋ด๋ถ ๊ตฌ์ฑ ์ดํ ๋ง์ง๋ง์ ์ ์ฉ๋์ด target/module/rootDir ๋ฑ์ ๊ฐ์ ๊ฐ๋ฅ. ํด๋ผ์ด์ธํธยทVitest ๋น๋์์ ์ฌ์ฉ.
|
|
44
|
-
- lint?: boolean โ true ๋ฉด `compileAsync` ๊ฐ lint ๋ฅผ ํจ๊ป ์คํํ๊ณ ๊ฒฐ๊ณผ๋ฅผ `result.lint` ์ ํฌํจ. lint runner ๋ lazy init ํ ์ธ์คํด์ค ์ฌ์ฌ์ฉ.
|
|
45
|
-
- globalScss?: boolean โ true ๋ฉด `scss/styles.scss` โ `dist/styles.css` ๊ธ๋ก๋ฒ SCSS ์ปดํ์ผ ์ํ. ๊ธ๋ก๋ฒ ์คํ์ผ ์ฐ์ถ์ด ํ์ํ ํจํค์ง์์.
|
|
46
|
-
|
|
47
|
-
## ISdTsCompilerEmitOptions
|
|
86
|
+
## ISdTsCompilerResult (compileAsync ๋ฐํ)
|
|
48
87
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
88
|
+
```typescript
|
|
89
|
+
interface ISdTsCompilerResult {
|
|
90
|
+
program: ts.Program;
|
|
91
|
+
builderProgram: ts.EmitAndSemanticDiagnosticsBuilderProgram;
|
|
92
|
+
isForAngular: boolean;
|
|
93
|
+
affectedFiles: ReadonlySet<string> | undefined;
|
|
94
|
+
diagnostics: SerializedDiagnostic[];
|
|
95
|
+
errorCount: number;
|
|
96
|
+
warningCount: number;
|
|
97
|
+
errors?: string[];
|
|
98
|
+
ngtscProgram?: NgtscProgram;
|
|
99
|
+
emitResults?: EmitResult[]; // EmitResult: { filename; contents; sourceFileName }
|
|
100
|
+
lint?: LintWithProgramResult;
|
|
101
|
+
scssErrors: string[];
|
|
102
|
+
scssDependencies: ReadonlyMap<string, ReadonlySet<string>>;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
57
105
|
|
|
58
|
-
- program: ts.Program โ
|
|
59
|
-
- builderProgram
|
|
60
|
-
- isForAngular: boolean โ Angular
|
|
61
|
-
- affectedFiles: ReadonlySet<string> | undefined โ ์ด๋ฒ ๋น๋์์ ์ํฅ๋ฐ์ ํ์ผ(posix ๊ฒฝ๋ก). `undefined` = ์ ์ญ ๋ณ๊ฒฝ(์ ์ฒด ๋ฆฌ๋น๋).
|
|
62
|
-
- diagnostics: SerializedDiagnostic[] โ ์ง๋ ฌํ๋ ์ง๋จ
|
|
63
|
-
- errorCount: number โ Error ์นดํ
๊ณ ๋ฆฌ ์ง๋จ
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
- lint?: LintWithProgramResult โ lint ๊ฒฐ๊ณผ. `lint` ์ต์
ํ์ฑ ์์๋ง ์กด์ฌ.
|
|
106
|
+
- program: ts.Program โ TS Program ์ฐธ์กฐ. lintยท์ธ๋ถ ๋๊ตฌ์ ๋๊ธธ ๋.
|
|
107
|
+
- builderProgram โ ์ฆ๋ถ BuilderProgram ์ฐธ์กฐ.
|
|
108
|
+
- isForAngular: boolean โ Angular ๋ชจ๋๋ก ์ปดํ์ผ๋๋์ง(tsconfig ์ `angularCompilerOptions` ์ ๋ฌด๋ก ๊ฒฐ์ ). ํ์ ์ฒ๋ฆฌ ๋ถ๊ธฐ์ ์ด๋ค.
|
|
109
|
+
- affectedFiles: ReadonlySet<string> | undefined โ ์ด๋ฒ ๋น๋์์ ์ํฅ๋ฐ์ ํ์ผ(posix ๊ฒฝ๋ก). `undefined` = ์ ์ญ ๋ณ๊ฒฝ(์ ์ฒด ๋ฆฌ๋น๋). ๋ถ๋ถ ์ฌ์ฒ๋ฆฌ ๋ฒ์ ํ๋จ์ ์ด๋ค.
|
|
110
|
+
- diagnostics: SerializedDiagnostic[] โ ์ง๋ ฌํ๋ ์ง๋จ ์ ์ฒด(worker ๊ฒฝ๊ณ ํต๊ณผ์ฉ). ๋ด๋ถ ํฌ๋์ ์ง๋จ๋ ํฉ์ฐ๋จ.
|
|
111
|
+
- errorCount / warningCount: number โ Error / Warning ์นดํ
๊ณ ๋ฆฌ ์ง๋จ ์. ํฌ๋์๋ errorCount ์ ๊ฐ์ฐ.
|
|
112
|
+
- errors?: string[] โ Error ์ง๋จ์ `"ํ์ผ:์ค:์ด: TS์ฝ๋: ๋ฉ์์ง"` ํ์์ผ๋ก ํฌ๋งทํ ๋ฐฐ์ด(์์ผ๋ฉด undefined). ๋ก๊ทธ ์ถ๋ ฅ์ ๋ฐ๋ก ์ด๋ค.
|
|
113
|
+
- ngtscProgram?: NgtscProgram โ NgtscProgram ์ฐธ์กฐ(Angular only, HMR ์ฉ). non-Angular ์ด๋ฉด undefined.
|
|
114
|
+
- emitResults?: EmitResult[] โ Angular emit ๊ฒฐ๊ณผ ๋ฐฐ์ด. ๊ฐ ํญ๋ชฉ `{ filename; contents; sourceFileName }`(sourceFileName = ์๋ณธ ์์ค ๊ฒฝ๋ก). non-Angular ์ writeFile ํ
์ผ๋ก ๋์คํฌ์ ์ง์ ์ฐ๋ฏ๋ก undefined. ๋ฉ๋ชจ๋ฆฌ์ ์ปดํ์ผ ๊ฒฐ๊ณผ๊ฐ ํ์ํ ํ๋ฌ๊ทธ์ธ์ด ์๋น.
|
|
115
|
+
- lint?: LintWithProgramResult โ lint ๊ฒฐ๊ณผ(`lint: true` ์ผ ๋๋ง).
|
|
69
116
|
- scssErrors: string[] โ SCSS ์ปดํ์ผ ์๋ฌ ๋ชฉ๋ก.
|
|
70
117
|
- scssDependencies: ReadonlyMap<string, ReadonlySet<string>> โ SCSS ์์กด์ฑ ๋งต(์์ ์ ํ์ผ โ ์์กด SCSS ๊ฒฝ๋ก ์งํฉ). watch ์ญ๋ฐฉํฅ ํ์์ฉ.
|