@simplysm/sd-cli 14.0.42 → 14.0.44
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/dist/angular/angular-compiler.d.ts +0 -35
- package/dist/angular/angular-compiler.d.ts.map +1 -1
- package/dist/angular/angular-compiler.js +0 -374
- package/dist/angular/angular-compiler.js.map +1 -1
- package/dist/angular/hmr-candidates.d.ts +13 -0
- package/dist/angular/hmr-candidates.d.ts.map +1 -0
- package/dist/angular/hmr-candidates.js +230 -0
- package/dist/angular/hmr-candidates.js.map +1 -0
- package/dist/angular/ngtsc-build-core.d.ts +41 -37
- package/dist/angular/ngtsc-build-core.d.ts.map +1 -1
- package/dist/angular/ngtsc-build-core.js +155 -52
- package/dist/angular/ngtsc-build-core.js.map +1 -1
- package/dist/angular/vite-angular-plugin.d.ts +1 -1
- package/dist/angular/vite-angular-plugin.d.ts.map +1 -1
- package/dist/angular/vite-angular-plugin.js +63 -56
- package/dist/angular/vite-angular-plugin.js.map +1 -1
- package/dist/angular/web-worker-transformer.d.ts +9 -0
- package/dist/angular/web-worker-transformer.d.ts.map +1 -0
- package/dist/angular/web-worker-transformer.js +73 -0
- package/dist/angular/web-worker-transformer.js.map +1 -0
- package/dist/capacitor/capacitor.d.ts.map +1 -1
- package/dist/capacitor/capacitor.js +6 -4
- package/dist/capacitor/capacitor.js.map +1 -1
- package/dist/commands/check.d.ts +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +15 -65
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/publish/deployment-phase.d.ts.map +1 -1
- package/dist/commands/publish/deployment-phase.js +13 -5
- package/dist/commands/publish/deployment-phase.js.map +1 -1
- package/dist/commands/publish/npm-publisher.js +1 -1
- package/dist/commands/publish/npm-publisher.js.map +1 -1
- package/dist/commands/publish/publish-command.js +1 -1
- package/dist/commands/publish/publish-command.js.map +1 -1
- package/dist/commands/publish/version-upgrade.d.ts.map +1 -1
- package/dist/commands/publish/version-upgrade.js +16 -13
- package/dist/commands/publish/version-upgrade.js.map +1 -1
- package/dist/commands/replace-deps.d.ts.map +1 -1
- package/dist/commands/replace-deps.js +2 -1
- package/dist/commands/replace-deps.js.map +1 -1
- package/dist/deps/replace-deps/collect-deps.d.ts.map +1 -1
- package/dist/deps/replace-deps/collect-deps.js +5 -2
- package/dist/deps/replace-deps/collect-deps.js.map +1 -1
- package/dist/deps/replace-deps/replace-deps-resolve.d.ts.map +1 -1
- package/dist/deps/replace-deps/replace-deps-resolve.js +6 -7
- package/dist/deps/replace-deps/replace-deps-resolve.js.map +1 -1
- package/dist/deps/replace-deps/replace-deps.d.ts +21 -3
- package/dist/deps/replace-deps/replace-deps.d.ts.map +1 -1
- package/dist/deps/replace-deps/replace-deps.js +175 -66
- package/dist/deps/replace-deps/replace-deps.js.map +1 -1
- package/dist/electron/electron.js +7 -7
- package/dist/electron/electron.js.map +1 -1
- package/dist/engines/BaseEngine.d.ts.map +1 -1
- package/dist/engines/BaseEngine.js +2 -5
- package/dist/engines/BaseEngine.js.map +1 -1
- package/dist/engines/EsbuildClientEngine.d.ts.map +1 -1
- package/dist/engines/EsbuildClientEngine.js +16 -9
- package/dist/engines/EsbuildClientEngine.js.map +1 -1
- package/dist/engines/NgtscEngine.d.ts +4 -4
- package/dist/engines/NgtscEngine.d.ts.map +1 -1
- package/dist/engines/NgtscEngine.js +5 -5
- package/dist/engines/NgtscEngine.js.map +1 -1
- package/dist/engines/TscEngine.d.ts.map +1 -1
- package/dist/engines/TscEngine.js +0 -2
- package/dist/engines/TscEngine.js.map +1 -1
- package/dist/engines/types.d.ts +2 -0
- package/dist/engines/types.d.ts.map +1 -1
- package/dist/esbuild/esbuild-angular-compiler-plugin.d.ts +36 -0
- package/dist/esbuild/esbuild-angular-compiler-plugin.d.ts.map +1 -0
- package/dist/esbuild/esbuild-angular-compiler-plugin.js +464 -0
- package/dist/esbuild/esbuild-angular-compiler-plugin.js.map +1 -0
- package/dist/esbuild/esbuild-client-config.d.ts +8 -2
- package/dist/esbuild/esbuild-client-config.d.ts.map +1 -1
- package/dist/esbuild/esbuild-client-config.js +48 -33
- package/dist/esbuild/esbuild-client-config.js.map +1 -1
- package/dist/esbuild/esbuild-postcss-plugin.d.ts.map +1 -1
- package/dist/esbuild/esbuild-postcss-plugin.js +9 -6
- package/dist/esbuild/esbuild-postcss-plugin.js.map +1 -1
- package/dist/esbuild/esbuild-tsc-plugin.d.ts +4 -1
- package/dist/esbuild/esbuild-tsc-plugin.d.ts.map +1 -1
- package/dist/esbuild/esbuild-tsc-plugin.js +27 -23
- package/dist/esbuild/esbuild-tsc-plugin.js.map +1 -1
- package/dist/esbuild/file-reference-tracker.d.ts +24 -0
- package/dist/esbuild/file-reference-tracker.d.ts.map +1 -0
- package/dist/esbuild/file-reference-tracker.js +57 -0
- package/dist/esbuild/file-reference-tracker.js.map +1 -0
- package/dist/esbuild/lmdb-cache-store.d.ts +18 -0
- package/dist/esbuild/lmdb-cache-store.d.ts.map +1 -0
- package/dist/esbuild/lmdb-cache-store.js +41 -0
- package/dist/esbuild/lmdb-cache-store.js.map +1 -0
- package/dist/esbuild/load-result-cache.d.ts +17 -0
- package/dist/esbuild/load-result-cache.d.ts.map +1 -0
- package/dist/esbuild/load-result-cache.js +61 -0
- package/dist/esbuild/load-result-cache.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lint/lint-core.js +7 -7
- package/dist/lint/lint-core.js.map +1 -1
- package/dist/orchestrators/BaseOrchestrator.js +2 -2
- package/dist/orchestrators/BaseOrchestrator.js.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +5 -19
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
- package/dist/orchestrators/DevOrchestrator.js +5 -5
- package/dist/orchestrators/DevOrchestrator.js.map +1 -1
- package/dist/orchestrators/WatchOrchestrator.js +6 -6
- package/dist/orchestrators/WatchOrchestrator.js.map +1 -1
- package/dist/runtime/ResultCollector.d.ts +1 -0
- package/dist/runtime/ResultCollector.d.ts.map +1 -1
- package/dist/runtime/ResultCollector.js.map +1 -1
- package/dist/runtime/engine-watch-events.d.ts.map +1 -1
- package/dist/runtime/engine-watch-events.js +3 -0
- package/dist/runtime/engine-watch-events.js.map +1 -1
- package/dist/runtime/rebuild-manager.js +1 -1
- package/dist/runtime/rebuild-manager.js.map +1 -1
- package/dist/runtime/worker-utils.js +1 -1
- package/dist/runtime/worker-utils.js.map +1 -1
- package/dist/sd-cli-entry.d.ts.map +1 -1
- package/dist/sd-cli-entry.js +4 -3
- package/dist/sd-cli-entry.js.map +1 -1
- package/dist/sd-cli.js +3 -3
- package/dist/sd-cli.js.map +1 -1
- package/dist/ts-compiler/SdTsCompiler.d.ts +39 -0
- package/dist/ts-compiler/SdTsCompiler.d.ts.map +1 -0
- package/dist/ts-compiler/SdTsCompiler.js +593 -0
- package/dist/ts-compiler/SdTsCompiler.js.map +1 -0
- package/dist/ts-compiler/sd-ts-compiler-options.d.ts +40 -0
- package/dist/ts-compiler/sd-ts-compiler-options.d.ts.map +1 -0
- package/dist/ts-compiler/sd-ts-compiler-options.js +2 -0
- package/dist/ts-compiler/sd-ts-compiler-options.js.map +1 -0
- package/dist/ts-compiler/sd-ts-compiler-result.d.ts +34 -0
- package/dist/ts-compiler/sd-ts-compiler-result.d.ts.map +1 -0
- package/dist/ts-compiler/sd-ts-compiler-result.js +2 -0
- package/dist/ts-compiler/sd-ts-compiler-result.js.map +1 -0
- package/dist/utils/copy-public.d.ts +6 -4
- package/dist/utils/copy-public.d.ts.map +1 -1
- package/dist/utils/copy-public.js +9 -7
- package/dist/utils/copy-public.js.map +1 -1
- package/dist/utils/diagnostic-utils.d.ts +2 -3
- package/dist/utils/diagnostic-utils.d.ts.map +1 -1
- package/dist/utils/diagnostic-utils.js +8 -9
- package/dist/utils/diagnostic-utils.js.map +1 -1
- package/dist/utils/output-utils.d.ts +8 -2
- package/dist/utils/output-utils.d.ts.map +1 -1
- package/dist/utils/output-utils.js +32 -8
- package/dist/utils/output-utils.js.map +1 -1
- package/dist/workers/client.worker.d.ts +1 -1
- package/dist/workers/client.worker.d.ts.map +1 -1
- package/dist/workers/client.worker.js +115 -110
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/incremental-mtime-tracker.d.ts +13 -0
- package/dist/workers/incremental-mtime-tracker.d.ts.map +1 -0
- package/dist/workers/incremental-mtime-tracker.js +65 -0
- package/dist/workers/incremental-mtime-tracker.js.map +1 -0
- package/dist/workers/library-build.worker.d.ts +0 -2
- package/dist/workers/library-build.worker.d.ts.map +1 -1
- package/dist/workers/library-build.worker.js +169 -70
- package/dist/workers/library-build.worker.js.map +1 -1
- package/dist/workers/server-build.worker.d.ts.map +1 -1
- package/dist/workers/server-build.worker.js +30 -57
- package/dist/workers/server-build.worker.js.map +1 -1
- package/dist/workers/server-esbuild-context.d.ts +7 -0
- package/dist/workers/server-esbuild-context.d.ts.map +1 -1
- package/dist/workers/server-esbuild-context.js +11 -2
- package/dist/workers/server-esbuild-context.js.map +1 -1
- package/package.json +5 -4
- package/src/angular/angular-compiler.ts +0 -502
- package/src/angular/hmr-candidates.ts +295 -0
- package/src/angular/ngtsc-build-core.ts +192 -91
- package/src/angular/vite-angular-plugin.ts +71 -65
- package/src/angular/web-worker-transformer.ts +117 -0
- package/src/capacitor/capacitor.ts +6 -4
- package/src/commands/check.ts +17 -76
- package/src/commands/publish/deployment-phase.ts +11 -7
- package/src/commands/publish/npm-publisher.ts +1 -1
- package/src/commands/publish/publish-command.ts +1 -1
- package/src/commands/publish/version-upgrade.ts +44 -35
- package/src/commands/replace-deps.ts +3 -1
- package/src/deps/replace-deps/collect-deps.ts +4 -2
- package/src/deps/replace-deps/replace-deps-resolve.ts +12 -7
- package/src/deps/replace-deps/replace-deps.ts +191 -69
- package/src/electron/electron.ts +7 -7
- package/src/engines/BaseEngine.ts +2 -6
- package/src/engines/EsbuildClientEngine.ts +16 -10
- package/src/engines/NgtscEngine.ts +7 -7
- package/src/engines/TscEngine.ts +0 -2
- package/src/engines/types.ts +2 -0
- package/src/esbuild/esbuild-angular-compiler-plugin.ts +647 -0
- package/src/esbuild/esbuild-client-config.ts +57 -41
- package/src/esbuild/esbuild-postcss-plugin.ts +9 -6
- package/src/esbuild/esbuild-tsc-plugin.ts +33 -23
- package/src/esbuild/file-reference-tracker.ts +61 -0
- package/src/esbuild/lmdb-cache-store.ts +46 -0
- package/src/esbuild/load-result-cache.ts +85 -0
- package/src/index.ts +5 -0
- package/src/lint/lint-core.ts +7 -7
- package/src/orchestrators/BaseOrchestrator.ts +2 -2
- package/src/orchestrators/BuildOrchestrator.ts +5 -24
- package/src/orchestrators/DevOrchestrator.ts +5 -5
- package/src/orchestrators/WatchOrchestrator.ts +6 -6
- package/src/runtime/ResultCollector.ts +1 -0
- package/src/runtime/engine-watch-events.ts +3 -0
- package/src/runtime/rebuild-manager.ts +1 -1
- package/src/runtime/worker-utils.ts +1 -1
- package/src/sd-cli-entry.ts +5 -3
- package/src/sd-cli.ts +4 -4
- package/src/ts-compiler/SdTsCompiler.ts +815 -0
- package/src/ts-compiler/sd-ts-compiler-options.ts +46 -0
- package/src/ts-compiler/sd-ts-compiler-result.ts +34 -0
- package/src/utils/copy-public.ts +9 -6
- package/src/utils/diagnostic-utils.ts +8 -9
- package/src/utils/output-utils.ts +38 -8
- package/src/workers/client.worker.ts +141 -126
- package/src/workers/incremental-mtime-tracker.ts +68 -0
- package/src/workers/library-build.worker.ts +214 -75
- package/src/workers/server-build.worker.ts +31 -61
- package/src/workers/server-esbuild-context.ts +14 -2
- package/tests/angular/fixtures/packages/basic-app/dist/styles.css +3 -0
- package/tests/angular/fixtures/packages/basic-app/scss/styles.scss +5 -0
- package/tests/angular/ngtsc-build-core.acc.spec.ts +210 -0
- package/tests/angular/ngtsc-build-core.spec.ts +52 -0
- package/tests/angular/vite-angular-plugin-sdtscompiler.verify.md +13 -0
- package/tests/angular/web-worker-transformer.spec.ts +154 -0
- package/tests/capacitor/capacitor-build.spec.ts +1 -1
- package/tests/capacitor/capacitor-icon.spec.ts +1 -1
- package/tests/capacitor/capacitor-init.spec.ts +1 -1
- package/tests/commands/check.spec.ts +90 -104
- package/tests/commands/publish.spec.ts +12 -4
- package/tests/commands/slice3-severity-cleanup.verify.md +12 -0
- package/tests/commands/version-upgrade.acc.spec.ts +210 -0
- package/tests/commands/version-upgrade.spec.ts +148 -0
- package/tests/deps/replace-deps/collect-deps.acc.spec.ts +62 -0
- package/tests/deps/replace-deps/collect-deps.spec.ts +49 -0
- package/tests/deps/replace-deps/replace-deps-filter.spec.ts +103 -0
- package/tests/deps/replace-deps/replace-deps-perf.verify.md +15 -0
- package/tests/deps/replace-deps/replace-deps-resolve.acc.spec.ts +124 -0
- package/tests/deps/replace-deps/replace-deps-setup.acc.spec.ts +156 -0
- package/tests/electron/electron.spec.ts +4 -1
- package/tests/engines/engine-adapter-isolation.spec.ts +5 -6
- package/tests/engines/engine-duplicate-output-removal.verify.md +10 -0
- package/tests/engines/esbuild-client-engine.acc.spec.ts +79 -0
- package/tests/engines/esbuild-client-engine.spec.ts +73 -3
- package/tests/esbuild/esbuild-angular-compiler-plugin-hmr.verify.md +23 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin-onload.verify.md +21 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin-onstart-extraction.verify.md +16 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin-sdtscompiler.verify.md +15 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin-stylesheet.verify.md +31 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin-worker.verify.md +31 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin.spec.ts +397 -0
- package/tests/esbuild/esbuild-angular-compiler-plugin.verify.md +21 -0
- package/tests/esbuild/esbuild-postcss-plugin-chunking.verify.md +17 -0
- package/tests/esbuild/esbuild-postcss-plugin.acc.spec.ts +152 -0
- package/tests/esbuild/esbuild-tsc-plugin-imports.verify.md +13 -0
- package/tests/esbuild/esbuild-tsc-plugin.acc.spec.ts +56 -111
- package/tests/esbuild/esbuild-tsc-plugin.spec.ts +116 -52
- package/tests/esbuild/file-reference-tracker.spec.ts +99 -0
- package/tests/esbuild/lmdb-cache-store.spec.ts +58 -0
- package/tests/esbuild/load-result-cache.acc.spec.ts +55 -0
- package/tests/esbuild/load-result-cache.spec.ts +133 -0
- package/tests/orchestrators/build-orchestrator.spec.ts +4 -3
- package/tests/orchestrators/dev-orchestrator.spec.ts +5 -5
- package/tests/orchestrators/slice1-stdout-to-consola.verify.md +10 -0
- package/tests/orchestrators/typecheck-orchestrator.spec.ts +1 -1
- package/tests/orchestrators/watch-orchestrator.spec.ts +7 -7
- package/tests/runtime/result-collector.spec.ts +64 -0
- package/tests/sd-cli-entry.spec.ts +3 -4
- package/tests/sd-cli-log-tag.verify.md +11 -0
- package/tests/ts-compiler/SdTsCompiler-affected-files.verify.md +8 -0
- package/tests/ts-compiler/SdTsCompiler-diagnostics.verify.md +12 -0
- package/tests/ts-compiler/SdTsCompiler-emit.verify.md +9 -0
- package/tests/ts-compiler/SdTsCompiler.acc.spec.ts +603 -0
- package/tests/ts-compiler/SdTsCompiler.spec.ts +265 -0
- package/tests/ts-compiler/SdTsCompiler.verify.md +41 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck-browser.tsbuildinfo +1 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck-node.tsbuildinfo +1 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/.cache/typecheck.tsbuildinfo +1 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/src/index.ts +3 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/src/util.ts +3 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/tests/sample.test-file.ts +3 -0
- package/tests/ts-compiler/fixtures/non-angular-pkg/tsconfig.json +12 -0
- package/tests/ts-compiler/scss-lint-integration.verify.md +14 -0
- package/tests/utils/angular-build.spec.ts +1 -1
- package/tests/utils/copy-public-outdir.verify.md +8 -0
- package/tests/utils/copy-public.acc.spec.ts +52 -0
- package/tests/utils/copy-public.spec.ts +56 -0
- package/tests/utils/diagnostic-utils.spec.ts +24 -15
- package/tests/utils/engine-watch-events.acc.spec.ts +59 -0
- package/tests/utils/engine-watch-events.spec.ts +58 -0
- package/tests/utils/esbuild-client-config-integration.verify.md +9 -0
- package/tests/utils/esbuild-client-config.acc.spec.ts +45 -61
- package/tests/utils/esbuild-client-config.spec.ts +70 -52
- package/tests/utils/ngtsc-build-core-write-emit.spec.ts +136 -12
- package/tests/utils/ngtsc-build-core.spec.ts +1 -44
- package/tests/utils/output-utils.spec.ts +133 -13
- package/tests/utils/replace-deps-watch.acc.spec.ts +7 -1
- package/tests/utils/replace-deps-watch.spec.ts +57 -1
- package/tests/utils/worker-utils.spec.ts +8 -2
- package/tests/workers/client-worker-initial-build-error.verify.md +2 -3
- package/tests/workers/client-worker-initial-build-warnings.verify.md +7 -0
- package/tests/workers/client-worker-mtime-incremental.verify.md +10 -0
- package/tests/workers/client-worker-refactor.verify.md +22 -0
- package/tests/workers/client-worker-ts-cache-invalidation.verify.md +12 -0
- package/tests/workers/client-worker.acc.spec.ts +6 -3
- package/tests/workers/incremental-mtime-tracker.acc.spec.ts +144 -0
- package/tests/workers/incremental-mtime-tracker.spec.ts +102 -0
- package/tests/workers/library-build-lint.spec.ts +40 -45
- package/tests/workers/library-build-worker.spec.ts +298 -40
- package/tests/workers/server-build-lint.spec.ts +59 -45
- package/tests/workers/server-build-worker.spec.ts +63 -24
- package/tests/workers/server-esbuild-context.acc.spec.ts +2 -0
- package/tests/workers/server-esbuild-context.spec.ts +2 -0
- package/tests/workers/server-runtime-worker.spec.ts +1 -1
- package/tests/workers/shared-worker-lifecycle.acc.spec.ts +1 -1
- package/dist/angular/angular-build-pipeline.d.ts +0 -97
- package/dist/angular/angular-build-pipeline.d.ts.map +0 -1
- package/dist/angular/angular-build-pipeline.js +0 -285
- package/dist/angular/angular-build-pipeline.js.map +0 -1
- package/dist/utils/tsc-build.d.ts +0 -51
- package/dist/utils/tsc-build.d.ts.map +0 -1
- package/dist/utils/tsc-build.js +0 -156
- package/dist/utils/tsc-build.js.map +0 -1
- package/dist/workers/ngtsc-build.worker.d.ts +0 -23
- package/dist/workers/ngtsc-build.worker.d.ts.map +0 -1
- package/dist/workers/ngtsc-build.worker.js +0 -267
- package/dist/workers/ngtsc-build.worker.js.map +0 -1
- package/src/angular/angular-build-pipeline.ts +0 -406
- package/src/utils/tsc-build.ts +0 -226
- package/src/workers/ngtsc-build.worker.ts +0 -351
- package/tests/angular/angular-build-pipeline.spec.ts +0 -247
- package/tests/angular/angular-compiler-aot.acc.spec.ts +0 -68
- package/tests/angular/angular-compiler-aot.spec.ts +0 -80
- package/tests/utils/angular-compiler-emit.spec.ts +0 -666
- package/tests/utils/angular-compiler.spec.ts +0 -707
- package/tests/utils/tsc-build.spec.ts +0 -527
- package/tests/workers/ngtsc-build-lint.spec.ts +0 -141
- package/tests/workers/ngtsc-build-worker.spec.ts +0 -199
|
@@ -3,12 +3,9 @@ import path from "path";
|
|
|
3
3
|
import ts from "typescript";
|
|
4
4
|
import { consola } from "consola";
|
|
5
5
|
import { pathx } from "@simplysm/core-node";
|
|
6
|
+
import { SdTsCompiler } from "../ts-compiler/SdTsCompiler.js";
|
|
6
7
|
import { AngularSourceFileCache } from "./angular-compiler.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
AngularBuildPipeline,
|
|
10
|
-
type PipelineDiagnosticResult,
|
|
11
|
-
} from "./angular-build-pipeline.js";
|
|
8
|
+
import type { SerializedDiagnostic } from "../typecheck/typecheck-serialization.js";
|
|
12
9
|
|
|
13
10
|
const logger = consola.withTag("sd:cli:angular");
|
|
14
11
|
|
|
@@ -21,13 +18,16 @@ export interface SdAngularPluginOptions {
|
|
|
21
18
|
/**
|
|
22
19
|
* Angular AOT 컴파일을 수행하는 Vite 플러그인 (Vitest 전용).
|
|
23
20
|
*
|
|
24
|
-
*
|
|
21
|
+
* SdTsCompiler로 패키지의 .ts 파일을 AOT 컴파일하고,
|
|
25
22
|
* transform 훅에서 컴파일된 JS를 반환한다.
|
|
26
23
|
*/
|
|
27
24
|
export function sdAngularPlugin(options: SdAngularPluginOptions): Plugin {
|
|
28
|
-
let
|
|
25
|
+
let sdTsCompiler: SdTsCompiler | undefined;
|
|
29
26
|
let sourceFileCache: AngularSourceFileCache | undefined;
|
|
30
27
|
|
|
28
|
+
/** emit된 파일 맵 (posix 소스 경로 → 컴파일된 JS 내용) */
|
|
29
|
+
const emittedFilesBySource = new Map<string, string>();
|
|
30
|
+
|
|
31
31
|
/** Vitest watch 모드에서 변경된 파일 경로를 수집한다. buildStart 재호출 시 캐시 무효화에 사용. */
|
|
32
32
|
const pendingWatchChanges = new Set<string>();
|
|
33
33
|
|
|
@@ -51,60 +51,57 @@ export function sdAngularPlugin(options: SdAngularPluginOptions): Plugin {
|
|
|
51
51
|
}
|
|
52
52
|
logger.debug("sdAngularPlugin buildStart 시작");
|
|
53
53
|
|
|
54
|
-
// tsconfig 로드
|
|
55
|
-
const tsconfigPath = path.join(resolvedPkgDir, "tsconfig.json");
|
|
56
|
-
const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
|
57
|
-
const parsed = ts.parseJsonConfigFileContent(configFile.config, ts.sys, resolvedPkgDir);
|
|
58
|
-
logger.debug(`tsconfig 파싱 완료: ${parsed.fileNames.length}개 파일`);
|
|
59
|
-
|
|
60
54
|
// AngularSourceFileCache 생성 (또는 재사용)
|
|
61
55
|
sourceFileCache ??= new AngularSourceFileCache();
|
|
62
56
|
|
|
63
|
-
// Vitest watch 재빌드: 변경된
|
|
64
|
-
let
|
|
57
|
+
// Vitest watch 재빌드: 변경된 파일 수집
|
|
58
|
+
let modifiedFiles: ReadonlySet<string> | undefined;
|
|
65
59
|
if (pendingWatchChanges.size > 0) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
sourceFileCache.invalidate(pendingWatchChanges);
|
|
60
|
+
logger.debug(`watch 변경 파일 ${pendingWatchChanges.size}개`);
|
|
61
|
+
modifiedFiles = new Set(pendingWatchChanges);
|
|
69
62
|
pendingWatchChanges.clear();
|
|
70
63
|
}
|
|
71
64
|
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// Pipeline 초기화 — 이미 초기화됐고 변경 파일이 없으면 건너뜀
|
|
97
|
-
if (pipeline.getEmittedFiles().size > 0 && !hadPendingChanges) {
|
|
98
|
-
logger.debug("Pipeline 이미 초기화됨, 변경 없음 — buildStart 건너뜀");
|
|
65
|
+
// SdTsCompiler 생성 (최초 또는 buildEnd 후 재시작)
|
|
66
|
+
if (sdTsCompiler == null) {
|
|
67
|
+
emittedFilesBySource.clear();
|
|
68
|
+
sdTsCompiler = new SdTsCompiler({
|
|
69
|
+
pkgDir: resolvedPkgDir,
|
|
70
|
+
cwd: process.cwd(),
|
|
71
|
+
output: { js: true, dts: false },
|
|
72
|
+
sourceFileCache,
|
|
73
|
+
compilerOptionsTransformer: (opts) => ({
|
|
74
|
+
...opts,
|
|
75
|
+
noEmit: false,
|
|
76
|
+
declaration: false,
|
|
77
|
+
declarationMap: false,
|
|
78
|
+
removeComments: false,
|
|
79
|
+
sourceMap: false,
|
|
80
|
+
inlineSourceMap: true,
|
|
81
|
+
rootDir: process.cwd(),
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// 이미 초기화됐고 변경 파일이 없으면 건너뜀
|
|
87
|
+
if (emittedFilesBySource.size > 0 && modifiedFiles == null) {
|
|
88
|
+
logger.debug("이미 초기화됨, 변경 없음 — buildStart 건너뜀");
|
|
99
89
|
return;
|
|
100
90
|
}
|
|
101
|
-
|
|
91
|
+
|
|
92
|
+
// compileAsync
|
|
93
|
+
const result = await sdTsCompiler.compileAsync(modifiedFiles);
|
|
94
|
+
|
|
95
|
+
// emitResults → emittedFilesBySource 매핑
|
|
96
|
+
for (const { sourceFileName, contents } of result.emitResults ?? []) {
|
|
97
|
+
emittedFilesBySource.set(pathx.posix(sourceFileName), contents);
|
|
98
|
+
}
|
|
102
99
|
|
|
103
100
|
// 진단 보고
|
|
104
|
-
reportDiagnostics(
|
|
101
|
+
reportDiagnostics(result.diagnostics, result.program);
|
|
105
102
|
|
|
106
103
|
// SCSS 에러 보고
|
|
107
|
-
for (const err of
|
|
104
|
+
for (const err of result.scssErrors) {
|
|
108
105
|
logger.error(err);
|
|
109
106
|
}
|
|
110
107
|
},
|
|
@@ -113,11 +110,11 @@ export function sdAngularPlugin(options: SdAngularPluginOptions): Plugin {
|
|
|
113
110
|
// query param 제거
|
|
114
111
|
const cleanId = id.split("?")[0];
|
|
115
112
|
|
|
116
|
-
//
|
|
113
|
+
// emit된 .ts 파일만 처리
|
|
117
114
|
if (!cleanId.endsWith(".ts")) return;
|
|
118
115
|
|
|
119
116
|
const normalizedId = pathx.posix(cleanId);
|
|
120
|
-
const emittedContent =
|
|
117
|
+
const emittedContent = emittedFilesBySource.get(normalizedId);
|
|
121
118
|
if (emittedContent == null) return;
|
|
122
119
|
|
|
123
120
|
// 인라인 소스맵 분리 (Vite 호환)
|
|
@@ -135,24 +132,33 @@ export function sdAngularPlugin(options: SdAngularPluginOptions): Plugin {
|
|
|
135
132
|
},
|
|
136
133
|
|
|
137
134
|
buildEnd() {
|
|
138
|
-
|
|
135
|
+
sdTsCompiler = undefined;
|
|
139
136
|
},
|
|
140
137
|
};
|
|
141
138
|
}
|
|
142
139
|
|
|
143
|
-
function reportDiagnostics(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
140
|
+
function reportDiagnostics(
|
|
141
|
+
diagnostics: readonly SerializedDiagnostic[],
|
|
142
|
+
program: ts.Program,
|
|
143
|
+
): void {
|
|
144
|
+
for (const d of diagnostics) {
|
|
145
|
+
let loc = "";
|
|
146
|
+
if (d.file != null) {
|
|
147
|
+
loc = d.file.fileName;
|
|
148
|
+
if (d.start != null) {
|
|
149
|
+
const sf = program.getSourceFile(d.file.fileName);
|
|
150
|
+
if (sf != null) {
|
|
151
|
+
const pos = sf.getLineAndCharacterOfPosition(d.start);
|
|
152
|
+
loc += `:${pos.line + 1}`;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const prefix = loc !== "" ? `(${loc}) ` : "";
|
|
158
|
+
if (d.category === ts.DiagnosticCategory.Error) {
|
|
159
|
+
logger.error(`${prefix}${d.messageText}`);
|
|
160
|
+
} else if (d.category === ts.DiagnosticCategory.Warning) {
|
|
161
|
+
logger.warn(`${prefix}${d.messageText}`);
|
|
162
|
+
}
|
|
157
163
|
}
|
|
158
164
|
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Web Worker/SharedWorker의 `new Worker(new URL('path', import.meta.url))` 패턴을
|
|
5
|
+
* 감지하여 fileProcessor로 번들된 경로로 치환하는 TypeScript transformer를 생성한다.
|
|
6
|
+
*
|
|
7
|
+
* @angular/build의 web-worker-transformer.js 원본을 이식한 구현.
|
|
8
|
+
*/
|
|
9
|
+
export function createWorkerTransformer(
|
|
10
|
+
fileProcessor: (workerFile: string, containingFile: string) => string,
|
|
11
|
+
): ts.TransformerFactory<ts.SourceFile> {
|
|
12
|
+
return (context) => {
|
|
13
|
+
const nodeFactory = context.factory;
|
|
14
|
+
|
|
15
|
+
const visitNode = (node: ts.Node): ts.Node => {
|
|
16
|
+
// new Worker(...) 또는 new SharedWorker(...) 감지
|
|
17
|
+
if (
|
|
18
|
+
!ts.isNewExpression(node) ||
|
|
19
|
+
!ts.isIdentifier(node.expression) ||
|
|
20
|
+
(node.expression.text !== "Worker" && node.expression.text !== "SharedWorker")
|
|
21
|
+
) {
|
|
22
|
+
return ts.visitEachChild(node, visitNode, context);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Worker 인자: 1개 또는 2개
|
|
26
|
+
if (node.arguments == null || node.arguments.length < 1 || node.arguments.length > 2) {
|
|
27
|
+
return node;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 첫 인자: new URL(...)
|
|
31
|
+
const workerUrlNode = node.arguments[0];
|
|
32
|
+
if (
|
|
33
|
+
!ts.isNewExpression(workerUrlNode) ||
|
|
34
|
+
!ts.isIdentifier(workerUrlNode.expression) ||
|
|
35
|
+
workerUrlNode.expression.text !== "URL"
|
|
36
|
+
) {
|
|
37
|
+
return node;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// URL 인자: 정확히 2개
|
|
41
|
+
if (workerUrlNode.arguments == null || workerUrlNode.arguments.length !== 2) {
|
|
42
|
+
return node;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// URL 첫 인자: 문자열 리터럴
|
|
46
|
+
if (!ts.isStringLiteralLike(workerUrlNode.arguments[0])) {
|
|
47
|
+
return node;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// URL 둘째 인자: import.meta.url
|
|
51
|
+
const secondArg = workerUrlNode.arguments[1];
|
|
52
|
+
if (
|
|
53
|
+
!ts.isPropertyAccessExpression(secondArg) ||
|
|
54
|
+
!ts.isMetaProperty(secondArg.expression) ||
|
|
55
|
+
secondArg.name.text !== "url"
|
|
56
|
+
) {
|
|
57
|
+
return node;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const filePath = workerUrlNode.arguments[0].text;
|
|
61
|
+
const importer = node.getSourceFile().fileName;
|
|
62
|
+
|
|
63
|
+
// fileProcessor 호출
|
|
64
|
+
const replacementPath = fileProcessor(filePath, importer);
|
|
65
|
+
|
|
66
|
+
// 경로가 변경되지 않았으면 원본 유지
|
|
67
|
+
if (replacementPath === filePath) {
|
|
68
|
+
return node;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// AST 치환
|
|
72
|
+
return nodeFactory.updateNewExpression(
|
|
73
|
+
node,
|
|
74
|
+
node.expression,
|
|
75
|
+
node.typeArguments,
|
|
76
|
+
ts.setTextRange(
|
|
77
|
+
nodeFactory.createNodeArray(
|
|
78
|
+
[
|
|
79
|
+
// URL 인자 치환
|
|
80
|
+
nodeFactory.updateNewExpression(
|
|
81
|
+
workerUrlNode,
|
|
82
|
+
workerUrlNode.expression,
|
|
83
|
+
workerUrlNode.typeArguments,
|
|
84
|
+
ts.setTextRange(
|
|
85
|
+
nodeFactory.createNodeArray(
|
|
86
|
+
[nodeFactory.createStringLiteral(replacementPath), workerUrlNode.arguments[1]],
|
|
87
|
+
workerUrlNode.arguments.hasTrailingComma,
|
|
88
|
+
),
|
|
89
|
+
workerUrlNode.arguments,
|
|
90
|
+
),
|
|
91
|
+
),
|
|
92
|
+
// 두 번째 인자: 기존 options가 있으면 유지, 없으면 { type: 'module' } 추가
|
|
93
|
+
node.arguments.length > 1
|
|
94
|
+
? node.arguments[1]
|
|
95
|
+
: nodeFactory.createObjectLiteralExpression([
|
|
96
|
+
nodeFactory.createPropertyAssignment(
|
|
97
|
+
"type",
|
|
98
|
+
nodeFactory.createStringLiteral("module"),
|
|
99
|
+
),
|
|
100
|
+
]),
|
|
101
|
+
],
|
|
102
|
+
node.arguments.hasTrailingComma,
|
|
103
|
+
),
|
|
104
|
+
node.arguments,
|
|
105
|
+
),
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return (sourceFile) => {
|
|
110
|
+
// 'Worker' 문자열이 없으면 변환을 건너뛴다
|
|
111
|
+
if (!sourceFile.text.includes("Worker")) {
|
|
112
|
+
return sourceFile;
|
|
113
|
+
}
|
|
114
|
+
return ts.visitEachChild(sourceFile, visitNode, context);
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -95,7 +95,7 @@ export class Capacitor {
|
|
|
95
95
|
* 5. cap sync 또는 cap copy 실행
|
|
96
96
|
*/
|
|
97
97
|
async initialize(): Promise<void> {
|
|
98
|
-
Capacitor._logger.
|
|
98
|
+
Capacitor._logger.start("initialize 중...");
|
|
99
99
|
await this._acquireLock();
|
|
100
100
|
|
|
101
101
|
try {
|
|
@@ -152,8 +152,8 @@ export class Capacitor {
|
|
|
152
152
|
}
|
|
153
153
|
} finally {
|
|
154
154
|
await this._releaseLock();
|
|
155
|
-
Capacitor._logger.debug("initialize 완료");
|
|
156
155
|
}
|
|
156
|
+
Capacitor._logger.success("initialize 완료");
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
//#region Private - 명령어 실행
|
|
@@ -278,6 +278,7 @@ export class Capacitor {
|
|
|
278
278
|
* 3. cap run — 기기에서 앱 실행
|
|
279
279
|
*/
|
|
280
280
|
async run(url: string): Promise<void> {
|
|
281
|
+
Capacitor._logger.start(`run 중... (url: ${url})`);
|
|
281
282
|
Capacitor._logger.debug(`server.url 설정: ${url}`);
|
|
282
283
|
await updateServerUrl(this._capPath, url);
|
|
283
284
|
|
|
@@ -321,6 +322,7 @@ export class Capacitor {
|
|
|
321
322
|
throw err;
|
|
322
323
|
}
|
|
323
324
|
}
|
|
325
|
+
Capacitor._logger.success("run 완료");
|
|
324
326
|
}
|
|
325
327
|
|
|
326
328
|
//#endregion
|
|
@@ -336,7 +338,7 @@ export class Capacitor {
|
|
|
336
338
|
* 4. 빌드 산출물 복사
|
|
337
339
|
*/
|
|
338
340
|
async build(outPath: string): Promise<void> {
|
|
339
|
-
Capacitor._logger.
|
|
341
|
+
Capacitor._logger.start("build 중...");
|
|
340
342
|
|
|
341
343
|
// 1. 웹 에셋 동기화
|
|
342
344
|
Capacitor._logger.debug("cap copy 시작");
|
|
@@ -380,7 +382,7 @@ export class Capacitor {
|
|
|
380
382
|
);
|
|
381
383
|
Capacitor._logger.debug("빌드 산출물 복사 완료");
|
|
382
384
|
|
|
383
|
-
Capacitor._logger.
|
|
385
|
+
Capacitor._logger.success("build 완료");
|
|
384
386
|
}
|
|
385
387
|
|
|
386
388
|
//#endregion
|
package/src/commands/check.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { cpx } from "@simplysm/core-node";
|
|
2
1
|
import { err as errNs } from "@simplysm/core-common";
|
|
3
2
|
import { executeTypecheck, type TypecheckResult } from "../orchestrators/TypecheckOrchestrator";
|
|
4
3
|
import { executeLint, type LintResult } from "../lint/lint-core";
|
|
@@ -8,7 +7,7 @@ import { runLintInWorker } from "../lint/lint-utils";
|
|
|
8
7
|
|
|
9
8
|
//#region Types
|
|
10
9
|
|
|
11
|
-
export type CheckType = "typecheck" | "lint"
|
|
10
|
+
export type CheckType = "typecheck" | "lint";
|
|
12
11
|
|
|
13
12
|
export interface CheckOptions {
|
|
14
13
|
targets: string[];
|
|
@@ -26,62 +25,6 @@ interface CheckResult {
|
|
|
26
25
|
|
|
27
26
|
//#endregion
|
|
28
27
|
|
|
29
|
-
//#region Utilities
|
|
30
|
-
|
|
31
|
-
async function spawnVitest(targets: string[]): Promise<CheckResult> {
|
|
32
|
-
const logger = consola.withTag("sd:cli:test");
|
|
33
|
-
try {
|
|
34
|
-
const args = ["vitest", ...targets, "--run"];
|
|
35
|
-
logger.debug("vitest 실행", { args });
|
|
36
|
-
logger.start("테스트 실행 중...");
|
|
37
|
-
const result = await cpx.spawn("pnpm", args, {
|
|
38
|
-
cwd: process.cwd(),
|
|
39
|
-
reject: false,
|
|
40
|
-
stdio: "inherit",
|
|
41
|
-
});
|
|
42
|
-
const code = result.exitCode;
|
|
43
|
-
|
|
44
|
-
logger.success("테스트 실행 완료");
|
|
45
|
-
logger.info("테스트 완료", { errorCount: code === 0 ? 0 : 1, warningCount: 0 });
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
name: "TEST",
|
|
49
|
-
success: code === 0,
|
|
50
|
-
errorCount: code === 0 ? 0 : 1,
|
|
51
|
-
warningCount: 0,
|
|
52
|
-
formattedOutput: "",
|
|
53
|
-
};
|
|
54
|
-
} catch (err) {
|
|
55
|
-
logger.fail("테스트 실행 실패");
|
|
56
|
-
return {
|
|
57
|
-
name: "TEST",
|
|
58
|
-
success: false,
|
|
59
|
-
errorCount: 1,
|
|
60
|
-
warningCount: 0,
|
|
61
|
-
formattedOutput: errNs.message(err),
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function formatSection(result: CheckResult): string {
|
|
67
|
-
const header = `\n${"=".repeat(6)} ${result.name} ${"=".repeat(6)}`;
|
|
68
|
-
const icon = result.success ? "✔" : "✖";
|
|
69
|
-
|
|
70
|
-
let summary: string;
|
|
71
|
-
if (result.name === "TEST") {
|
|
72
|
-
const testCount = result.errorCount > 0 ? `${result.errorCount}개 실패` : "";
|
|
73
|
-
summary = result.success ? `${icon} 통과` : `${icon} ${testCount}`;
|
|
74
|
-
} else {
|
|
75
|
-
summary = `${icon} ${result.errorCount}개 에러, ${result.warningCount}개 경고`;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const detail = !result.success && result.formattedOutput ? `\n${result.formattedOutput}` : "";
|
|
79
|
-
|
|
80
|
-
return `${header}\n${summary}${detail}`;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
//#endregion
|
|
84
|
-
|
|
85
28
|
//#region Main
|
|
86
29
|
|
|
87
30
|
export async function runCheck(options: CheckOptions): Promise<void> {
|
|
@@ -102,8 +45,7 @@ export async function runCheck(options: CheckOptions): Promise<void> {
|
|
|
102
45
|
|
|
103
46
|
const needsTypecheck = types.includes("typecheck");
|
|
104
47
|
const needsLint = types.includes("lint");
|
|
105
|
-
|
|
106
|
-
logger.debug("체크 구성", { needsTypecheck, needsLint, needsTest });
|
|
48
|
+
logger.debug("체크 구성", { needsTypecheck, needsLint });
|
|
107
49
|
|
|
108
50
|
logger.start(`체크 실행 중... (${types.join(", ")})`);
|
|
109
51
|
|
|
@@ -177,11 +119,6 @@ export async function runCheck(options: CheckOptions): Promise<void> {
|
|
|
177
119
|
);
|
|
178
120
|
}
|
|
179
121
|
|
|
180
|
-
// 테스트 (서브프로세스)
|
|
181
|
-
if (needsTest) {
|
|
182
|
-
tasks.push(spawnVitest(normalizedTargets));
|
|
183
|
-
}
|
|
184
|
-
|
|
185
122
|
const results = await Promise.allSettled(tasks);
|
|
186
123
|
logger.success("체크 실행 완료");
|
|
187
124
|
|
|
@@ -200,12 +137,20 @@ export async function runCheck(options: CheckOptions): Promise<void> {
|
|
|
200
137
|
}];
|
|
201
138
|
});
|
|
202
139
|
|
|
203
|
-
// 섹션별 출력 (순서 보장: typecheck → lint
|
|
204
|
-
const order = ["TYPECHECK", "LINT"
|
|
140
|
+
// 섹션별 출력 (순서 보장: typecheck → lint)
|
|
141
|
+
const order = ["TYPECHECK", "LINT"];
|
|
205
142
|
checkResults.sort((a, b) => order.indexOf(a.name) - order.indexOf(b.name));
|
|
206
143
|
|
|
207
144
|
for (const result of checkResults) {
|
|
208
|
-
|
|
145
|
+
const header = `${result.name}: ${result.errorCount}개 에러, ${result.warningCount}개 경고`;
|
|
146
|
+
if (result.success) {
|
|
147
|
+
logger.success(header);
|
|
148
|
+
} else {
|
|
149
|
+
logger.error(header);
|
|
150
|
+
if (result.formattedOutput !== "") {
|
|
151
|
+
logger.error(result.formattedOutput);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
209
154
|
}
|
|
210
155
|
|
|
211
156
|
// 요약
|
|
@@ -213,17 +158,13 @@ export async function runCheck(options: CheckOptions): Promise<void> {
|
|
|
213
158
|
const totalErrors = checkResults.reduce((sum, r) => sum + r.errorCount, 0);
|
|
214
159
|
const totalWarnings = checkResults.reduce((sum, r) => sum + r.warningCount, 0);
|
|
215
160
|
|
|
216
|
-
process.stdout.write(`\n\n${"=".repeat(6)} 요약 ${"=".repeat(6)}\n`);
|
|
217
|
-
|
|
218
161
|
if (failed.length === 0) {
|
|
219
|
-
|
|
162
|
+
logger.success(`전체 통과 — 합계: ${totalErrors}개 에러, ${totalWarnings}개 경고`);
|
|
220
163
|
} else {
|
|
221
164
|
const failedNames = failed.map((r) => r.name.toLowerCase()).join(", ");
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (failed.length > 0) {
|
|
165
|
+
logger.error(
|
|
166
|
+
`${failed.length}/${checkResults.length}개 실패 (${failedNames}) — 합계: ${totalErrors}개 에러, ${totalWarnings}개 경고`,
|
|
167
|
+
);
|
|
227
168
|
process.exitCode = 1;
|
|
228
169
|
}
|
|
229
170
|
}
|
|
@@ -63,17 +63,21 @@ export async function runDeployment(
|
|
|
63
63
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
64
64
|
try {
|
|
65
65
|
await publishPackage(pkg.path, pkg.config, version, projectPath, logger, dryRun);
|
|
66
|
-
|
|
66
|
+
if (dryRun) {
|
|
67
|
+
logger.info(`[DRY-RUN] ${pkg.name}`);
|
|
68
|
+
} else {
|
|
69
|
+
logger.debug(pkg.name);
|
|
70
|
+
}
|
|
67
71
|
publishedPackages.push(pkg.name);
|
|
68
72
|
return { status: "success" as const, name: pkg.name };
|
|
69
73
|
} catch (err) {
|
|
70
74
|
if (attempt < maxRetries) {
|
|
71
75
|
const delay = attempt * 5_000;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
if (dryRun) {
|
|
77
|
+
logger.info(`[DRY-RUN] ${pkg.name} (retry ${attempt + 1}/${maxRetries})`);
|
|
78
|
+
} else {
|
|
79
|
+
logger.debug(`${pkg.name} (retry ${attempt + 1}/${maxRetries})`);
|
|
80
|
+
}
|
|
77
81
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
78
82
|
} else {
|
|
79
83
|
throw err;
|
|
@@ -95,7 +99,7 @@ export async function runDeployment(
|
|
|
95
99
|
for (const r of rejectedResults) {
|
|
96
100
|
logger.error(r.reason instanceof Error ? r.reason.message : r.reason);
|
|
97
101
|
}
|
|
98
|
-
logger.
|
|
102
|
+
logger.error(`Level ${levelIdx + 1}/${levels.length}`);
|
|
99
103
|
} else {
|
|
100
104
|
logger.success(`Level ${levelIdx + 1}/${levels.length}`);
|
|
101
105
|
}
|
|
@@ -15,7 +15,7 @@ export async function publishNpm(
|
|
|
15
15
|
const prereleaseInfo = semver.prerelease(version);
|
|
16
16
|
const args = ["publish", "--access", "public", "--no-git-checks"];
|
|
17
17
|
|
|
18
|
-
if (prereleaseInfo
|
|
18
|
+
if (prereleaseInfo != null && typeof prereleaseInfo[0] === "string") {
|
|
19
19
|
args.push("--tag", prereleaseInfo[0]);
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -33,7 +33,7 @@ export async function upgradeVersion(
|
|
|
33
33
|
|
|
34
34
|
// 프리릴리스 여부에 따라 증가 전략 결정
|
|
35
35
|
const newVersion =
|
|
36
|
-
prereleaseInfo
|
|
36
|
+
prereleaseInfo != null
|
|
37
37
|
? semver.inc(currentVersion, "prerelease")!
|
|
38
38
|
: semver.inc(currentVersion, "patch")!;
|
|
39
39
|
|
|
@@ -46,28 +46,35 @@ export async function upgradeVersion(
|
|
|
46
46
|
await fsx.write(projPkgPath, json.stringify(projPkg, { space: 2 }) + "\n");
|
|
47
47
|
changedFiles.push(projPkgPath);
|
|
48
48
|
|
|
49
|
-
// 각 패키지의 package.json에 버전 설정
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
// 각 패키지의 package.json에 버전 설정 (병렬)
|
|
50
|
+
const pkgChangedFiles = await Promise.all(
|
|
51
|
+
allPkgPaths.map(async (pkgPath) => {
|
|
52
|
+
const pkgJsonPath = path.resolve(pkgPath, "package.json");
|
|
53
|
+
const pkgJson = await fsx.readJson<PackageJson>(pkgJsonPath);
|
|
54
|
+
pkgJson.version = newVersion;
|
|
55
|
+
await fsx.write(pkgJsonPath, json.stringify(pkgJson, { space: 2 }) + "\n");
|
|
56
|
+
return pkgJsonPath;
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
changedFiles.push(...pkgChangedFiles);
|
|
57
60
|
|
|
58
61
|
// 템플릿 파일의 @simplysm 패키지 버전 동기화
|
|
59
62
|
const templateFiles = await fsx.glob(path.resolve(cwd, "packages/sd-cli/templates/**/*.hbs"));
|
|
60
63
|
const versionRegex = /("@simplysm\/[^"]+"\s*:\s*)"~[^"]+"/g;
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
const templateChangedFiles = await Promise.all(
|
|
66
|
+
templateFiles.map(async (templatePath) => {
|
|
67
|
+
const content = await fsx.read(templatePath);
|
|
68
|
+
const newContent = content.replace(versionRegex, `$1"~${newVersion}"`);
|
|
65
69
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
if (content !== newContent) {
|
|
71
|
+
await fsx.write(templatePath, newContent);
|
|
72
|
+
return templatePath;
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
changedFiles.push(...templateChangedFiles.filter((f) => f != null));
|
|
71
78
|
|
|
72
79
|
return { version: newVersion, changedFiles };
|
|
73
80
|
}
|
|
@@ -81,25 +88,27 @@ export async function computePublishLevels<T extends { name: string; path: strin
|
|
|
81
88
|
): Promise<T[][]> {
|
|
82
89
|
const pkgNames = new Set(publishPkgs.map((p) => p.name));
|
|
83
90
|
|
|
84
|
-
// 각 패키지의 워크스페이스 의존성 수집
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
// 각 패키지의 워크스페이스 의존성 수집 (병렬)
|
|
92
|
+
const depsEntries = await Promise.all(
|
|
93
|
+
publishPkgs.map(async (pkg) => {
|
|
94
|
+
const pkgJson = await fsx.readJson<PackageJson>(path.resolve(pkg.path, "package.json"));
|
|
95
|
+
const allDeps = {
|
|
96
|
+
...pkgJson.dependencies,
|
|
97
|
+
...pkgJson.peerDependencies,
|
|
98
|
+
...pkgJson.optionalDependencies,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const workspaceDeps = new Set<string>();
|
|
102
|
+
for (const depName of Object.keys(allDeps)) {
|
|
103
|
+
const shortName = depName.replace(/^@simplysm\//, "");
|
|
104
|
+
if (shortName !== depName && pkgNames.has(shortName)) {
|
|
105
|
+
workspaceDeps.add(shortName);
|
|
106
|
+
}
|
|
99
107
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
return [pkg.name, workspaceDeps] as const;
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
111
|
+
const depsMap = new Map(depsEntries);
|
|
103
112
|
|
|
104
113
|
// 위상 정렬로 레벨 분류
|
|
105
114
|
const levels: T[][] = [];
|