@simplysm/sd-cli 12.16.27 → 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
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { FsUtils, HashUtils, PathUtils, SdFsWatcher } from "@simplysm/sd-core-node";
|
|
2
|
-
import path from "path";
|
|
3
|
-
|
|
4
|
-
export class SdCliIndexFileGenerator {
|
|
5
|
-
cachedHash?: string;
|
|
6
|
-
|
|
7
|
-
async watchAsync(pkgPath: string, polyfills?: string[], excludes?: string[]) {
|
|
8
|
-
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
9
|
-
this.cachedHash = FsUtils.exists(indexFilePath)
|
|
10
|
-
? HashUtils.get(await FsUtils.readFileAsync(indexFilePath))
|
|
11
|
-
: undefined;
|
|
12
|
-
|
|
13
|
-
const watcher = await SdFsWatcher.watchAsync([path.resolve(pkgPath, "src")], {
|
|
14
|
-
ignored: await this._getExcludesAsync(pkgPath, excludes),
|
|
15
|
-
});
|
|
16
|
-
watcher.onChange({ delay: 50 }, async (changeInfos) => {
|
|
17
|
-
if (changeInfos.some((item) => ["add", "addDir", "unlink", "unlinkDir"].includes(item.event)))
|
|
18
|
-
await this.runAsync(pkgPath, polyfills, excludes);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
await this.runAsync(pkgPath, polyfills, excludes);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async runAsync(pkgPath: string, polyfills?: string[], excludes?: string[]) {
|
|
25
|
-
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
26
|
-
|
|
27
|
-
const importTexts: string[] = [];
|
|
28
|
-
|
|
29
|
-
// polyfills 를 모두 import
|
|
30
|
-
if (polyfills) {
|
|
31
|
-
for (const polyfill of polyfills.orderBy()) {
|
|
32
|
-
importTexts.push(`import "${polyfill}";`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// 내부 파일들 import
|
|
37
|
-
const filePaths = await this._getFilePathsAsync(pkgPath, excludes);
|
|
38
|
-
for (const filePath of filePaths.orderBy()) {
|
|
39
|
-
const requirePath = PathUtils.posix(path.relative(path.dirname(indexFilePath), filePath))
|
|
40
|
-
.replace(/\.tsx?$/, "")
|
|
41
|
-
.replace(/\/index$/, "");
|
|
42
|
-
|
|
43
|
-
const sourceTsFileContent = await FsUtils.readFileAsync(filePath);
|
|
44
|
-
if (sourceTsFileContent.split("\n").some((line) => line.startsWith("export "))) {
|
|
45
|
-
importTexts.push(`export * from "./${requirePath}";`);
|
|
46
|
-
} else {
|
|
47
|
-
importTexts.push(`import "./${requirePath}";`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const content = importTexts.join("\n") + "\n";
|
|
52
|
-
const currHash = HashUtils.get(content);
|
|
53
|
-
if (currHash !== this.cachedHash) {
|
|
54
|
-
await FsUtils.writeFileAsync(indexFilePath, content);
|
|
55
|
-
this.cachedHash = currHash;
|
|
56
|
-
return { changed: true, filePath: indexFilePath, content };
|
|
57
|
-
} else {
|
|
58
|
-
return { changed: false, filePath: indexFilePath, content };
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
private async _getFilePathsAsync(pkgPath: string, excludes?: string[]) {
|
|
63
|
-
/*const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
64
|
-
|
|
65
|
-
const tsconfig = await FsUtils.readJsonAsync(path.resolve(pkgPath, "tsconfig.json"));
|
|
66
|
-
const entryFilePaths: string[] =
|
|
67
|
-
tsconfig.files?.map((item) => path.resolve(pkgPath, item)) ?? [];*/
|
|
68
|
-
|
|
69
|
-
return await FsUtils.globAsync(path.resolve(pkgPath, "src/**/*{.ts,.tsx}"), {
|
|
70
|
-
nodir: true,
|
|
71
|
-
ignore: await this._getExcludesAsync(pkgPath, excludes),
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
private async _getExcludesAsync(pkgPath: string, excludes?: string[]) {
|
|
76
|
-
const indexFilePath = path.resolve(pkgPath, "src/index.ts");
|
|
77
|
-
|
|
78
|
-
const tsconfig = await FsUtils.readJsonAsync(path.resolve(pkgPath, "tsconfig.json"));
|
|
79
|
-
|
|
80
|
-
return [
|
|
81
|
-
indexFilePath,
|
|
82
|
-
...[
|
|
83
|
-
...(tsconfig.excludes ?? []),
|
|
84
|
-
...(excludes ?? []),
|
|
85
|
-
"src/**/*.d.ts",
|
|
86
|
-
"src/index.ts",
|
|
87
|
-
"src/workers/**/*{.ts,.tsx}",
|
|
88
|
-
|
|
89
|
-
// TODO: index에 없는 파일은 watch가 안됨... 처리 필요함.
|
|
90
|
-
// "src/internal/**/*{.ts,.tsx}",
|
|
91
|
-
].map((item) => path.resolve(pkgPath, item)),
|
|
92
|
-
].map((item) => item.replace(/\\/g, "/"));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { FsUtils, PathUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { ESLint } from "eslint";
|
|
4
|
-
import { SdBuildRunnerBase } from "../SdBuildRunnerBase";
|
|
5
|
-
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
6
|
-
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
7
|
-
|
|
8
|
-
export class SdJsLibBuildRunner extends SdBuildRunnerBase<"library"> {
|
|
9
|
-
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdJsLibBuildRunner"]);
|
|
10
|
-
|
|
11
|
-
protected override async _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
12
|
-
if (this._opt.watch?.emitOnly) {
|
|
13
|
-
return {
|
|
14
|
-
buildMessages: [],
|
|
15
|
-
|
|
16
|
-
watchFileSet: new Set(),
|
|
17
|
-
affectedFileSet: new Set(),
|
|
18
|
-
emitFileSet: new Set(),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const filePathSet =
|
|
23
|
-
modifiedFileSet ??
|
|
24
|
-
new Set(
|
|
25
|
-
FsUtils.glob(path.resolve(this._opt.pkgPath, "src/**/*.js")).map((item) =>
|
|
26
|
-
PathUtils.norm(item),
|
|
27
|
-
),
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
this._debug("LINT...");
|
|
31
|
-
|
|
32
|
-
const lintResults = await this._lintAsync(filePathSet);
|
|
33
|
-
const messages = SdCliConvertMessageUtils.convertToBuildMessagesFromEslint(lintResults);
|
|
34
|
-
|
|
35
|
-
this._debug(`LINT 완료`);
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
buildMessages: messages,
|
|
39
|
-
|
|
40
|
-
watchFileSet: filePathSet,
|
|
41
|
-
affectedFileSet: filePathSet,
|
|
42
|
-
emitFileSet: new Set(),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private async _lintAsync(fileSet: Set<string>) {
|
|
47
|
-
const lintFilePaths = Array.from(fileSet)
|
|
48
|
-
.filter((item) => PathUtils.isChildPath(item, path.resolve(this._opt.pkgPath, "src")))
|
|
49
|
-
.filter((item) => item.endsWith(".js"))
|
|
50
|
-
.filter((item) => FsUtils.exists(item));
|
|
51
|
-
|
|
52
|
-
if (lintFilePaths.length === 0) {
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const linter = new ESLint({ cwd: this._opt.pkgPath, cache: false });
|
|
57
|
-
return await linter.lintFiles(lintFilePaths);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
-
import { SdBuildRunnerBase } from "../SdBuildRunnerBase";
|
|
3
|
-
import { SdTsLibBuilder } from "./SdTsLibBuilder";
|
|
4
|
-
import { SdCliIndexFileGenerator } from "./SdCliIndexFileGenerator";
|
|
5
|
-
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
6
|
-
import { SdCliDbContextFileGenerator } from "./SdCliDbContextFileGenerator";
|
|
7
|
-
|
|
8
|
-
export class SdTsLibBuildRunner extends SdBuildRunnerBase<"library"> {
|
|
9
|
-
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdTsLibBuildRunner"]);
|
|
10
|
-
|
|
11
|
-
private _builder?: SdTsLibBuilder;
|
|
12
|
-
|
|
13
|
-
protected override async _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
14
|
-
// 최초한번
|
|
15
|
-
if (!modifiedFileSet) {
|
|
16
|
-
if (!this._opt.watch?.noEmit) {
|
|
17
|
-
// index
|
|
18
|
-
if (this._pkgConf.index !== false) {
|
|
19
|
-
this._debug("GEN index.ts...");
|
|
20
|
-
await new SdCliIndexFileGenerator().watchAsync(
|
|
21
|
-
this._opt.pkgPath,
|
|
22
|
-
this._pkgConf.polyfills,
|
|
23
|
-
this._pkgConf.index?.excludes,
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// db-context
|
|
28
|
-
if (this._pkgConf.dbContext != null) {
|
|
29
|
-
this._debug(`GEN ${this._pkgConf.dbContext}.ts...`);
|
|
30
|
-
await new SdCliDbContextFileGenerator().watchAsync(
|
|
31
|
-
this._opt.pkgPath,
|
|
32
|
-
this._pkgConf.dbContext,
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
this._debug(`BUILD 준비...`);
|
|
38
|
-
this._builder = new SdTsLibBuilder(this._opt);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
this._debug(`BUILD...`);
|
|
42
|
-
const buildResult = await this._builder!.buildAsync(modifiedFileSet);
|
|
43
|
-
|
|
44
|
-
this._debug(`빌드 완료`);
|
|
45
|
-
return buildResult;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { SdCliConvertMessageUtils } from "../../utils/SdCliConvertMessageUtils";
|
|
3
|
-
import { FsUtils, HashUtils, PathUtils, TNormPath } from "@simplysm/sd-core-node";
|
|
4
|
-
import { SdTsCompiler } from "../../ts-compiler/SdTsCompiler";
|
|
5
|
-
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
6
|
-
import { ISdTsCompilerOptions } from "../../types/build/ISdTsCompilerOptions";
|
|
7
|
-
|
|
8
|
-
export class SdTsLibBuilder {
|
|
9
|
-
private readonly _tsCompiler: SdTsCompiler;
|
|
10
|
-
private readonly _outputHashCache = new Map<TNormPath, string>();
|
|
11
|
-
|
|
12
|
-
constructor(private readonly _opt: ISdTsCompilerOptions) {
|
|
13
|
-
this._tsCompiler = new SdTsCompiler(_opt, false);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async buildAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
17
|
-
const tsCompileResult = await this._tsCompiler.compileAsync(modifiedFileSet ?? new Set());
|
|
18
|
-
|
|
19
|
-
const emitFileSet = new Set<TNormPath>();
|
|
20
|
-
for (const emitFile of tsCompileResult.emitFileSet) {
|
|
21
|
-
const emitFileInfos = tsCompileResult.emittedFilesCacheMap.get(emitFile);
|
|
22
|
-
if (emitFileInfos) {
|
|
23
|
-
for (const emitFileInfo of emitFileInfos) {
|
|
24
|
-
if (emitFileInfo.outAbsPath != null) {
|
|
25
|
-
const emitFilePath = PathUtils.norm(emitFileInfo.outAbsPath);
|
|
26
|
-
const prevHash = this._outputHashCache.get(emitFilePath);
|
|
27
|
-
const currHash = HashUtils.get(Buffer.from(emitFileInfo.text));
|
|
28
|
-
if (prevHash !== currHash) {
|
|
29
|
-
FsUtils.writeFile(emitFilePath, emitFileInfo.text);
|
|
30
|
-
this._outputHashCache.set(emitFilePath, currHash);
|
|
31
|
-
emitFileSet.add(emitFilePath);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const globalStylesheetBundlingResult =
|
|
38
|
-
tsCompileResult.stylesheetBundlingResultMap.get(emitFile);
|
|
39
|
-
if (globalStylesheetBundlingResult && "outputFiles" in globalStylesheetBundlingResult) {
|
|
40
|
-
for (const outputFile of globalStylesheetBundlingResult.outputFiles) {
|
|
41
|
-
const distPath = PathUtils.norm(
|
|
42
|
-
this._opt.pkgPath,
|
|
43
|
-
"dist",
|
|
44
|
-
path.relative(this._opt.pkgPath, outputFile.path),
|
|
45
|
-
);
|
|
46
|
-
if (PathUtils.isChildPath(distPath, path.resolve(this._opt.pkgPath, "dist"))) {
|
|
47
|
-
const prevHash = this._outputHashCache.get(distPath);
|
|
48
|
-
const currHash = HashUtils.get(Buffer.from(outputFile.text));
|
|
49
|
-
if (prevHash !== currHash) {
|
|
50
|
-
FsUtils.writeFile(distPath, outputFile.text);
|
|
51
|
-
this._outputHashCache.set(distPath, currHash);
|
|
52
|
-
emitFileSet.add(distPath);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const styleResults = Array.from(tsCompileResult.stylesheetBundlingResultMap.values()).mapMany(
|
|
60
|
-
(item) => SdCliConvertMessageUtils.convertToBuildMessagesFromEsbuild(item, this._opt.pkgPath),
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
buildMessages: [...tsCompileResult.messages, ...styleResults],
|
|
65
|
-
|
|
66
|
-
watchFileSet: tsCompileResult.watchFileSet,
|
|
67
|
-
affectedFileSet: tsCompileResult.affectedFileSet,
|
|
68
|
-
emitFileSet,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { FsUtils, SdLogger, TNormPath } from "@simplysm/sd-core-node";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { javascript, StringUtils } from "@simplysm/sd-core-common";
|
|
4
|
-
import { SdBuildRunnerBase } from "../SdBuildRunnerBase";
|
|
5
|
-
import { SdServerBundler } from "./SdServerBundler";
|
|
6
|
-
import { ISdBuildResult } from "../../types/build/ISdBuildResult";
|
|
7
|
-
import { INpmConfig } from "../../types/common-config/INpmConfig";
|
|
8
|
-
|
|
9
|
-
export class SdServerBuildRunner extends SdBuildRunnerBase<"server"> {
|
|
10
|
-
protected override _logger = SdLogger.get(["simplysm", "sd-cli", "SdServerBuildRunner"]);
|
|
11
|
-
|
|
12
|
-
private _serverBundler?: SdServerBundler;
|
|
13
|
-
|
|
14
|
-
protected override async _runAsync(modifiedFileSet?: Set<TNormPath>): Promise<ISdBuildResult> {
|
|
15
|
-
// 최초
|
|
16
|
-
if (!modifiedFileSet) {
|
|
17
|
-
const externalModules = this._getExternalModules();
|
|
18
|
-
|
|
19
|
-
if (!this._opt.watch?.dev) {
|
|
20
|
-
this._generateProductionFiles(
|
|
21
|
-
externalModules.filter((item) => item.exists).map((item) => item.name),
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!this._opt.watch?.noEmit) {
|
|
26
|
-
this._debug("GEN .config...");
|
|
27
|
-
const confDistPath = path.resolve(this._opt.pkgPath, "dist/.config.json");
|
|
28
|
-
FsUtils.writeFile(confDistPath, JSON.stringify(this._pkgConf.configs ?? {}, undefined, 2));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
this._debug(`BUILD 준비...`);
|
|
32
|
-
this._serverBundler = new SdServerBundler(this._opt, {
|
|
33
|
-
external: externalModules.map((item) => item.name),
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
this._debug(`BUILD...`);
|
|
38
|
-
const bundleResult = await this._serverBundler!.bundleAsync(modifiedFileSet);
|
|
39
|
-
|
|
40
|
-
this._debug(`빌드 완료`);
|
|
41
|
-
return bundleResult;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private _generateProductionFiles(externals: string[]) {
|
|
45
|
-
const npmConf = FsUtils.readJson(path.resolve(this._opt.pkgPath, "package.json")) as INpmConfig;
|
|
46
|
-
|
|
47
|
-
this._debug("GEN package.json...");
|
|
48
|
-
{
|
|
49
|
-
const projNpmConf = FsUtils.readJson(
|
|
50
|
-
path.resolve(process.cwd(), "package.json"),
|
|
51
|
-
) as INpmConfig;
|
|
52
|
-
|
|
53
|
-
const distNpmConfig: INpmConfig = {
|
|
54
|
-
name: npmConf.name,
|
|
55
|
-
version: npmConf.version,
|
|
56
|
-
type: npmConf.type,
|
|
57
|
-
};
|
|
58
|
-
distNpmConfig.dependencies = {};
|
|
59
|
-
for (const external of externals) {
|
|
60
|
-
distNpmConfig.dependencies[external] = "*";
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
distNpmConfig.volta = projNpmConf.volta;
|
|
64
|
-
|
|
65
|
-
FsUtils.writeJson(path.resolve(this._opt.pkgPath, "dist/package.json"), distNpmConfig, {
|
|
66
|
-
space: 2,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
this._debug("GEN .yarnrc.yml...");
|
|
71
|
-
{
|
|
72
|
-
FsUtils.writeFile(
|
|
73
|
-
path.resolve(this._opt.pkgPath, "dist/.yarnrc.yml"),
|
|
74
|
-
"nodeLinker: node-modules",
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
this._debug("GEN openssl.cnf...");
|
|
79
|
-
{
|
|
80
|
-
FsUtils.writeFile(
|
|
81
|
-
path.resolve(this._opt.pkgPath, "dist/openssl.cnf"),
|
|
82
|
-
`
|
|
83
|
-
nodejs_conf = openssl_init
|
|
84
|
-
|
|
85
|
-
[openssl_init]
|
|
86
|
-
providers = provider_sect
|
|
87
|
-
ssl_conf = ssl_sect
|
|
88
|
-
|
|
89
|
-
[provider_sect]
|
|
90
|
-
default = default_sect
|
|
91
|
-
legacy = legacy_sect
|
|
92
|
-
|
|
93
|
-
[default_sect]
|
|
94
|
-
activate = 1
|
|
95
|
-
|
|
96
|
-
[legacy_sect]
|
|
97
|
-
activate = 1
|
|
98
|
-
|
|
99
|
-
[ssl_sect]
|
|
100
|
-
system_default = system_default_sect
|
|
101
|
-
|
|
102
|
-
[system_default_sect]
|
|
103
|
-
Options = UnsafeLegacyRenegotiation`.trim(),
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (this._pkgConf.pm2) {
|
|
108
|
-
this._debug("GEN pm2.config.cjs...");
|
|
109
|
-
|
|
110
|
-
const str = javascript`
|
|
111
|
-
const cp = require("child_process");
|
|
112
|
-
|
|
113
|
-
const npmConf = require("./package.json");
|
|
114
|
-
|
|
115
|
-
const pm2Conf = ${JSON.stringify(this._pkgConf.pm2)};
|
|
116
|
-
const env = ${JSON.stringify(this._pkgConf.env)};
|
|
117
|
-
|
|
118
|
-
module.exports = {
|
|
119
|
-
name: pm2Conf.name ?? npmConf.name.replace(/@/g, "").replace(/[\\\/]/g, "-"),
|
|
120
|
-
script: "main.js",
|
|
121
|
-
watch: true,
|
|
122
|
-
watch_delay: 2000,
|
|
123
|
-
ignore_watch: [
|
|
124
|
-
"node_modules",
|
|
125
|
-
"www",
|
|
126
|
-
...pm2Conf.ignoreWatchPaths ?? [],
|
|
127
|
-
],
|
|
128
|
-
...pm2Conf.noInterpreter ? {} : { interpreter: cp.execSync("volta which node").toString().trim() },
|
|
129
|
-
interpreter_args: "--openssl-config=openssl.cnf",
|
|
130
|
-
env: {
|
|
131
|
-
NODE_ENV: "production",
|
|
132
|
-
TZ: "Asia/Seoul",
|
|
133
|
-
SD_VERSION: npmConf.version,
|
|
134
|
-
...env ?? {},
|
|
135
|
-
},
|
|
136
|
-
arrayProcess: "concat",
|
|
137
|
-
useDelTargetNull: true
|
|
138
|
-
};`
|
|
139
|
-
.replace(/\n {8}/g, "\n")
|
|
140
|
-
.trim();
|
|
141
|
-
|
|
142
|
-
FsUtils.writeFile(path.resolve(this._opt.pkgPath, "dist/pm2.config.cjs"), str);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (this._pkgConf.iis) {
|
|
146
|
-
this._debug("GEN web.config...");
|
|
147
|
-
|
|
148
|
-
const iisDistPath = path.resolve(this._opt.pkgPath, "dist/web.config");
|
|
149
|
-
const nodeVersion = process.versions.node.substring(1);
|
|
150
|
-
const serverExeFilePath =
|
|
151
|
-
this._pkgConf.iis.nodeExeFilePath ??
|
|
152
|
-
`%HOMEDRIVE%%HOMEPATH%\\AppData\\Local\\Volta\\tools\\image\\node\\${nodeVersion}\\node.exe`;
|
|
153
|
-
|
|
154
|
-
FsUtils.writeFile(
|
|
155
|
-
iisDistPath,
|
|
156
|
-
`
|
|
157
|
-
<configuration>
|
|
158
|
-
<appSettings>
|
|
159
|
-
<add key="NODE_ENV" value="production" />
|
|
160
|
-
<add key="TZ" value="Asia/Seoul" />
|
|
161
|
-
<add key="SD_VERSION" value="${npmConf.version}" />
|
|
162
|
-
${Object.keys(this._pkgConf.env ?? {})
|
|
163
|
-
.map((key) => `<add key="${key}" value="${this._pkgConf.env![key]}"/>`)
|
|
164
|
-
.join("\n ")}
|
|
165
|
-
</appSettings>
|
|
166
|
-
<system.webServer>
|
|
167
|
-
<handlers>
|
|
168
|
-
<add name="iisnode" path="main.js" verb="*" modules="iisnode" />
|
|
169
|
-
</handlers>
|
|
170
|
-
<iisnode nodeProcessCommandLine="${serverExeFilePath} --openssl-config=openssl.cnf"
|
|
171
|
-
watchedFiles="web.config;*.js"
|
|
172
|
-
loggingEnabled="true"
|
|
173
|
-
devErrorsEnabled="true" />
|
|
174
|
-
<rewrite>
|
|
175
|
-
<rules>
|
|
176
|
-
<rule name="main">
|
|
177
|
-
<action type="Rewrite" url="main.js" />
|
|
178
|
-
</rule>
|
|
179
|
-
</rules>
|
|
180
|
-
</rewrite>
|
|
181
|
-
<httpErrors errorMode="Detailed" />
|
|
182
|
-
</system.webServer>
|
|
183
|
-
</configuration>`.trim(),
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
private _getExternalModules(): {
|
|
189
|
-
name: string;
|
|
190
|
-
exists: boolean;
|
|
191
|
-
}[] {
|
|
192
|
-
const loadedModuleNames: string[] = [];
|
|
193
|
-
const results: {
|
|
194
|
-
name: string;
|
|
195
|
-
exists: boolean;
|
|
196
|
-
}[] = [];
|
|
197
|
-
|
|
198
|
-
const npmConfigMap = new Map<string, INpmConfig>();
|
|
199
|
-
|
|
200
|
-
const fn = (currPath: string) => {
|
|
201
|
-
const npmConfig = npmConfigMap.getOrCreate(
|
|
202
|
-
currPath,
|
|
203
|
-
FsUtils.readJson(path.resolve(currPath, "package.json")),
|
|
204
|
-
);
|
|
205
|
-
|
|
206
|
-
const deps = {
|
|
207
|
-
defaults: [
|
|
208
|
-
...Object.keys(npmConfig.dependencies ?? {}),
|
|
209
|
-
...Object.keys(npmConfig.peerDependencies ?? {}).filter(
|
|
210
|
-
(item) => !npmConfig.peerDependenciesMeta?.[item]?.optional,
|
|
211
|
-
),
|
|
212
|
-
].distinct(),
|
|
213
|
-
optionals: [
|
|
214
|
-
...Object.keys(npmConfig.optionalDependencies ?? {}),
|
|
215
|
-
...Object.keys(npmConfig.peerDependencies ?? {}).filter(
|
|
216
|
-
(item) => npmConfig.peerDependenciesMeta?.[item]?.optional ?? false,
|
|
217
|
-
),
|
|
218
|
-
].distinct(),
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
for (const moduleName of deps.defaults) {
|
|
222
|
-
if (loadedModuleNames.includes(moduleName)) continue;
|
|
223
|
-
loadedModuleNames.push(moduleName);
|
|
224
|
-
|
|
225
|
-
const modulePath = FsUtils.findAllParentChildPaths(
|
|
226
|
-
"node_modules/" + moduleName,
|
|
227
|
-
currPath,
|
|
228
|
-
path.resolve(this._opt.pkgPath, "../../"),
|
|
229
|
-
).first();
|
|
230
|
-
if (StringUtils.isNullOrEmpty(modulePath)) {
|
|
231
|
-
continue;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (FsUtils.glob(path.resolve(modulePath, "binding.gyp")).length > 0) {
|
|
235
|
-
results.push({
|
|
236
|
-
name: moduleName,
|
|
237
|
-
exists: true,
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
if (this._pkgConf.externals?.includes(moduleName)) {
|
|
242
|
-
results.push({
|
|
243
|
-
name: moduleName,
|
|
244
|
-
exists: true,
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
fn(modulePath);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
for (const optModuleName of deps.optionals) {
|
|
252
|
-
if (loadedModuleNames.includes(optModuleName)) continue;
|
|
253
|
-
loadedModuleNames.push(optModuleName);
|
|
254
|
-
|
|
255
|
-
const optModulePath = FsUtils.findAllParentChildPaths(
|
|
256
|
-
"node_modules/" + optModuleName,
|
|
257
|
-
currPath,
|
|
258
|
-
path.resolve(this._opt.pkgPath, "../../"),
|
|
259
|
-
).first();
|
|
260
|
-
if (StringUtils.isNullOrEmpty(optModulePath)) {
|
|
261
|
-
results.push({
|
|
262
|
-
name: optModuleName,
|
|
263
|
-
exists: false,
|
|
264
|
-
});
|
|
265
|
-
continue;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
if (FsUtils.glob(path.resolve(optModulePath, "binding.gyp")).length > 0) {
|
|
269
|
-
results.push({
|
|
270
|
-
name: optModuleName,
|
|
271
|
-
exists: true,
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
if (this._pkgConf.externals?.includes(optModuleName)) {
|
|
276
|
-
results.push({
|
|
277
|
-
name: optModuleName,
|
|
278
|
-
exists: true,
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
fn(optModulePath);
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
fn(this._opt.pkgPath);
|
|
287
|
-
|
|
288
|
-
for (const external of this._pkgConf.externals ?? []) {
|
|
289
|
-
if (!results.some((item) => item.name === external)) {
|
|
290
|
-
results.push({
|
|
291
|
-
name: external,
|
|
292
|
-
exists: false,
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
return results;
|
|
298
|
-
}
|
|
299
|
-
}
|