@simplysm/sd-cli 12.16.24 → 13.0.0-beta.11
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/README.md +529 -0
- package/dist/builders/BaseBuilder.js +86 -0
- package/dist/builders/BaseBuilder.js.map +7 -0
- package/dist/builders/DtsBuilder.js +109 -0
- package/dist/builders/DtsBuilder.js.map +7 -0
- package/dist/builders/LibraryBuilder.js +122 -0
- package/dist/builders/LibraryBuilder.js.map +7 -0
- package/dist/builders/index.js +9 -0
- package/dist/builders/index.js.map +7 -0
- package/dist/builders/types.js +1 -0
- package/dist/builders/types.js.map +7 -0
- package/dist/capacitor/capacitor.js +619 -0
- package/dist/capacitor/capacitor.js.map +7 -0
- package/dist/commands/add-client.js +83 -0
- package/dist/commands/add-client.js.map +7 -0
- package/dist/commands/add-server.js +91 -0
- package/dist/commands/add-server.js.map +7 -0
- package/dist/commands/build.js +310 -0
- package/dist/commands/build.js.map +7 -0
- package/dist/commands/dev.js +426 -0
- package/dist/commands/dev.js.map +7 -0
- package/dist/commands/device.js +107 -0
- package/dist/commands/device.js.map +7 -0
- package/dist/commands/init.js +58 -0
- package/dist/commands/init.js.map +7 -0
- package/dist/commands/lint.js +138 -0
- package/dist/commands/lint.js.map +7 -0
- package/dist/commands/publish.js +401 -0
- package/dist/commands/publish.js.map +7 -0
- package/dist/commands/typecheck.js +197 -0
- package/dist/commands/typecheck.js.map +7 -0
- package/dist/commands/watch.js +19 -0
- package/dist/commands/watch.js.map +7 -0
- package/dist/core-common/src/common.types.d.ts +74 -0
- package/dist/core-common/src/common.types.d.ts.map +1 -0
- package/dist/core-common/src/env.d.ts +6 -0
- package/dist/core-common/src/env.d.ts.map +1 -0
- package/dist/core-common/src/errors/argument-error.d.ts +25 -0
- package/dist/core-common/src/errors/argument-error.d.ts.map +1 -0
- package/dist/core-common/src/errors/not-implemented-error.d.ts +29 -0
- package/dist/core-common/src/errors/not-implemented-error.d.ts.map +1 -0
- package/dist/core-common/src/errors/sd-error.d.ts +27 -0
- package/dist/core-common/src/errors/sd-error.d.ts.map +1 -0
- package/dist/core-common/src/errors/timeout-error.d.ts +31 -0
- package/dist/core-common/src/errors/timeout-error.d.ts.map +1 -0
- package/dist/core-common/src/extensions/arr-ext.d.ts +15 -0
- package/dist/core-common/src/extensions/arr-ext.d.ts.map +1 -0
- package/dist/core-common/src/extensions/arr-ext.helpers.d.ts +19 -0
- package/dist/core-common/src/extensions/arr-ext.helpers.d.ts.map +1 -0
- package/dist/core-common/src/extensions/arr-ext.types.d.ts +215 -0
- package/dist/core-common/src/extensions/arr-ext.types.d.ts.map +1 -0
- package/dist/core-common/src/extensions/map-ext.d.ts +57 -0
- package/dist/core-common/src/extensions/map-ext.d.ts.map +1 -0
- package/dist/core-common/src/extensions/set-ext.d.ts +36 -0
- package/dist/core-common/src/extensions/set-ext.d.ts.map +1 -0
- package/dist/core-common/src/features/debounce-queue.d.ts +53 -0
- package/dist/core-common/src/features/debounce-queue.d.ts.map +1 -0
- package/dist/core-common/src/features/event-emitter.d.ts +66 -0
- package/dist/core-common/src/features/event-emitter.d.ts.map +1 -0
- package/dist/core-common/src/features/serial-queue.d.ts +47 -0
- package/dist/core-common/src/features/serial-queue.d.ts.map +1 -0
- package/dist/core-common/src/index.d.ts +32 -0
- package/dist/core-common/src/index.d.ts.map +1 -0
- package/dist/core-common/src/types/date-only.d.ts +152 -0
- package/dist/core-common/src/types/date-only.d.ts.map +1 -0
- package/dist/core-common/src/types/date-time.d.ts +96 -0
- package/dist/core-common/src/types/date-time.d.ts.map +1 -0
- package/dist/core-common/src/types/lazy-gc-map.d.ts +80 -0
- package/dist/core-common/src/types/lazy-gc-map.d.ts.map +1 -0
- package/dist/core-common/src/types/time.d.ts +68 -0
- package/dist/core-common/src/types/time.d.ts.map +1 -0
- package/dist/core-common/src/types/uuid.d.ts +35 -0
- package/dist/core-common/src/types/uuid.d.ts.map +1 -0
- package/dist/core-common/src/utils/bytes.d.ts +51 -0
- package/dist/core-common/src/utils/bytes.d.ts.map +1 -0
- package/dist/core-common/src/utils/date-format.d.ts +90 -0
- package/dist/core-common/src/utils/date-format.d.ts.map +1 -0
- package/dist/core-common/src/utils/json.d.ts +34 -0
- package/dist/core-common/src/utils/json.d.ts.map +1 -0
- package/dist/core-common/src/utils/num.d.ts +60 -0
- package/dist/core-common/src/utils/num.d.ts.map +1 -0
- package/dist/core-common/src/utils/obj.d.ts +258 -0
- package/dist/core-common/src/utils/obj.d.ts.map +1 -0
- package/dist/core-common/src/utils/path.d.ts +23 -0
- package/dist/core-common/src/utils/path.d.ts.map +1 -0
- package/dist/core-common/src/utils/primitive.d.ts +18 -0
- package/dist/core-common/src/utils/primitive.d.ts.map +1 -0
- package/dist/core-common/src/utils/str.d.ts +103 -0
- package/dist/core-common/src/utils/str.d.ts.map +1 -0
- package/dist/core-common/src/utils/template-strings.d.ts +84 -0
- package/dist/core-common/src/utils/template-strings.d.ts.map +1 -0
- package/dist/core-common/src/utils/transferable.d.ts +47 -0
- package/dist/core-common/src/utils/transferable.d.ts.map +1 -0
- package/dist/core-common/src/utils/wait.d.ts +19 -0
- package/dist/core-common/src/utils/wait.d.ts.map +1 -0
- package/dist/core-common/src/utils/xml.d.ts +36 -0
- package/dist/core-common/src/utils/xml.d.ts.map +1 -0
- package/dist/core-common/src/zip/sd-zip.d.ts +80 -0
- package/dist/core-common/src/zip/sd-zip.d.ts.map +1 -0
- package/dist/core-node/src/features/fs-watcher.d.ts +70 -0
- package/dist/core-node/src/features/fs-watcher.d.ts.map +1 -0
- package/dist/core-node/src/index.d.ts +7 -0
- package/dist/core-node/src/index.d.ts.map +1 -0
- package/dist/core-node/src/utils/fs.d.ts +197 -0
- package/dist/core-node/src/utils/fs.d.ts.map +1 -0
- package/dist/core-node/src/utils/path.d.ts +75 -0
- package/dist/core-node/src/utils/path.d.ts.map +1 -0
- package/dist/core-node/src/worker/create-worker.d.ts +23 -0
- package/dist/core-node/src/worker/create-worker.d.ts.map +1 -0
- package/dist/core-node/src/worker/types.d.ts +67 -0
- package/dist/core-node/src/worker/types.d.ts.map +1 -0
- package/dist/core-node/src/worker/worker.d.ts +27 -0
- package/dist/core-node/src/worker/worker.d.ts.map +1 -0
- package/dist/electron/electron.js +242 -0
- package/dist/electron/electron.js.map +7 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +7 -0
- package/dist/infra/ResultCollector.js +59 -0
- package/dist/infra/ResultCollector.js.map +7 -0
- package/dist/infra/SignalHandler.js +44 -0
- package/dist/infra/SignalHandler.js.map +7 -0
- package/dist/infra/WorkerManager.js +56 -0
- package/dist/infra/WorkerManager.js.map +7 -0
- package/dist/infra/index.js +9 -0
- package/dist/infra/index.js.map +7 -0
- package/dist/orchestrators/WatchOrchestrator.js +135 -0
- package/dist/orchestrators/WatchOrchestrator.js.map +7 -0
- package/dist/orchestrators/index.js +5 -0
- package/dist/orchestrators/index.js.map +7 -0
- package/dist/sd-cli/src/builders/BaseBuilder.d.ts +77 -0
- package/dist/sd-cli/src/builders/BaseBuilder.d.ts.map +1 -0
- package/dist/sd-cli/src/builders/DtsBuilder.d.ts +22 -0
- package/dist/sd-cli/src/builders/DtsBuilder.d.ts.map +1 -0
- package/dist/sd-cli/src/builders/LibraryBuilder.d.ts +22 -0
- package/dist/sd-cli/src/builders/LibraryBuilder.d.ts.map +1 -0
- package/dist/sd-cli/src/builders/index.d.ts +5 -0
- package/dist/sd-cli/src/builders/index.d.ts.map +1 -0
- package/dist/sd-cli/src/builders/types.d.ts +49 -0
- package/dist/sd-cli/src/builders/types.d.ts.map +1 -0
- package/dist/sd-cli/src/capacitor/capacitor.d.ts +131 -0
- package/dist/sd-cli/src/capacitor/capacitor.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/add-client.d.ts +18 -0
- package/dist/sd-cli/src/commands/add-client.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/add-server.d.ts +18 -0
- package/dist/sd-cli/src/commands/add-server.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/build.d.ts +25 -0
- package/dist/sd-cli/src/commands/build.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/dev.d.ts +23 -0
- package/dist/sd-cli/src/commands/dev.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/device.d.ts +22 -0
- package/dist/sd-cli/src/commands/device.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/init.d.ts +15 -0
- package/dist/sd-cli/src/commands/init.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/lint.d.ts +31 -0
- package/dist/sd-cli/src/commands/lint.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/publish.d.ts +27 -0
- package/dist/sd-cli/src/commands/publish.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/typecheck.d.ts +39 -0
- package/dist/sd-cli/src/commands/typecheck.d.ts.map +1 -0
- package/dist/sd-cli/src/commands/watch.d.ts +20 -0
- package/dist/sd-cli/src/commands/watch.d.ts.map +1 -0
- package/dist/sd-cli/src/electron/electron.d.ts +79 -0
- package/dist/sd-cli/src/electron/electron.d.ts.map +1 -0
- package/dist/sd-cli/src/index.d.ts +2 -0
- package/dist/sd-cli/src/index.d.ts.map +1 -0
- package/dist/sd-cli/src/infra/ResultCollector.d.ts +56 -0
- package/dist/sd-cli/src/infra/ResultCollector.d.ts.map +1 -0
- package/dist/sd-cli/src/infra/SignalHandler.d.ts +26 -0
- package/dist/sd-cli/src/infra/SignalHandler.d.ts.map +1 -0
- package/dist/sd-cli/src/infra/WorkerManager.d.ts +40 -0
- package/dist/sd-cli/src/infra/WorkerManager.d.ts.map +1 -0
- package/dist/sd-cli/src/infra/index.d.ts +4 -0
- package/dist/sd-cli/src/infra/index.d.ts.map +1 -0
- package/dist/sd-cli/src/orchestrators/WatchOrchestrator.d.ts +48 -0
- package/dist/sd-cli/src/orchestrators/WatchOrchestrator.d.ts.map +1 -0
- package/dist/sd-cli/src/orchestrators/index.d.ts +2 -0
- package/dist/sd-cli/src/orchestrators/index.d.ts.map +1 -0
- package/dist/sd-cli/src/sd-cli.d.ts +9 -0
- package/dist/sd-cli/src/sd-cli.d.ts.map +1 -0
- package/dist/sd-cli/src/sd-config.types.d.ts +222 -0
- package/dist/sd-cli/src/sd-config.types.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/build-env.d.ts +5 -0
- package/dist/sd-cli/src/utils/build-env.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/config-editor.d.ts +17 -0
- package/dist/sd-cli/src/utils/config-editor.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/esbuild-config.d.ts +49 -0
- package/dist/sd-cli/src/utils/esbuild-config.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/listr-manager.d.ts +37 -0
- package/dist/sd-cli/src/utils/listr-manager.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/output-utils.d.ts +21 -0
- package/dist/sd-cli/src/utils/output-utils.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/package-utils.d.ts +29 -0
- package/dist/sd-cli/src/utils/package-utils.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/sd-config.d.ts +12 -0
- package/dist/sd-cli/src/utils/sd-config.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/spawn.d.ts +26 -0
- package/dist/sd-cli/src/utils/spawn.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/tailwind-config-deps.d.ts +8 -0
- package/dist/sd-cli/src/utils/tailwind-config-deps.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/template.d.ts +14 -0
- package/dist/sd-cli/src/utils/template.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/tsconfig.d.ts +35 -0
- package/dist/sd-cli/src/utils/tsconfig.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/typecheck-serialization.d.ts +28 -0
- package/dist/sd-cli/src/utils/typecheck-serialization.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/vite-config.d.ts +25 -0
- package/dist/sd-cli/src/utils/vite-config.d.ts.map +1 -0
- package/dist/sd-cli/src/utils/worker-events.d.ts +53 -0
- package/dist/sd-cli/src/utils/worker-events.d.ts.map +1 -0
- package/dist/sd-cli/src/workers/client.worker.d.ts +82 -0
- package/dist/sd-cli/src/workers/client.worker.d.ts.map +1 -0
- package/dist/sd-cli/src/workers/dts.worker.d.ts +73 -0
- package/dist/sd-cli/src/workers/dts.worker.d.ts.map +1 -0
- package/dist/sd-cli/src/workers/library.worker.d.ts +73 -0
- package/dist/sd-cli/src/workers/library.worker.d.ts.map +1 -0
- package/dist/sd-cli/src/workers/server-runtime.worker.d.ts +40 -0
- package/dist/sd-cli/src/workers/server-runtime.worker.d.ts.map +1 -0
- package/dist/sd-cli/src/workers/server.worker.d.ts +76 -0
- package/dist/sd-cli/src/workers/server.worker.d.ts.map +1 -0
- package/dist/sd-cli.js +239 -76
- package/dist/sd-cli.js.map +7 -0
- package/dist/sd-config.types.js +1 -0
- package/dist/sd-config.types.js.map +7 -0
- package/dist/storage/src/clients/ftp-storage-client.d.ts +56 -0
- package/dist/storage/src/clients/ftp-storage-client.d.ts.map +1 -0
- package/dist/storage/src/clients/sftp-storage-client.d.ts +48 -0
- package/dist/storage/src/clients/sftp-storage-client.d.ts.map +1 -0
- package/dist/storage/src/index.d.ts +7 -0
- package/dist/storage/src/index.d.ts.map +1 -0
- package/dist/storage/src/storage-factory.d.ts +20 -0
- package/dist/storage/src/storage-factory.d.ts.map +1 -0
- package/dist/storage/src/types/storage-conn-config.d.ts +7 -0
- package/dist/storage/src/types/storage-conn-config.d.ts.map +1 -0
- package/dist/storage/src/types/storage-type.d.ts +2 -0
- package/dist/storage/src/types/storage-type.d.ts.map +1 -0
- package/dist/storage/src/types/storage.d.ts +19 -0
- package/dist/storage/src/types/storage.d.ts.map +1 -0
- package/dist/utils/build-env.js +12 -0
- package/dist/utils/build-env.js.map +7 -0
- package/dist/utils/config-editor.js +77 -0
- package/dist/utils/config-editor.js.map +7 -0
- package/dist/utils/esbuild-config.js +44 -0
- package/dist/utils/esbuild-config.js.map +7 -0
- package/dist/utils/listr-manager.js +59 -0
- package/dist/utils/listr-manager.js.map +7 -0
- package/dist/utils/output-utils.js +40 -0
- package/dist/utils/output-utils.js.map +7 -0
- package/dist/utils/package-utils.js +28 -0
- package/dist/utils/package-utils.js.map +7 -0
- package/dist/utils/sd-config.js +24 -0
- package/dist/utils/sd-config.js.map +7 -0
- package/dist/utils/spawn.js +49 -0
- package/dist/utils/spawn.js.map +7 -0
- package/dist/utils/tailwind-config-deps.js +80 -0
- package/dist/utils/tailwind-config-deps.js.map +7 -0
- package/dist/utils/template.js +28 -0
- package/dist/utils/template.js.map +7 -0
- package/dist/utils/tsconfig.js +62 -0
- package/dist/utils/tsconfig.js.map +7 -0
- package/dist/utils/typecheck-serialization.js +46 -0
- package/dist/utils/typecheck-serialization.js.map +7 -0
- package/dist/utils/vite-config.js +108 -0
- package/dist/utils/vite-config.js.map +7 -0
- package/dist/utils/worker-events.js +38 -0
- package/dist/utils/worker-events.js.map +7 -0
- package/dist/workers/client.worker.js +94 -0
- package/dist/workers/client.worker.js.map +7 -0
- package/dist/workers/dts.worker.js +210 -0
- package/dist/workers/dts.worker.js.map +7 -0
- package/dist/workers/library.worker.js +118 -0
- package/dist/workers/library.worker.js.map +7 -0
- package/dist/workers/server-runtime.worker.js +85 -0
- package/dist/workers/server-runtime.worker.js.map +7 -0
- package/dist/workers/server.worker.js +114 -42
- package/dist/workers/server.worker.js.map +7 -0
- package/package.json +32 -29
- package/dist/entry/SdCliAiCommand.d.ts +0 -3
- package/dist/entry/SdCliAiCommand.js +0 -91
- package/dist/entry/SdCliCapacitor.d.ts +0 -35
- package/dist/entry/SdCliCapacitor.js +0 -565
- package/dist/entry/SdCliCordova.d.ts +0 -49
- package/dist/entry/SdCliCordova.js +0 -394
- package/dist/entry/SdCliElectron.d.ts +0 -22
- package/dist/entry/SdCliElectron.js +0 -128
- package/dist/entry/SdCliLocalUpdate.d.ts +0 -11
- package/dist/entry/SdCliLocalUpdate.js +0 -83
- package/dist/entry/SdCliPostInstall.d.ts +0 -3
- package/dist/entry/SdCliPostInstall.js +0 -48
- package/dist/entry/SdCliProject.d.ts +0 -24
- package/dist/entry/SdCliProject.js +0 -336
- package/dist/pkg-builders/SdBuildRunnerBase.d.ts +0 -14
- package/dist/pkg-builders/SdBuildRunnerBase.js +0 -22
- package/dist/pkg-builders/SdProjectBuildRunner.d.ts +0 -25
- package/dist/pkg-builders/SdProjectBuildRunner.js +0 -264
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.d.ts +0 -9
- package/dist/pkg-builders/client/SdCliNgRoutesFileGenerator.js +0 -89
- package/dist/pkg-builders/client/SdClientBuildRunner.d.ts +0 -10
- package/dist/pkg-builders/client/SdClientBuildRunner.js +0 -113
- package/dist/pkg-builders/client/SdNgBundler.d.ts +0 -38
- package/dist/pkg-builders/client/SdNgBundler.js +0 -525
- package/dist/pkg-builders/client/SdNgBundlerContext.d.ts +0 -25
- package/dist/pkg-builders/client/SdNgBundlerContext.js +0 -104
- package/dist/pkg-builders/client/createSdNgPlugin.d.ts +0 -5
- package/dist/pkg-builders/client/createSdNgPlugin.js +0 -133
- package/dist/pkg-builders/commons/SdWorkerPathPlugin.d.ts +0 -2
- package/dist/pkg-builders/commons/SdWorkerPathPlugin.js +0 -91
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.d.ts +0 -9
- package/dist/pkg-builders/lib/SdCliDbContextFileGenerator.js +0 -138
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.d.ts +0 -11
- package/dist/pkg-builders/lib/SdCliIndexFileGenerator.js +0 -79
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.d.ts +0 -8
- package/dist/pkg-builders/lib/SdJsLibBuildRunner.js +0 -44
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.d.ts +0 -8
- package/dist/pkg-builders/lib/SdTsLibBuildRunner.js +0 -34
- package/dist/pkg-builders/lib/SdTsLibBuilder.d.ts +0 -10
- package/dist/pkg-builders/lib/SdTsLibBuilder.js +0 -54
- package/dist/pkg-builders/server/SdServerBuildRunner.d.ts +0 -10
- package/dist/pkg-builders/server/SdServerBuildRunner.js +0 -228
- package/dist/pkg-builders/server/SdServerBundler.d.ts +0 -17
- package/dist/pkg-builders/server/SdServerBundler.js +0 -174
- package/dist/pkg-builders/server/createSdServerPlugin.d.ts +0 -5
- package/dist/pkg-builders/server/createSdServerPlugin.js +0 -53
- package/dist/sd-cli-entry.d.ts +0 -2
- package/dist/sd-cli-entry.js +0 -230
- package/dist/sd-cli.d.ts +0 -2
- package/dist/ts-compiler/ScopePathSet.d.ts +0 -7
- package/dist/ts-compiler/ScopePathSet.js +0 -12
- package/dist/ts-compiler/SdDepAnalyzer.d.ts +0 -15
- package/dist/ts-compiler/SdDepAnalyzer.js +0 -299
- package/dist/ts-compiler/SdDepCache.d.ts +0 -77
- package/dist/ts-compiler/SdDepCache.js +0 -248
- package/dist/ts-compiler/SdStyleBundler.d.ts +0 -23
- package/dist/ts-compiler/SdStyleBundler.js +0 -131
- package/dist/ts-compiler/SdTsCompiler.d.ts +0 -29
- package/dist/ts-compiler/SdTsCompiler.js +0 -420
- package/dist/types/build/ISdBuildMessage.d.ts +0 -10
- package/dist/types/build/ISdBuildMessage.js +0 -1
- package/dist/types/build/ISdBuildResult.d.ts +0 -8
- package/dist/types/build/ISdBuildResult.js +0 -1
- package/dist/types/build/ISdTsCompilerOptions.d.ts +0 -10
- package/dist/types/build/ISdTsCompilerOptions.js +0 -1
- package/dist/types/build/ISdTsCompilerResult.d.ts +0 -14
- package/dist/types/build/ISdTsCompilerResult.js +0 -1
- package/dist/types/build/TStylesheetBundlingResult.d.ts +0 -12
- package/dist/types/build/TStylesheetBundlingResult.js +0 -1
- package/dist/types/common-config/INpmConfig.d.ts +0 -17
- package/dist/types/common-config/INpmConfig.js +0 -1
- package/dist/types/common-config/ITsConfig.d.ts +0 -7
- package/dist/types/common-config/ITsConfig.js +0 -1
- package/dist/types/config/ISdProjectConfig.d.ts +0 -144
- package/dist/types/config/ISdProjectConfig.js +0 -1
- package/dist/types/plugin/ISdCliNgPluginResultCache.d.ts +0 -8
- package/dist/types/plugin/ISdCliNgPluginResultCache.js +0 -1
- package/dist/types/plugin/ISdCliServerPluginResultCache.d.ts +0 -8
- package/dist/types/plugin/ISdCliServerPluginResultCache.js +0 -1
- package/dist/types/worker/ISdBuildRunnerWorkerType.d.ts +0 -20
- package/dist/types/worker/ISdBuildRunnerWorkerType.js +0 -1
- package/dist/types/worker/IServerWorkerType.d.ts +0 -17
- package/dist/types/worker/IServerWorkerType.js +0 -1
- package/dist/utils/SdCliConvertMessageUtils.d.ts +0 -21
- package/dist/utils/SdCliConvertMessageUtils.js +0 -138
- package/dist/utils/SdCliPerformanceTimer.d.ts +0 -10
- package/dist/utils/SdCliPerformanceTimer.js +0 -50
- package/dist/utils/loadProjConfAsync.d.ts +0 -5
- package/dist/utils/loadProjConfAsync.js +0 -7
- package/dist/workers/build-runner.worker.d.ts +0 -1
- package/dist/workers/build-runner.worker.js +0 -37
- package/dist/workers/server.worker.d.ts +0 -1
- package/lib/cordova-entry.js +0 -29
- package/src/entry/SdCliAiCommand.ts +0 -105
- package/src/entry/SdCliCapacitor.ts +0 -760
- package/src/entry/SdCliCordova.ts +0 -550
- package/src/entry/SdCliElectron.ts +0 -197
- package/src/entry/SdCliLocalUpdate.ts +0 -106
- package/src/entry/SdCliPostInstall.ts +0 -51
- package/src/entry/SdCliProject.ts +0 -427
- package/src/pkg-builders/SdBuildRunnerBase.ts +0 -36
- package/src/pkg-builders/SdProjectBuildRunner.ts +0 -398
- package/src/pkg-builders/client/SdCliNgRoutesFileGenerator.ts +0 -112
- package/src/pkg-builders/client/SdClientBuildRunner.ts +0 -156
- package/src/pkg-builders/client/SdNgBundler.ts +0 -666
- package/src/pkg-builders/client/SdNgBundlerContext.ts +0 -138
- package/src/pkg-builders/client/createSdNgPlugin.ts +0 -186
- package/src/pkg-builders/commons/SdWorkerPathPlugin.ts +0 -117
- package/src/pkg-builders/lib/SdCliDbContextFileGenerator.ts +0 -177
- package/src/pkg-builders/lib/SdCliIndexFileGenerator.ts +0 -94
- package/src/pkg-builders/lib/SdJsLibBuildRunner.ts +0 -59
- package/src/pkg-builders/lib/SdTsLibBuildRunner.ts +0 -47
- package/src/pkg-builders/lib/SdTsLibBuilder.ts +0 -71
- package/src/pkg-builders/server/SdServerBuildRunner.ts +0 -299
- package/src/pkg-builders/server/SdServerBundler.ts +0 -208
- package/src/pkg-builders/server/createSdServerPlugin.ts +0 -80
- package/src/sd-cli-entry.ts +0 -292
- package/src/sd-cli.ts +0 -105
- package/src/ts-compiler/ScopePathSet.ts +0 -17
- package/src/ts-compiler/SdDepAnalyzer.ts +0 -372
- package/src/ts-compiler/SdDepCache.ts +0 -304
- package/src/ts-compiler/SdStyleBundler.ts +0 -169
- package/src/ts-compiler/SdTsCompiler.ts +0 -638
- package/src/types/build/ISdBuildMessage.ts +0 -11
- package/src/types/build/ISdBuildResult.ts +0 -9
- package/src/types/build/ISdTsCompilerOptions.ts +0 -11
- package/src/types/build/ISdTsCompilerResult.ts +0 -12
- package/src/types/build/TStylesheetBundlingResult.ts +0 -15
- package/src/types/common-config/INpmConfig.ts +0 -24
- package/src/types/common-config/ITsConfig.ts +0 -5
- package/src/types/config/ISdProjectConfig.ts +0 -174
- package/src/types/plugin/ISdCliNgPluginResultCache.ts +0 -9
- package/src/types/plugin/ISdCliServerPluginResultCache.ts +0 -9
- package/src/types/worker/ISdBuildRunnerWorkerType.ts +0 -19
- package/src/types/worker/IServerWorkerType.ts +0 -8
- package/src/utils/SdCliConvertMessageUtils.ts +0 -180
- package/src/utils/SdCliPerformanceTimer.ts +0 -62
- package/src/utils/loadProjConfAsync.ts +0 -16
- package/src/workers/build-runner.worker.ts +0 -54
- package/src/workers/server.worker.ts +0 -54
- package/tests/deps/sd-dependency-analyzer.spec.ts +0 -241
- package/tests/deps/sd-dependency-cache.spec.ts +0 -153
- package/tsconfig.json +0 -8
- package/tsconfig.test.json +0 -8
- package/vitest.config.js +0 -15
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { fsExists, fsMkdir, fsRead, fsReadJson, fsWrite, fsWriteJson, fsGlob, fsCopy, fsRm } from "@simplysm/core-node";
|
|
3
|
+
import { env } from "@simplysm/core-common";
|
|
4
|
+
import { consola } from "consola";
|
|
5
|
+
import sharp from "sharp";
|
|
6
|
+
import { spawn } from "../utils/spawn";
|
|
7
|
+
class CapacitorConfigError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = "CapacitorConfigError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
class Capacitor {
|
|
14
|
+
constructor(_pkgPath, _config, npmConfig) {
|
|
15
|
+
this._pkgPath = _pkgPath;
|
|
16
|
+
this._config = _config;
|
|
17
|
+
this._platforms = Object.keys(this._config.platform ?? {});
|
|
18
|
+
this._npmConfig = npmConfig;
|
|
19
|
+
this._capPath = path.resolve(this._pkgPath, ".capacitor");
|
|
20
|
+
}
|
|
21
|
+
static _ANDROID_KEYSTORE_FILE_NAME = "android.keystore";
|
|
22
|
+
static _LOCK_FILE_NAME = ".capacitor.lock";
|
|
23
|
+
static _logger = consola.withTag("sd:cli:capacitor");
|
|
24
|
+
_capPath;
|
|
25
|
+
_platforms;
|
|
26
|
+
_npmConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Capacitor 인스턴스 생성 (설정 검증 포함)
|
|
29
|
+
*/
|
|
30
|
+
static async create(pkgPath, config) {
|
|
31
|
+
Capacitor._validateConfig(config);
|
|
32
|
+
const npmConfig = await fsReadJson(path.resolve(pkgPath, "package.json"));
|
|
33
|
+
return new Capacitor(pkgPath, config, npmConfig);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* F5: 설정 검증
|
|
37
|
+
*/
|
|
38
|
+
static _validateConfig(config) {
|
|
39
|
+
if (typeof config.appId !== "string" || config.appId.trim() === "") {
|
|
40
|
+
throw new CapacitorConfigError("capacitor.appId\uB294 \uD544\uC218\uC785\uB2C8\uB2E4.");
|
|
41
|
+
}
|
|
42
|
+
if (!/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/i.test(config.appId)) {
|
|
43
|
+
throw new CapacitorConfigError(`capacitor.appId \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: ${config.appId}`);
|
|
44
|
+
}
|
|
45
|
+
if (typeof config.appName !== "string" || config.appName.trim() === "") {
|
|
46
|
+
throw new CapacitorConfigError("capacitor.appName\uC740 \uD544\uC218\uC785\uB2C8\uB2E4.");
|
|
47
|
+
}
|
|
48
|
+
if (config.platform != null) {
|
|
49
|
+
const platforms = Object.keys(config.platform);
|
|
50
|
+
for (const p of platforms) {
|
|
51
|
+
if (p !== "android") {
|
|
52
|
+
throw new CapacitorConfigError(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD50C\uB7AB\uD3FC: ${p} (\uD604\uC7AC android\uB9CC \uC9C0\uC6D0)`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 명령어 실행 (로깅 포함)
|
|
59
|
+
*/
|
|
60
|
+
async _exec(cmd, args, cwd) {
|
|
61
|
+
Capacitor._logger.debug(`\uC2E4\uD589 \uBA85\uB839: ${cmd} ${args.join(" ")}`);
|
|
62
|
+
const result = await spawn(cmd, args, { cwd });
|
|
63
|
+
Capacitor._logger.debug(`\uC2E4\uD589 \uACB0\uACFC: ${result}`);
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* F10: 동시 실행 방지를 위한 잠금 획득
|
|
68
|
+
*/
|
|
69
|
+
async _acquireLock() {
|
|
70
|
+
const lockPath = path.resolve(this._capPath, Capacitor._LOCK_FILE_NAME);
|
|
71
|
+
if (await fsExists(lockPath)) {
|
|
72
|
+
const lockContent = await fsRead(lockPath);
|
|
73
|
+
throw new Error(
|
|
74
|
+
`\uB2E4\uB978 Capacitor \uC791\uC5C5\uC774 \uC9C4\uD589 \uC911\uC785\uB2C8\uB2E4 (PID: ${lockContent}). \uBB38\uC81C\uAC00 \uC788\uB2E4\uBA74 ${lockPath} \uD30C\uC77C\uC744 \uC0AD\uC81C\uD558\uC138\uC694.`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
await fsMkdir(this._capPath);
|
|
78
|
+
await fsWrite(lockPath, String(process.pid));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* F10: 잠금 해제
|
|
82
|
+
*/
|
|
83
|
+
async _releaseLock() {
|
|
84
|
+
const lockPath = path.resolve(this._capPath, Capacitor._LOCK_FILE_NAME);
|
|
85
|
+
await fsRm(lockPath);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* F4: 외부 도구 검증
|
|
89
|
+
*/
|
|
90
|
+
async _validateTools() {
|
|
91
|
+
const sdkPath = await this._findAndroidSdk();
|
|
92
|
+
if (sdkPath == null) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
"Android SDK\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.\n1. Android Studio\uB97C \uC124\uCE58\uD558\uAC70\uB098\n2. ANDROID_HOME \uB610\uB294 ANDROID_SDK_ROOT \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694."
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
if (this._platforms.includes("android")) {
|
|
98
|
+
const javaPath = await this._findJava21();
|
|
99
|
+
if (javaPath == null) {
|
|
100
|
+
Capacitor._logger.warn("Java 21\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. Gradle\uC774 \uB0B4\uC7A5 JDK\uB97C \uC0AC\uC6A9\uD558\uAC70\uB098 \uBE4C\uB4DC\uAC00 \uC2E4\uD328\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Capacitor 프로젝트 초기화
|
|
106
|
+
*
|
|
107
|
+
* 1. package.json 생성 및 의존성 설치
|
|
108
|
+
* 2. capacitor.config.ts 생성
|
|
109
|
+
* 3. 플랫폼 추가 (android)
|
|
110
|
+
* 4. 아이콘 설정
|
|
111
|
+
* 5. Android 네이티브 설정
|
|
112
|
+
* 6. cap sync 또는 cap copy 실행
|
|
113
|
+
*/
|
|
114
|
+
async initialize() {
|
|
115
|
+
await this._acquireLock();
|
|
116
|
+
try {
|
|
117
|
+
await this._validateTools();
|
|
118
|
+
const changed = await this._initCap();
|
|
119
|
+
await this._writeCapConf();
|
|
120
|
+
await this._addPlatforms();
|
|
121
|
+
await this._setupIcon();
|
|
122
|
+
if (this._platforms.includes("android")) {
|
|
123
|
+
await this._configureAndroid();
|
|
124
|
+
}
|
|
125
|
+
if (changed) {
|
|
126
|
+
await this._exec("npx", ["cap", "sync"], this._capPath);
|
|
127
|
+
} else {
|
|
128
|
+
await this._exec("npx", ["cap", "copy"], this._capPath);
|
|
129
|
+
}
|
|
130
|
+
} finally {
|
|
131
|
+
await this._releaseLock();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Android APK/AAB 빌드
|
|
136
|
+
*/
|
|
137
|
+
async build(outPath) {
|
|
138
|
+
await this._acquireLock();
|
|
139
|
+
try {
|
|
140
|
+
const buildType = this._config.debug ? "debug" : "release";
|
|
141
|
+
for (const platform of this._platforms) {
|
|
142
|
+
await this._exec("npx", ["cap", "copy", platform], this._capPath);
|
|
143
|
+
if (platform === "android") {
|
|
144
|
+
await this._buildAndroid(outPath, buildType);
|
|
145
|
+
} else {
|
|
146
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD50C\uB7AB\uD3FC: ${platform}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
} finally {
|
|
150
|
+
await this._releaseLock();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* 디바이스에서 앱 실행 (WebView를 개발 서버로 연결)
|
|
155
|
+
*/
|
|
156
|
+
async runOnDevice(url) {
|
|
157
|
+
if (url != null) {
|
|
158
|
+
this._validateUrl(url);
|
|
159
|
+
await this._updateServerUrl(url);
|
|
160
|
+
}
|
|
161
|
+
for (const platform of this._platforms) {
|
|
162
|
+
await this._exec("npx", ["cap", "copy", platform], this._capPath);
|
|
163
|
+
try {
|
|
164
|
+
await this._exec("npx", ["cap", "run", platform], this._capPath);
|
|
165
|
+
} catch (err) {
|
|
166
|
+
if (platform === "android") {
|
|
167
|
+
try {
|
|
168
|
+
await this._exec("adb", ["kill-server"], this._capPath);
|
|
169
|
+
} catch {
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
throw err;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* F11: URL 검증
|
|
178
|
+
*/
|
|
179
|
+
_validateUrl(url) {
|
|
180
|
+
try {
|
|
181
|
+
const parsed = new URL(url);
|
|
182
|
+
if (!["http:", "https:"].includes(parsed.protocol)) {
|
|
183
|
+
throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD504\uB85C\uD1A0\uCF5C: ${parsed.protocol}`);
|
|
184
|
+
}
|
|
185
|
+
} catch (err) {
|
|
186
|
+
if (err instanceof TypeError) {
|
|
187
|
+
throw new Error(`\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 URL: ${url}`);
|
|
188
|
+
}
|
|
189
|
+
throw err;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
//#region Private - 초기화
|
|
193
|
+
/**
|
|
194
|
+
* Capacitor 프로젝트 기본 초기화 (package.json, npm install, cap init)
|
|
195
|
+
*/
|
|
196
|
+
async _initCap() {
|
|
197
|
+
const depChanged = await this._setupNpmConf();
|
|
198
|
+
if (!depChanged) return false;
|
|
199
|
+
const installResult = await this._exec("pnpm", ["install"], this._capPath);
|
|
200
|
+
Capacitor._logger.debug(`pnpm install \uC644\uB8CC: ${installResult}`);
|
|
201
|
+
const configPath = path.resolve(this._capPath, "capacitor.config.ts");
|
|
202
|
+
if (!await fsExists(configPath)) {
|
|
203
|
+
await this._exec("npx", ["cap", "init", this._config.appName, this._config.appId], this._capPath);
|
|
204
|
+
}
|
|
205
|
+
const wwwPath = path.resolve(this._capPath, "www");
|
|
206
|
+
await fsMkdir(wwwPath);
|
|
207
|
+
await fsWrite(path.resolve(wwwPath, "index.html"), "<!DOCTYPE html><html><head></head><body></body></html>");
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* package.json 설정
|
|
212
|
+
*/
|
|
213
|
+
async _setupNpmConf() {
|
|
214
|
+
const projNpmConfigPath = path.resolve(this._pkgPath, "../../package.json");
|
|
215
|
+
if (!await fsExists(projNpmConfigPath)) {
|
|
216
|
+
throw new Error(`\uB8E8\uD2B8 package.json\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${projNpmConfigPath}`);
|
|
217
|
+
}
|
|
218
|
+
const projNpmConfig = await fsReadJson(projNpmConfigPath);
|
|
219
|
+
const capNpmConfPath = path.resolve(this._capPath, "package.json");
|
|
220
|
+
const orgCapNpmConf = await fsExists(capNpmConfPath) ? await fsReadJson(capNpmConfPath) : { name: "", version: "" };
|
|
221
|
+
const capNpmConf = { ...orgCapNpmConf };
|
|
222
|
+
capNpmConf.name = this._config.appId;
|
|
223
|
+
capNpmConf.version = this._npmConfig.version;
|
|
224
|
+
if (projNpmConfig.volta != null) {
|
|
225
|
+
capNpmConf.volta = projNpmConfig.volta;
|
|
226
|
+
}
|
|
227
|
+
capNpmConf.dependencies = capNpmConf.dependencies ?? {};
|
|
228
|
+
capNpmConf.dependencies["@capacitor/core"] = "^7.0.0";
|
|
229
|
+
capNpmConf.dependencies["@capacitor/app"] = "^7.0.0";
|
|
230
|
+
for (const platform of this._platforms) {
|
|
231
|
+
capNpmConf.dependencies[`@capacitor/${platform}`] = "^7.0.0";
|
|
232
|
+
}
|
|
233
|
+
capNpmConf.devDependencies = capNpmConf.devDependencies ?? {};
|
|
234
|
+
capNpmConf.devDependencies["@capacitor/cli"] = "^7.0.0";
|
|
235
|
+
capNpmConf.devDependencies["@capacitor/assets"] = "^3.0.0";
|
|
236
|
+
const mainDeps = {
|
|
237
|
+
...this._npmConfig.dependencies,
|
|
238
|
+
...this._npmConfig.devDependencies,
|
|
239
|
+
...this._npmConfig.peerDependencies
|
|
240
|
+
};
|
|
241
|
+
const usePlugins = Object.keys(this._config.plugins ?? {});
|
|
242
|
+
const prevPlugins = Object.keys(capNpmConf.dependencies).filter(
|
|
243
|
+
(item) => !["@capacitor/core", "@capacitor/android", "@capacitor/ios", "@capacitor/app"].includes(item)
|
|
244
|
+
);
|
|
245
|
+
for (const prevPlugin of prevPlugins) {
|
|
246
|
+
if (!usePlugins.includes(prevPlugin)) {
|
|
247
|
+
delete capNpmConf.dependencies[prevPlugin];
|
|
248
|
+
Capacitor._logger.debug(`\uD50C\uB7EC\uADF8\uC778 \uC81C\uAC70: ${prevPlugin}`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
for (const plugin of usePlugins) {
|
|
252
|
+
if (!(plugin in capNpmConf.dependencies)) {
|
|
253
|
+
const version = mainDeps[plugin] ?? "*";
|
|
254
|
+
capNpmConf.dependencies[plugin] = version;
|
|
255
|
+
Capacitor._logger.debug(`\uD50C\uB7EC\uADF8\uC778 \uCD94\uAC00: ${plugin}@${version}`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
await fsMkdir(this._capPath);
|
|
259
|
+
await fsWriteJson(capNpmConfPath, capNpmConf, { space: 2 });
|
|
260
|
+
const isChanged = orgCapNpmConf.volta !== capNpmConf.volta || JSON.stringify(orgCapNpmConf.dependencies) !== JSON.stringify(capNpmConf.dependencies) || JSON.stringify(orgCapNpmConf.devDependencies) !== JSON.stringify(capNpmConf.devDependencies);
|
|
261
|
+
return isChanged;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* capacitor.config.ts 생성
|
|
265
|
+
*/
|
|
266
|
+
async _writeCapConf() {
|
|
267
|
+
const confPath = path.resolve(this._capPath, "capacitor.config.ts");
|
|
268
|
+
const pluginOptions = {};
|
|
269
|
+
for (const [pluginName, options] of Object.entries(this._config.plugins ?? {})) {
|
|
270
|
+
if (options !== true) {
|
|
271
|
+
const configKey = this._toPascalCase(pluginName.split("/").at(-1));
|
|
272
|
+
pluginOptions[configKey] = options;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const pluginsConfigStr = Object.keys(pluginOptions).length > 0 ? JSON.stringify(pluginOptions, null, 2).replace(/^/gm, " ").trim() : "{}";
|
|
276
|
+
const configContent = `import type { CapacitorConfig } from "@capacitor/cli";
|
|
277
|
+
|
|
278
|
+
const config: CapacitorConfig = {
|
|
279
|
+
appId: "${this._config.appId}",
|
|
280
|
+
appName: "${this._config.appName}",
|
|
281
|
+
server: {
|
|
282
|
+
androidScheme: "http",
|
|
283
|
+
cleartext: true
|
|
284
|
+
},
|
|
285
|
+
android: {},
|
|
286
|
+
plugins: ${pluginsConfigStr},
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export default config;
|
|
290
|
+
`;
|
|
291
|
+
await fsWrite(confPath, configContent);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* 플랫폼 추가 (F12: 멱등성 보장)
|
|
295
|
+
*/
|
|
296
|
+
async _addPlatforms() {
|
|
297
|
+
for (const platform of this._platforms) {
|
|
298
|
+
const platformPath = path.resolve(this._capPath, platform);
|
|
299
|
+
if (await fsExists(platformPath)) {
|
|
300
|
+
Capacitor._logger.debug(`\uD50C\uB7AB\uD3FC \uC774\uBBF8 \uC874\uC7AC: ${platform}`);
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
await this._exec("npx", ["cap", "add", platform], this._capPath);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* 아이콘 설정 (F6: 에러 복구)
|
|
308
|
+
*/
|
|
309
|
+
async _setupIcon() {
|
|
310
|
+
const assetsDirPath = path.resolve(this._capPath, "assets");
|
|
311
|
+
if (this._config.icon != null) {
|
|
312
|
+
const iconSource = path.resolve(this._pkgPath, this._config.icon);
|
|
313
|
+
if (!await fsExists(iconSource)) {
|
|
314
|
+
Capacitor._logger.warn(`\uC544\uC774\uCF58 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${iconSource}. \uAE30\uBCF8 \uC544\uC774\uCF58\uC744 \uC0AC\uC6A9\uD569\uB2C8\uB2E4.`);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
await fsMkdir(assetsDirPath);
|
|
319
|
+
const logoPath = path.resolve(assetsDirPath, "logo.png");
|
|
320
|
+
const logoSize = Math.floor(1024 * 0.6);
|
|
321
|
+
const padding = Math.floor((1024 - logoSize) / 2);
|
|
322
|
+
await sharp(iconSource).resize(logoSize, logoSize, {
|
|
323
|
+
fit: "contain",
|
|
324
|
+
background: { r: 0, g: 0, b: 0, alpha: 0 }
|
|
325
|
+
}).extend({
|
|
326
|
+
top: padding,
|
|
327
|
+
bottom: padding,
|
|
328
|
+
left: padding,
|
|
329
|
+
right: padding,
|
|
330
|
+
background: { r: 0, g: 0, b: 0, alpha: 0 }
|
|
331
|
+
}).toFile(logoPath);
|
|
332
|
+
await this._exec(
|
|
333
|
+
"npx",
|
|
334
|
+
["@capacitor/assets", "generate", "--iconBackgroundColor", "#ffffff", "--splashBackgroundColor", "#ffffff"],
|
|
335
|
+
this._capPath
|
|
336
|
+
);
|
|
337
|
+
} catch (err) {
|
|
338
|
+
Capacitor._logger.warn(
|
|
339
|
+
`\uC544\uC774\uCF58 \uC0DD\uC131 \uC2E4\uD328: ${err instanceof Error ? err.message : err}. \uAE30\uBCF8 \uC544\uC774\uCF58\uC744 \uC0AC\uC6A9\uD569\uB2C8\uB2E4.`
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
} else {
|
|
343
|
+
await fsRm(assetsDirPath);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region Private - Android 설정
|
|
348
|
+
/**
|
|
349
|
+
* Android 네이티브 설정
|
|
350
|
+
*/
|
|
351
|
+
async _configureAndroid() {
|
|
352
|
+
const androidPath = path.resolve(this._capPath, "android");
|
|
353
|
+
if (!await fsExists(androidPath)) {
|
|
354
|
+
throw new Error(`Android \uD504\uB85C\uC81D\uD2B8 \uB514\uB809\uD1A0\uB9AC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4: ${androidPath}`);
|
|
355
|
+
}
|
|
356
|
+
await this._configureAndroidJavaHomePath(androidPath);
|
|
357
|
+
await this._configureAndroidSdkPath(androidPath);
|
|
358
|
+
await this._configureAndroidManifest(androidPath);
|
|
359
|
+
await this._configureAndroidBuildGradle(androidPath);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* JAVA_HOME 경로 설정 (gradle.properties)
|
|
363
|
+
*/
|
|
364
|
+
async _configureAndroidJavaHomePath(androidPath) {
|
|
365
|
+
const gradlePropsPath = path.resolve(androidPath, "gradle.properties");
|
|
366
|
+
if (!await fsExists(gradlePropsPath)) {
|
|
367
|
+
Capacitor._logger.warn(`gradle.properties \uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4: ${gradlePropsPath}`);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
let content = await fsRead(gradlePropsPath);
|
|
371
|
+
const java21Path = await this._findJava21();
|
|
372
|
+
if (java21Path != null && !content.includes("org.gradle.java.home")) {
|
|
373
|
+
const escapedPath = java21Path.replace(/\\/g, "\\\\");
|
|
374
|
+
content += `
|
|
375
|
+
org.gradle.java.home=${escapedPath}
|
|
376
|
+
`;
|
|
377
|
+
await fsWrite(gradlePropsPath, content);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Java 21 경로 자동 탐색
|
|
382
|
+
*/
|
|
383
|
+
async _findJava21() {
|
|
384
|
+
const patterns = [
|
|
385
|
+
"C:/Program Files/Amazon Corretto/jdk21*",
|
|
386
|
+
"C:/Program Files/Eclipse Adoptium/jdk-21*",
|
|
387
|
+
"C:/Program Files/Java/jdk-21*",
|
|
388
|
+
"C:/Program Files/Microsoft/jdk-21*",
|
|
389
|
+
"/usr/lib/jvm/java-21*",
|
|
390
|
+
"/usr/lib/jvm/temurin-21*"
|
|
391
|
+
];
|
|
392
|
+
for (const pattern of patterns) {
|
|
393
|
+
const matches = await fsGlob(pattern);
|
|
394
|
+
if (matches.length > 0) {
|
|
395
|
+
return matches.sort().at(-1);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return void 0;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Android SDK 경로 설정 (local.properties)
|
|
402
|
+
*/
|
|
403
|
+
async _configureAndroidSdkPath(androidPath) {
|
|
404
|
+
const localPropsPath = path.resolve(androidPath, "local.properties");
|
|
405
|
+
const sdkPath = await this._findAndroidSdk();
|
|
406
|
+
if (sdkPath != null) {
|
|
407
|
+
await fsWrite(localPropsPath, `sdk.dir=${sdkPath.replace(/\\/g, "/")}
|
|
408
|
+
`);
|
|
409
|
+
} else {
|
|
410
|
+
throw new Error(
|
|
411
|
+
"Android SDK\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.\n1. Android Studio\uB97C \uC124\uCE58\uD558\uAC70\uB098\n2. ANDROID_HOME \uB610\uB294 ANDROID_SDK_ROOT \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694."
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Android SDK 경로 탐색
|
|
417
|
+
*/
|
|
418
|
+
async _findAndroidSdk() {
|
|
419
|
+
const fromEnv = env["ANDROID_HOME"] ?? env["ANDROID_SDK_ROOT"];
|
|
420
|
+
if (fromEnv != null && await fsExists(fromEnv)) {
|
|
421
|
+
return fromEnv;
|
|
422
|
+
}
|
|
423
|
+
const candidates = [
|
|
424
|
+
path.resolve(env["LOCALAPPDATA"] ?? "", "Android/Sdk"),
|
|
425
|
+
path.resolve(env["HOME"] ?? "", "Android/Sdk"),
|
|
426
|
+
"C:/Program Files/Android/Sdk",
|
|
427
|
+
"C:/Android/Sdk"
|
|
428
|
+
];
|
|
429
|
+
for (const candidate of candidates) {
|
|
430
|
+
if (await fsExists(candidate)) {
|
|
431
|
+
return candidate;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return void 0;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* AndroidManifest.xml 수정 (F3: 에러 처리 추가)
|
|
438
|
+
*/
|
|
439
|
+
async _configureAndroidManifest(androidPath) {
|
|
440
|
+
const manifestPath = path.resolve(androidPath, "app/src/main/AndroidManifest.xml");
|
|
441
|
+
if (!await fsExists(manifestPath)) {
|
|
442
|
+
throw new Error(`AndroidManifest.xml \uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4: ${manifestPath}`);
|
|
443
|
+
}
|
|
444
|
+
let content = await fsRead(manifestPath);
|
|
445
|
+
if (!content.includes("android:usesCleartextTraffic")) {
|
|
446
|
+
content = content.replace("<application", '<application android:usesCleartextTraffic="true"');
|
|
447
|
+
}
|
|
448
|
+
const permissions = this._config.platform?.android?.permissions ?? [];
|
|
449
|
+
for (const perm of permissions) {
|
|
450
|
+
const permTag = `<uses-permission android:name="android.permission.${perm.name}"`;
|
|
451
|
+
if (!content.includes(permTag)) {
|
|
452
|
+
const maxSdkAttr = perm.maxSdkVersion != null ? ` android:maxSdkVersion="${perm.maxSdkVersion}"` : "";
|
|
453
|
+
const ignoreAttr = perm.ignore != null ? ` tools:ignore="${perm.ignore}"` : "";
|
|
454
|
+
const permLine = ` ${permTag}${maxSdkAttr}${ignoreAttr} />
|
|
455
|
+
`;
|
|
456
|
+
if (perm.ignore != null && !content.includes("xmlns:tools=")) {
|
|
457
|
+
content = content.replace(
|
|
458
|
+
"<manifest xmlns:android",
|
|
459
|
+
'<manifest xmlns:tools="http://schemas.android.com/tools" xmlns:android'
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
content = content.replace("</manifest>", `${permLine}</manifest>`);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const appConfig = this._config.platform?.android?.config;
|
|
466
|
+
if (appConfig) {
|
|
467
|
+
for (const [key, value] of Object.entries(appConfig)) {
|
|
468
|
+
const attr = `android:${key}="${value}"`;
|
|
469
|
+
if (!content.includes(`android:${key}=`)) {
|
|
470
|
+
content = content.replace("<application", `<application ${attr}`);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
const intentFilters = this._config.platform?.android?.intentFilters ?? [];
|
|
475
|
+
for (const filter of intentFilters) {
|
|
476
|
+
const filterKey = filter.action ?? filter.category ?? "";
|
|
477
|
+
if (filterKey && !content.includes(filterKey)) {
|
|
478
|
+
const actionLine = filter.action != null ? `<action android:name="${filter.action}"/>` : "";
|
|
479
|
+
const categoryLine = filter.category != null ? `<category android:name="${filter.category}"/>` : "";
|
|
480
|
+
content = content.replace(
|
|
481
|
+
/(<activity[\s\S]*?android:name="\.MainActivity"[\s\S]*?>)/,
|
|
482
|
+
`$1
|
|
483
|
+
<intent-filter>
|
|
484
|
+
${actionLine}
|
|
485
|
+
${categoryLine}
|
|
486
|
+
</intent-filter>`
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
await fsWrite(manifestPath, content);
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* build.gradle 수정 (F3: 에러 처리 추가)
|
|
494
|
+
*/
|
|
495
|
+
async _configureAndroidBuildGradle(androidPath) {
|
|
496
|
+
const buildGradlePath = path.resolve(androidPath, "app/build.gradle");
|
|
497
|
+
if (!await fsExists(buildGradlePath)) {
|
|
498
|
+
throw new Error(`build.gradle \uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4: ${buildGradlePath}`);
|
|
499
|
+
}
|
|
500
|
+
let content = await fsRead(buildGradlePath);
|
|
501
|
+
const version = this._npmConfig.version;
|
|
502
|
+
const versionParts = version.split(".");
|
|
503
|
+
const versionCode = parseInt(versionParts[0] ?? "0") * 1e4 + parseInt(versionParts[1] ?? "0") * 100 + parseInt(versionParts[2] ?? "0");
|
|
504
|
+
content = content.replace(/versionCode \d+/, `versionCode ${versionCode}`);
|
|
505
|
+
content = content.replace(/versionName "[^"]+"/, `versionName "${version}"`);
|
|
506
|
+
if (this._config.platform?.android?.sdkVersion != null) {
|
|
507
|
+
const sdkVersion = this._config.platform.android.sdkVersion;
|
|
508
|
+
content = content.replace(/minSdkVersion .+/, `minSdkVersion ${sdkVersion}`);
|
|
509
|
+
content = content.replace(/targetSdkVersion .+/, `targetSdkVersion ${sdkVersion}`);
|
|
510
|
+
} else {
|
|
511
|
+
content = content.replace(/minSdkVersion .+/, `minSdkVersion rootProject.ext.minSdkVersion`);
|
|
512
|
+
content = content.replace(/targetSdkVersion .+/, `targetSdkVersion rootProject.ext.targetSdkVersion`);
|
|
513
|
+
}
|
|
514
|
+
const keystorePath = path.resolve(this._capPath, Capacitor._ANDROID_KEYSTORE_FILE_NAME);
|
|
515
|
+
const signConfig = this._config.platform?.android?.sign;
|
|
516
|
+
if (signConfig) {
|
|
517
|
+
const keystoreSource = path.resolve(this._pkgPath, signConfig.keystore);
|
|
518
|
+
if (!await fsExists(keystoreSource)) {
|
|
519
|
+
throw new Error(`keystore \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${keystoreSource}`);
|
|
520
|
+
}
|
|
521
|
+
await fsCopy(keystoreSource, keystorePath);
|
|
522
|
+
const keystoreRelativePath = path.relative(path.dirname(buildGradlePath), keystorePath).replace(/\\/g, "/");
|
|
523
|
+
const keystoreType = signConfig.keystoreType ?? "jks";
|
|
524
|
+
if (!content.includes("signingConfigs")) {
|
|
525
|
+
const signingConfigsBlock = `
|
|
526
|
+
signingConfigs {
|
|
527
|
+
release {
|
|
528
|
+
storeFile file("${keystoreRelativePath}")
|
|
529
|
+
storePassword '${signConfig.storePassword}'
|
|
530
|
+
keyAlias '${signConfig.alias}'
|
|
531
|
+
keyPassword '${signConfig.password}'
|
|
532
|
+
storeType "${keystoreType}"
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
`;
|
|
536
|
+
content = content.replace(/(android\s*\{)/, (match) => `${match}${signingConfigsBlock}`);
|
|
537
|
+
}
|
|
538
|
+
if (!content.includes("signingConfig signingConfigs.release")) {
|
|
539
|
+
content = content.replace(
|
|
540
|
+
/(buildTypes\s*\{[\s\S]*?release\s*\{)/,
|
|
541
|
+
`$1
|
|
542
|
+
signingConfig signingConfigs.release`
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
} else {
|
|
546
|
+
await fsRm(keystorePath);
|
|
547
|
+
}
|
|
548
|
+
await fsWrite(buildGradlePath, content);
|
|
549
|
+
}
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region Private - 빌드
|
|
552
|
+
/**
|
|
553
|
+
* Android 빌드
|
|
554
|
+
*/
|
|
555
|
+
async _buildAndroid(outPath, buildType) {
|
|
556
|
+
const androidPath = path.resolve(this._capPath, "android");
|
|
557
|
+
const targetOutPath = path.resolve(outPath, "android");
|
|
558
|
+
const isBundle = this._config.platform?.android?.bundle;
|
|
559
|
+
const gradleTask = buildType === "release" ? isBundle ? "bundleRelease" : "assembleRelease" : "assembleDebug";
|
|
560
|
+
if (process.platform === "win32") {
|
|
561
|
+
await this._exec("cmd", ["/c", "gradlew.bat", gradleTask, "--no-daemon"], androidPath);
|
|
562
|
+
} else {
|
|
563
|
+
await this._exec("sh", ["./gradlew", gradleTask, "--no-daemon"], androidPath);
|
|
564
|
+
}
|
|
565
|
+
await this._copyAndroidBuildOutput(androidPath, targetOutPath, buildType);
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Android 빌드 결과물 복사
|
|
569
|
+
*/
|
|
570
|
+
async _copyAndroidBuildOutput(androidPath, targetOutPath, buildType) {
|
|
571
|
+
const isBundle = this._config.platform?.android?.bundle;
|
|
572
|
+
const isSigned = Boolean(this._config.platform?.android?.sign);
|
|
573
|
+
const ext = isBundle ? "aab" : "apk";
|
|
574
|
+
const outputType = isBundle ? "bundle" : "apk";
|
|
575
|
+
const fileName = isSigned ? `app-${buildType}.${ext}` : `app-${buildType}-unsigned.${ext}`;
|
|
576
|
+
const sourcePath = path.resolve(androidPath, "app/build/outputs", outputType, buildType, fileName);
|
|
577
|
+
const actualPath = await fsExists(sourcePath) ? sourcePath : path.resolve(androidPath, "app/build/outputs", outputType, buildType, `app-${buildType}.${ext}`);
|
|
578
|
+
if (!await fsExists(actualPath)) {
|
|
579
|
+
Capacitor._logger.warn(`\uBE4C\uB4DC \uACB0\uACFC\uBB3C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${actualPath}`);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
const outputFileName = `${this._config.appName}${isSigned ? "" : "-unsigned"}-latest.${ext}`;
|
|
583
|
+
await fsMkdir(targetOutPath);
|
|
584
|
+
await fsCopy(actualPath, path.resolve(targetOutPath, outputFileName));
|
|
585
|
+
const updatesPath = path.resolve(targetOutPath, "updates");
|
|
586
|
+
await fsMkdir(updatesPath);
|
|
587
|
+
await fsCopy(actualPath, path.resolve(updatesPath, `${this._npmConfig.version}.${ext}`));
|
|
588
|
+
}
|
|
589
|
+
//#endregion
|
|
590
|
+
//#region Private - 디바이스 실행
|
|
591
|
+
/**
|
|
592
|
+
* capacitor.config.ts의 server.url 업데이트
|
|
593
|
+
*/
|
|
594
|
+
async _updateServerUrl(url) {
|
|
595
|
+
const configPath = path.resolve(this._capPath, "capacitor.config.ts");
|
|
596
|
+
if (!await fsExists(configPath)) return;
|
|
597
|
+
let content = await fsRead(configPath);
|
|
598
|
+
if (content.includes("url:")) {
|
|
599
|
+
content = content.replace(/url:\s*"[^"]*"/, `url: "${url}"`);
|
|
600
|
+
} else if (content.includes("server:")) {
|
|
601
|
+
content = content.replace(/server:\s*\{/, `server: {
|
|
602
|
+
url: "${url}",`);
|
|
603
|
+
}
|
|
604
|
+
await fsWrite(configPath, content);
|
|
605
|
+
}
|
|
606
|
+
//#endregion
|
|
607
|
+
//#region Private - 유틸리티
|
|
608
|
+
/**
|
|
609
|
+
* 문자열을 PascalCase로 변환
|
|
610
|
+
*/
|
|
611
|
+
_toPascalCase(str) {
|
|
612
|
+
return str.replace(/[-_](.)/g, (_, c) => c.toUpperCase()).replace(/^./, (c) => c.toUpperCase());
|
|
613
|
+
}
|
|
614
|
+
//#endregion
|
|
615
|
+
}
|
|
616
|
+
export {
|
|
617
|
+
Capacitor
|
|
618
|
+
};
|
|
619
|
+
//# sourceMappingURL=capacitor.js.map
|