@simplysm/sd-cli 13.0.100 → 14.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/build.js +29 -19
- package/dist/commands/build.js.map +1 -6
- package/dist/commands/check.d.ts +1 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +130 -115
- package/dist/commands/check.js.map +1 -6
- package/dist/commands/dev.d.ts +6 -7
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +24 -14
- package/dist/commands/dev.js.map +1 -6
- package/dist/commands/lint.d.ts +1 -1
- package/dist/commands/lint.js +158 -116
- package/dist/commands/lint.js.map +1 -6
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +637 -510
- package/dist/commands/publish.js.map +1 -6
- package/dist/commands/replace-deps.js +12 -12
- package/dist/commands/replace-deps.js.map +1 -6
- package/dist/commands/typecheck.d.ts +5 -30
- package/dist/commands/typecheck.d.ts.map +1 -1
- package/dist/commands/typecheck.js +144 -207
- package/dist/commands/typecheck.js.map +1 -6
- package/dist/commands/watch.d.ts +6 -4
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +25 -16
- package/dist/commands/watch.js.map +1 -6
- package/dist/engines/NgtscEngine.d.ts +47 -0
- package/dist/engines/NgtscEngine.d.ts.map +1 -0
- package/dist/engines/NgtscEngine.js +151 -0
- package/dist/engines/NgtscEngine.js.map +1 -0
- package/dist/engines/ServerEsbuildEngine.d.ts +47 -0
- package/dist/engines/ServerEsbuildEngine.d.ts.map +1 -0
- package/dist/engines/ServerEsbuildEngine.js +159 -0
- package/dist/engines/ServerEsbuildEngine.js.map +1 -0
- package/dist/engines/TscEngine.d.ts +47 -0
- package/dist/engines/TscEngine.d.ts.map +1 -0
- package/dist/engines/TscEngine.js +153 -0
- package/dist/engines/TscEngine.js.map +1 -0
- package/dist/engines/ViteEngine.d.ts +49 -0
- package/dist/engines/ViteEngine.d.ts.map +1 -0
- package/dist/engines/ViteEngine.js +161 -0
- package/dist/engines/ViteEngine.js.map +1 -0
- package/dist/engines/index.d.ts +26 -0
- package/dist/engines/index.d.ts.map +1 -0
- package/dist/engines/index.js +30 -0
- package/dist/engines/index.js.map +1 -0
- package/dist/engines/types.d.ts +77 -0
- package/dist/engines/types.d.ts.map +1 -0
- package/dist/engines/types.js +2 -0
- package/dist/engines/types.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -6
- package/dist/infra/ResultCollector.d.ts +1 -1
- package/dist/infra/ResultCollector.d.ts.map +1 -1
- package/dist/infra/ResultCollector.js +30 -27
- package/dist/infra/ResultCollector.js.map +1 -6
- package/dist/infra/SignalHandler.js +45 -42
- package/dist/infra/SignalHandler.js.map +1 -6
- package/dist/infra/WorkerManager.js +56 -53
- package/dist/infra/WorkerManager.js.map +1 -6
- package/dist/orchestrators/BuildOrchestrator.d.ts +33 -1
- package/dist/orchestrators/BuildOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +314 -309
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -6
- package/dist/orchestrators/DevWatchOrchestrator.d.ts +60 -0
- package/dist/orchestrators/DevWatchOrchestrator.d.ts.map +1 -0
- package/dist/orchestrators/DevWatchOrchestrator.js +465 -0
- package/dist/orchestrators/DevWatchOrchestrator.js.map +1 -0
- package/dist/sd-cli-entry.d.ts.map +1 -1
- package/dist/sd-cli-entry.js +190 -266
- package/dist/sd-cli-entry.js.map +1 -6
- package/dist/sd-cli.js +77 -49
- package/dist/sd-cli.js.map +1 -6
- package/dist/sd-config.types.d.ts +2 -0
- package/dist/sd-config.types.d.ts.map +1 -1
- package/dist/sd-config.types.js +2 -1
- package/dist/sd-config.types.js.map +1 -6
- package/dist/utils/angular-build.d.ts +77 -0
- package/dist/utils/angular-build.d.ts.map +1 -0
- package/dist/utils/angular-build.js +84 -0
- package/dist/utils/angular-build.js.map +1 -0
- package/dist/utils/build-env.js +9 -9
- package/dist/utils/build-env.js.map +1 -6
- package/dist/utils/concurrency.d.ts +15 -0
- package/dist/utils/concurrency.d.ts.map +1 -0
- package/dist/utils/concurrency.js +38 -0
- package/dist/utils/concurrency.js.map +1 -0
- package/dist/utils/copy-public.js +104 -87
- package/dist/utils/copy-public.js.map +1 -6
- package/dist/utils/copy-src.js +49 -35
- package/dist/utils/copy-src.js.map +1 -6
- package/dist/utils/esbuild-config.d.ts +0 -29
- package/dist/utils/esbuild-config.d.ts.map +1 -1
- package/dist/utils/esbuild-config.js +151 -218
- package/dist/utils/esbuild-config.js.map +1 -6
- package/dist/utils/ngtsc-build-core.d.ts +49 -0
- package/dist/utils/ngtsc-build-core.d.ts.map +1 -0
- package/dist/utils/ngtsc-build-core.js +250 -0
- package/dist/utils/ngtsc-build-core.js.map +1 -0
- package/dist/utils/output-path-rewriter.d.ts +23 -0
- package/dist/utils/output-path-rewriter.d.ts.map +1 -0
- package/dist/utils/output-path-rewriter.js +74 -0
- package/dist/utils/output-path-rewriter.js.map +1 -0
- package/dist/utils/output-utils.js +55 -40
- package/dist/utils/output-utils.js.map +1 -6
- package/dist/utils/package-utils.d.ts +8 -0
- package/dist/utils/package-utils.d.ts.map +1 -1
- package/dist/utils/package-utils.js +103 -73
- package/dist/utils/package-utils.js.map +1 -6
- package/dist/utils/rebuild-manager.js +41 -44
- package/dist/utils/rebuild-manager.js.map +1 -6
- package/dist/utils/replace-deps.js +283 -184
- package/dist/utils/replace-deps.js.map +1 -6
- package/dist/utils/scss-compiler.d.ts +10 -0
- package/dist/utils/scss-compiler.d.ts.map +1 -0
- package/dist/utils/scss-compiler.js +36 -0
- package/dist/utils/scss-compiler.js.map +1 -0
- package/dist/utils/sd-config.js +29 -19
- package/dist/utils/sd-config.js.map +1 -6
- package/dist/utils/tsc-build.d.ts +36 -0
- package/dist/utils/tsc-build.d.ts.map +1 -0
- package/dist/utils/tsc-build.js +130 -0
- package/dist/utils/tsc-build.js.map +1 -0
- package/dist/utils/tsconfig.d.ts +7 -26
- package/dist/utils/tsconfig.d.ts.map +1 -1
- package/dist/utils/tsconfig.js +39 -64
- package/dist/utils/tsconfig.js.map +1 -6
- package/dist/utils/typecheck-non-package.d.ts +18 -0
- package/dist/utils/typecheck-non-package.d.ts.map +1 -0
- package/dist/utils/typecheck-non-package.js +64 -0
- package/dist/utils/typecheck-non-package.js.map +1 -0
- package/dist/utils/typecheck-serialization.js +58 -40
- package/dist/utils/typecheck-serialization.js.map +1 -6
- package/dist/utils/worker-events.js +48 -40
- package/dist/utils/worker-events.js.map +1 -6
- package/dist/utils/worker-utils.js +48 -28
- package/dist/utils/worker-utils.js.map +1 -6
- package/dist/vitest-plugin.d.ts +9 -0
- package/dist/vitest-plugin.d.ts.map +1 -0
- package/dist/vitest-plugin.js +85 -0
- package/dist/vitest-plugin.js.map +1 -0
- package/dist/workers/library-build.worker.d.ts +54 -0
- package/dist/workers/library-build.worker.d.ts.map +1 -0
- package/dist/workers/library-build.worker.js +97 -0
- package/dist/workers/library-build.worker.js.map +1 -0
- package/dist/workers/lint.worker.js +9 -6
- package/dist/workers/lint.worker.js.map +1 -6
- package/dist/workers/ngtsc-build.worker.d.ts +23 -0
- package/dist/workers/ngtsc-build.worker.d.ts.map +1 -0
- package/dist/workers/ngtsc-build.worker.js +98 -0
- package/dist/workers/ngtsc-build.worker.js.map +1 -0
- package/dist/workers/{server.worker.d.ts → server-build.worker.d.ts} +39 -29
- package/dist/workers/server-build.worker.d.ts.map +1 -0
- package/dist/workers/server-build.worker.js +399 -0
- package/dist/workers/server-build.worker.js.map +1 -0
- package/dist/workers/server-runtime.worker.d.ts +3 -2
- package/dist/workers/server-runtime.worker.d.ts.map +1 -1
- package/dist/workers/server-runtime.worker.js +100 -95
- package/dist/workers/server-runtime.worker.js.map +1 -6
- package/dist/workers/vite-build.worker.d.ts +56 -0
- package/dist/workers/vite-build.worker.d.ts.map +1 -0
- package/dist/workers/vite-build.worker.js +167 -0
- package/dist/workers/vite-build.worker.js.map +1 -0
- package/package.json +10 -16
- package/src/commands/check.ts +21 -3
- package/src/commands/dev.ts +10 -8
- package/src/commands/lint.ts +1 -1
- package/src/commands/publish.ts +4 -0
- package/src/commands/typecheck.ts +89 -256
- package/src/commands/watch.ts +9 -8
- package/src/engines/NgtscEngine.ts +190 -0
- package/src/engines/ServerEsbuildEngine.ts +195 -0
- package/src/engines/TscEngine.ts +189 -0
- package/src/engines/ViteEngine.ts +203 -0
- package/src/engines/index.ts +49 -0
- package/src/engines/types.ts +79 -0
- package/src/index.ts +0 -3
- package/src/infra/ResultCollector.ts +1 -1
- package/src/orchestrators/BuildOrchestrator.ts +87 -157
- package/src/orchestrators/DevWatchOrchestrator.ts +573 -0
- package/src/sd-cli-entry.ts +13 -116
- package/src/sd-config.types.ts +2 -0
- package/src/utils/angular-build.ts +157 -0
- package/src/utils/concurrency.ts +43 -0
- package/src/utils/esbuild-config.ts +1 -122
- package/src/utils/ngtsc-build-core.ts +379 -0
- package/src/utils/output-path-rewriter.ts +82 -0
- package/src/utils/package-utils.ts +20 -0
- package/src/utils/scss-compiler.ts +58 -0
- package/src/utils/tsc-build.ts +175 -0
- package/src/utils/tsconfig.ts +27 -95
- package/src/utils/typecheck-non-package.ts +87 -0
- package/src/vitest-plugin.ts +118 -0
- package/src/workers/library-build.worker.ts +153 -0
- package/src/workers/ngtsc-build.worker.ts +146 -0
- package/src/workers/server-build.worker.ts +565 -0
- package/src/workers/server-runtime.worker.ts +17 -26
- package/src/workers/vite-build.worker.ts +252 -0
- package/tests/commands/check.spec.ts +276 -0
- package/tests/commands/dev.spec.ts +53 -0
- package/tests/commands/lint.spec.ts +243 -0
- package/tests/commands/publish.spec.ts +1159 -0
- package/tests/commands/typecheck.spec.ts +294 -0
- package/tests/commands/watch.spec.ts +53 -0
- package/tests/engines/engine-selection.spec.ts +247 -0
- package/tests/engines/ngtsc-engine.spec.ts +274 -0
- package/tests/engines/server-esbuild-engine.spec.ts +256 -0
- package/tests/engines/tsc-engine.spec.ts +213 -0
- package/tests/engines/vite-engine.spec.ts +358 -0
- package/tests/infra/result-collector.spec.ts +46 -0
- package/tests/infra/signal-handler.spec.ts +32 -0
- package/tests/infra/worker-manager.spec.ts +63 -0
- package/tests/orchestrators/build-orchestrator.spec.ts +772 -0
- package/tests/orchestrators/dev-watch-orchestrator.spec.ts +1173 -0
- package/tests/sd-cli-entry.spec.ts +49 -0
- package/tests/utils/angular-build.spec.ts +251 -0
- package/tests/utils/build-env.spec.ts +33 -0
- package/tests/utils/concurrency.spec.ts +65 -0
- package/tests/utils/copy-src.spec.ts +144 -0
- package/tests/utils/esbuild-config.spec.ts +186 -0
- package/tests/utils/external-modules.spec.ts +161 -0
- package/tests/utils/ngtsc-scss-refactor.spec.ts +66 -0
- package/tests/utils/output-path-rewriter.spec.ts +165 -0
- package/tests/utils/output-utils.spec.ts +104 -0
- package/tests/utils/package-utils.spec.ts +52 -0
- package/tests/utils/rebuild-manager.spec.ts +30 -27
- package/tests/utils/replace-deps.spec.ts +69 -0
- package/tests/utils/scss-compiler.spec.ts +131 -0
- package/tests/utils/sd-config.spec.ts +77 -0
- package/tests/utils/tsc-build.spec.ts +358 -0
- package/tests/utils/tsconfig-angular.spec.ts +71 -0
- package/tests/utils/typecheck-non-package.spec.ts +120 -0
- package/tests/utils/worker-events.spec.ts +155 -0
- package/tests/utils/worker-utils.spec.ts +43 -0
- package/tests/vitest-plugin-cwd.spec.ts +68 -0
- package/tests/vitest-plugin.spec.ts +103 -0
- package/tests/workers/library-build-worker.spec.ts +258 -0
- package/tests/workers/ngtsc-build-worker.spec.ts +187 -0
- package/tests/workers/server-build-worker.spec.ts +566 -0
- package/tests/workers/server-runtime-worker.spec.ts +251 -0
- package/README.md +0 -295
- package/dist/builders/BaseBuilder.d.ts +0 -88
- package/dist/builders/BaseBuilder.d.ts.map +0 -1
- package/dist/builders/BaseBuilder.js +0 -142
- package/dist/builders/BaseBuilder.js.map +0 -6
- package/dist/builders/DtsBuilder.d.ts +0 -22
- package/dist/builders/DtsBuilder.d.ts.map +0 -1
- package/dist/builders/DtsBuilder.js +0 -72
- package/dist/builders/DtsBuilder.js.map +0 -6
- package/dist/builders/LibraryBuilder.d.ts +0 -22
- package/dist/builders/LibraryBuilder.d.ts.map +0 -1
- package/dist/builders/LibraryBuilder.js +0 -85
- package/dist/builders/LibraryBuilder.js.map +0 -6
- package/dist/builders/types.d.ts +0 -55
- package/dist/builders/types.d.ts.map +0 -1
- package/dist/builders/types.js +0 -1
- package/dist/builders/types.js.map +0 -6
- package/dist/capacitor/capacitor.d.ts +0 -151
- package/dist/capacitor/capacitor.d.ts.map +0 -1
- package/dist/capacitor/capacitor.js +0 -694
- package/dist/capacitor/capacitor.js.map +0 -6
- package/dist/commands/device.d.ts +0 -22
- package/dist/commands/device.d.ts.map +0 -1
- package/dist/commands/device.js +0 -98
- package/dist/commands/device.js.map +0 -6
- package/dist/commands/init.d.ts +0 -14
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -72
- package/dist/commands/init.js.map +0 -6
- package/dist/electron/electron.d.ts +0 -84
- package/dist/electron/electron.d.ts.map +0 -1
- package/dist/electron/electron.js +0 -263
- package/dist/electron/electron.js.map +0 -6
- package/dist/orchestrators/DevOrchestrator.d.ts +0 -83
- package/dist/orchestrators/DevOrchestrator.d.ts.map +0 -1
- package/dist/orchestrators/DevOrchestrator.js +0 -540
- package/dist/orchestrators/DevOrchestrator.js.map +0 -6
- package/dist/orchestrators/WatchOrchestrator.d.ts +0 -57
- package/dist/orchestrators/WatchOrchestrator.d.ts.map +0 -1
- package/dist/orchestrators/WatchOrchestrator.js +0 -199
- package/dist/orchestrators/WatchOrchestrator.js.map +0 -6
- package/dist/utils/tailwind-config-deps.d.ts +0 -8
- package/dist/utils/tailwind-config-deps.d.ts.map +0 -1
- package/dist/utils/tailwind-config-deps.js +0 -82
- package/dist/utils/tailwind-config-deps.js.map +0 -6
- package/dist/utils/template.d.ts +0 -14
- package/dist/utils/template.d.ts.map +0 -1
- package/dist/utils/template.js +0 -33
- package/dist/utils/template.js.map +0 -6
- package/dist/utils/vite-config.d.ts +0 -35
- package/dist/utils/vite-config.d.ts.map +0 -1
- package/dist/utils/vite-config.js +0 -259
- package/dist/utils/vite-config.js.map +0 -6
- package/dist/workers/client.worker.d.ts +0 -83
- package/dist/workers/client.worker.d.ts.map +0 -1
- package/dist/workers/client.worker.js +0 -111
- package/dist/workers/client.worker.js.map +0 -6
- package/dist/workers/dts.worker.d.ts +0 -75
- package/dist/workers/dts.worker.d.ts.map +0 -1
- package/dist/workers/dts.worker.js +0 -270
- package/dist/workers/dts.worker.js.map +0 -6
- package/dist/workers/library.worker.d.ts +0 -75
- package/dist/workers/library.worker.d.ts.map +0 -1
- package/dist/workers/library.worker.js +0 -166
- package/dist/workers/library.worker.js.map +0 -6
- package/dist/workers/server.worker.d.ts.map +0 -1
- package/dist/workers/server.worker.js +0 -482
- package/dist/workers/server.worker.js.map +0 -6
- package/src/builders/BaseBuilder.ts +0 -218
- package/src/builders/DtsBuilder.ts +0 -92
- package/src/builders/LibraryBuilder.ts +0 -110
- package/src/builders/types.ts +0 -60
- package/src/capacitor/capacitor.ts +0 -931
- package/src/commands/device.ts +0 -140
- package/src/commands/init.ts +0 -113
- package/src/electron/electron.ts +0 -362
- package/src/orchestrators/DevOrchestrator.ts +0 -744
- package/src/orchestrators/WatchOrchestrator.ts +0 -277
- package/src/utils/tailwind-config-deps.ts +0 -98
- package/src/utils/template.ts +0 -56
- package/src/utils/vite-config.ts +0 -390
- package/src/workers/client.worker.ts +0 -250
- package/src/workers/dts.worker.ts +0 -453
- package/src/workers/library.worker.ts +0 -316
- package/src/workers/server.worker.ts +0 -734
- package/templates/init/.gitignore.hbs +0 -34
- package/templates/init/.npmrc.hbs +0 -1
- package/templates/init/.prettierignore +0 -1
- package/templates/init/.prettierrc.yaml +0 -12
- package/templates/init/eslint.config.ts +0 -15
- package/templates/init/mise.toml +0 -3
- package/templates/init/package.json.hbs +0 -32
- package/templates/init/packages/client-admin/index.html.hbs +0 -144
- package/templates/init/packages/client-admin/package.json.hbs +0 -27
- package/templates/init/packages/client-admin/public/assets/logo-landscape.png +0 -0
- package/templates/init/packages/client-admin/public/assets/logo.png +0 -0
- package/templates/init/packages/client-admin/public/favicon.ico +0 -0
- package/templates/init/packages/client-admin/src/App.tsx +0 -42
- package/templates/init/packages/client-admin/src/dev/DevDialog.tsx +0 -34
- package/templates/init/packages/client-admin/src/events/AuthChangeEvent.ts +0 -3
- package/templates/init/packages/client-admin/src/main.css +0 -4
- package/templates/init/packages/client-admin/src/main.tsx.hbs +0 -146
- package/templates/init/packages/client-admin/src/providers/AppServiceProvider.tsx.hbs +0 -103
- package/templates/init/packages/client-admin/src/providers/AppStructureProvider.tsx +0 -84
- package/templates/init/packages/client-admin/src/providers/AuthProvider.tsx.hbs +0 -96
- package/templates/init/packages/client-admin/src/providers/configureSharedData.ts.hbs +0 -67
- package/templates/init/packages/client-admin/src/views/auth/LoginView.tsx +0 -132
- package/templates/init/packages/client-admin/src/views/home/HomeView.tsx +0 -108
- package/templates/init/packages/client-admin/src/views/home/base/employee/EmployeeDetail.tsx.hbs +0 -243
- package/templates/init/packages/client-admin/src/views/home/base/employee/EmployeeSheet.tsx.hbs +0 -271
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RoleDetail.tsx.hbs +0 -146
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RolePermissionDetail.tsx.hbs +0 -121
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RolePermissionView.tsx +0 -52
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RoleSheet.tsx.hbs +0 -125
- package/templates/init/packages/client-admin/src/views/home/main/MainView.tsx.hbs +0 -13
- package/templates/init/packages/client-admin/src/views/home/my-info/MyInfoDetail.tsx.hbs +0 -241
- package/templates/init/packages/client-admin/src/views/home/system/system-log/SystemLogSheet.tsx.hbs +0 -169
- package/templates/init/packages/client-admin/src/views/not-found/NotFoundView.tsx +0 -15
- package/templates/init/packages/client-admin/tailwind.config.ts +0 -10
- package/templates/init/packages/db-main/package.json.hbs +0 -13
- package/templates/init/packages/db-main/src/MainDbContext.ts +0 -22
- package/templates/init/packages/db-main/src/dataLogExt.ts +0 -127
- package/templates/init/packages/db-main/src/index.ts +0 -14
- package/templates/init/packages/db-main/src/tables/base/Employee.ts +0 -24
- package/templates/init/packages/db-main/src/tables/base/EmployeeConfig.ts +0 -13
- package/templates/init/packages/db-main/src/tables/base/Role.ts +0 -9
- package/templates/init/packages/db-main/src/tables/base/RolePermission.ts +0 -13
- package/templates/init/packages/db-main/src/tables/system/_DataLog.ts +0 -19
- package/templates/init/packages/db-main/src/tables/system/_Log.ts +0 -16
- package/templates/init/packages/server/package.json.hbs +0 -20
- package/templates/init/packages/server/public-dev/dev//354/264/210/352/270/260/355/231/224.xlsx +0 -0
- package/templates/init/packages/server/src/index.ts +0 -4
- package/templates/init/packages/server/src/main.ts.hbs +0 -34
- package/templates/init/packages/server/src/services/AuthService.ts.hbs +0 -171
- package/templates/init/packages/server/src/services/DevService.ts.hbs +0 -94
- package/templates/init/packages/server/src/services/EmployeeService.ts.hbs +0 -122
- package/templates/init/packages/server/src/services/RoleService.ts.hbs +0 -59
- package/templates/init/pnpm-workspace.yaml +0 -15
- package/templates/init/sd.config.ts.hbs +0 -48
- package/templates/init/tsconfig.json.hbs +0 -39
- package/templates/init/vitest.config.ts +0 -36
- package/tests/capacitor-exclude.spec.ts +0 -78
- package/tests/capacitor.spec.ts +0 -49
- package/tests/copy-src.spec.ts +0 -50
- package/tests/electron-exclude.spec.ts +0 -61
- package/tests/get-compiler-options-for-package.spec.ts +0 -80
- package/tests/get-package-source-files.spec.ts +0 -139
- package/tests/get-types-from-package-json.spec.ts +0 -92
- package/tests/infra/ResultCollector.spec.ts +0 -30
- package/tests/infra/SignalHandler.spec.ts +0 -38
- package/tests/infra/WorkerManager.spec.ts +0 -63
- package/tests/load-ignore-patterns.spec.ts +0 -163
- package/tests/load-sd-config.spec.ts +0 -100
- package/tests/package-utils.spec.ts +0 -188
- package/tests/parse-root-tsconfig.spec.ts +0 -89
- package/tests/publish-config-narrowing.spec.ts +0 -20
- package/tests/replace-deps.spec.ts +0 -308
- package/tests/run-lint.spec.ts +0 -366
- package/tests/run-typecheck.spec.ts +0 -544
- package/tests/run-watch.spec.ts +0 -76
- package/tests/sd-cli.spec.ts +0 -265
- package/tests/sd-public-dev-plugin-mime.spec.ts +0 -19
- package/tests/tailwind-config-deps.spec.ts +0 -30
- package/tests/template.spec.ts +0 -70
- package/tests/vite-config-exclude.spec.ts +0 -35
- package/tests/vite-config-outdir.spec.ts +0 -38
- package/tests/write-changed-output-files.spec.ts +0 -97
package/tests/capacitor.spec.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from "vitest";
|
|
2
|
-
|
|
3
|
-
vi.mock("@simplysm/core-node", () => ({
|
|
4
|
-
fsx: {
|
|
5
|
-
readJson: vi.fn().mockResolvedValue({ name: "test", version: "1.0.0" }),
|
|
6
|
-
},
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
|
-
vi.mock("consola", () => {
|
|
10
|
-
const withTag = () => ({ debug: vi.fn(), warn: vi.fn() });
|
|
11
|
-
const consola = { withTag };
|
|
12
|
-
return { default: consola, consola };
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
vi.mock("sharp", () => ({ default: vi.fn() }));
|
|
16
|
-
vi.mock("execa", () => ({ execa: vi.fn() }));
|
|
17
|
-
|
|
18
|
-
import { Capacitor } from "../src/capacitor/capacitor";
|
|
19
|
-
|
|
20
|
-
describe("Capacitor appName validation", () => {
|
|
21
|
-
const createConfig = (appName: string) => ({
|
|
22
|
-
appId: "com.test.app",
|
|
23
|
-
appName,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("한글 포함 앱 이름을 허용해야 한다", async () => {
|
|
27
|
-
await expect(
|
|
28
|
-
Capacitor.create("/tmp", createConfig("AD-TEK 기업솔루션")),
|
|
29
|
-
).resolves.toBeDefined();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("ASCII 앱 이름을 허용해야 한다", async () => {
|
|
33
|
-
await expect(
|
|
34
|
-
Capacitor.create("/tmp", createConfig("My App-1")),
|
|
35
|
-
).resolves.toBeDefined();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("파일명 위험 특수문자를 거부해야 한다", async () => {
|
|
39
|
-
await expect(
|
|
40
|
-
Capacitor.create("/tmp", createConfig("App<script>")),
|
|
41
|
-
).rejects.toThrow("invalid characters");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("빈 문자열을 거부해야 한다", async () => {
|
|
45
|
-
await expect(
|
|
46
|
-
Capacitor.create("/tmp", createConfig("")),
|
|
47
|
-
).rejects.toThrow("appName is required");
|
|
48
|
-
});
|
|
49
|
-
});
|
package/tests/copy-src.spec.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import os from "os";
|
|
4
|
-
import fs from "fs/promises";
|
|
5
|
-
import { copySrcFiles } from "../src/utils/copy-src";
|
|
6
|
-
|
|
7
|
-
describe("copySrcFiles", () => {
|
|
8
|
-
let tmpDir: string;
|
|
9
|
-
|
|
10
|
-
beforeEach(async () => {
|
|
11
|
-
tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "copysrc-"));
|
|
12
|
-
// Create src/ structure
|
|
13
|
-
await fs.mkdir(path.join(tmpDir, "src", "components"), { recursive: true });
|
|
14
|
-
await fs.mkdir(path.join(tmpDir, "dist"), { recursive: true });
|
|
15
|
-
await fs.writeFile(path.join(tmpDir, "src", "base.css"), "body {}");
|
|
16
|
-
await fs.writeFile(path.join(tmpDir, "src", "components", "Card.css"), ".card {}");
|
|
17
|
-
await fs.writeFile(path.join(tmpDir, "src", "index.ts"), "export {}");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
afterEach(async () => {
|
|
21
|
-
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("copies files matching glob pattern from src/ to dist/", async () => {
|
|
25
|
-
await copySrcFiles(tmpDir, ["**/*.css"]);
|
|
26
|
-
|
|
27
|
-
const base = await fs.readFile(path.join(tmpDir, "dist", "base.css"), "utf-8");
|
|
28
|
-
expect(base).toBe("body {}");
|
|
29
|
-
|
|
30
|
-
const card = await fs.readFile(path.join(tmpDir, "dist", "components", "Card.css"), "utf-8");
|
|
31
|
-
expect(card).toBe(".card {}");
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("does not copy files that don't match pattern", async () => {
|
|
35
|
-
await copySrcFiles(tmpDir, ["**/*.css"]);
|
|
36
|
-
|
|
37
|
-
const exists = await fs.access(path.join(tmpDir, "dist", "index.ts")).then(
|
|
38
|
-
() => true,
|
|
39
|
-
() => false,
|
|
40
|
-
);
|
|
41
|
-
expect(exists).toBe(false);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("copies nothing if pattern is empty array", async () => {
|
|
45
|
-
await copySrcFiles(tmpDir, []);
|
|
46
|
-
|
|
47
|
-
const files = await fs.readdir(path.join(tmpDir, "dist"));
|
|
48
|
-
expect(files).toHaveLength(0);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
|
|
3
|
-
const { mockWriteJson, mockReadJson } = vi.hoisted(() => ({
|
|
4
|
-
mockWriteJson: vi.fn().mockResolvedValue(undefined),
|
|
5
|
-
mockReadJson: vi.fn(),
|
|
6
|
-
}));
|
|
7
|
-
|
|
8
|
-
vi.mock("@simplysm/core-node", () => ({
|
|
9
|
-
fsx: {
|
|
10
|
-
readJson: mockReadJson,
|
|
11
|
-
mkdir: vi.fn().mockResolvedValue(undefined),
|
|
12
|
-
writeJson: mockWriteJson,
|
|
13
|
-
},
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
vi.mock("consola", () => {
|
|
17
|
-
const withTag = () => ({ debug: vi.fn(), warn: vi.fn() });
|
|
18
|
-
const consola = { withTag };
|
|
19
|
-
return { default: consola, consola };
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
import { Electron } from "../src/electron/electron";
|
|
23
|
-
|
|
24
|
-
describe("Electron exclude packages", () => {
|
|
25
|
-
beforeEach(() => {
|
|
26
|
-
vi.clearAllMocks();
|
|
27
|
-
mockReadJson.mockResolvedValue({
|
|
28
|
-
name: "@test/app",
|
|
29
|
-
version: "1.0.0",
|
|
30
|
-
dependencies: { "jeep-sqlite": "^0.0.1" },
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("exclude 패키지가 .electron/src/package.json dependencies에 추가된다", async () => {
|
|
35
|
-
const electron = await Electron.create("/test/packages/app", {
|
|
36
|
-
appId: "com.test.app",
|
|
37
|
-
}, ["jeep-sqlite"]);
|
|
38
|
-
|
|
39
|
-
await (electron as unknown as { _setupPackageJson(p: string): Promise<void> })._setupPackageJson("/test/packages/app/.electron/src");
|
|
40
|
-
|
|
41
|
-
expect(mockWriteJson).toHaveBeenCalled();
|
|
42
|
-
const writtenConfig = mockWriteJson.mock.calls[0][1] as {
|
|
43
|
-
dependencies: Record<string, string>;
|
|
44
|
-
};
|
|
45
|
-
expect(writtenConfig.dependencies["jeep-sqlite"]).toBe("^0.0.1");
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("exclude 없이 생성해도 정상 동작한다", async () => {
|
|
49
|
-
const electron = await Electron.create("/test/packages/app", {
|
|
50
|
-
appId: "com.test.app",
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
await (electron as unknown as { _setupPackageJson(p: string): Promise<void> })._setupPackageJson("/test/packages/app/.electron/src");
|
|
54
|
-
|
|
55
|
-
expect(mockWriteJson).toHaveBeenCalled();
|
|
56
|
-
const writtenConfig = mockWriteJson.mock.calls[0][1] as {
|
|
57
|
-
dependencies: Record<string, string>;
|
|
58
|
-
};
|
|
59
|
-
expect(writtenConfig.dependencies["jeep-sqlite"]).toBeUndefined();
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import type ts from "typescript";
|
|
3
|
-
|
|
4
|
-
// Mock core-node functions
|
|
5
|
-
vi.mock("@simplysm/core-node", () => ({
|
|
6
|
-
fsx: {
|
|
7
|
-
exists: vi.fn(),
|
|
8
|
-
readJson: vi.fn(),
|
|
9
|
-
},
|
|
10
|
-
pathx: {
|
|
11
|
-
posix: vi.fn((p: string) => p.replace(/\\/g, "/")),
|
|
12
|
-
},
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
import { fsx } from "@simplysm/core-node";
|
|
16
|
-
import { getCompilerOptionsForPackage } from "../src/utils/tsconfig";
|
|
17
|
-
|
|
18
|
-
describe("getCompilerOptionsForPackage", () => {
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
vi.clearAllMocks();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
afterEach(() => {
|
|
24
|
-
vi.restoreAllMocks();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const baseOptions: ts.CompilerOptions = {
|
|
28
|
-
lib: ["ES2024", "DOM", "DOM.Iterable", "WebWorker"],
|
|
29
|
-
types: [],
|
|
30
|
-
strict: true,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
it("node target: removes DOM lib, includes node in types", async () => {
|
|
34
|
-
const packageDir = "/project/packages/core-node";
|
|
35
|
-
vi.mocked(fsx.exists).mockResolvedValue(true);
|
|
36
|
-
vi.mocked(fsx.readJson).mockResolvedValue({
|
|
37
|
-
devDependencies: {
|
|
38
|
-
"@types/express": "^4.17.0",
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const result = await getCompilerOptionsForPackage(baseOptions, "node", packageDir);
|
|
43
|
-
|
|
44
|
-
// DOM, WebWorker lib removed
|
|
45
|
-
expect(result.lib).toEqual(["ES2024"]);
|
|
46
|
-
// types includes node and express
|
|
47
|
-
expect(result.types).toContain("node");
|
|
48
|
-
expect(result.types).toContain("express");
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("browser target: keeps lib, removes node from types", async () => {
|
|
52
|
-
const packageDir = "/project/packages/core-browser";
|
|
53
|
-
vi.mocked(fsx.exists).mockResolvedValue(true);
|
|
54
|
-
vi.mocked(fsx.readJson).mockResolvedValue({
|
|
55
|
-
devDependencies: {
|
|
56
|
-
"@types/node": "^20.0.0",
|
|
57
|
-
"@types/react": "^18.0.0",
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const result = await getCompilerOptionsForPackage(baseOptions, "browser", packageDir);
|
|
62
|
-
|
|
63
|
-
// lib is preserved
|
|
64
|
-
expect(result.lib).toEqual(["ES2024", "DOM", "DOM.Iterable", "WebWorker"]);
|
|
65
|
-
// types removes node, includes react only
|
|
66
|
-
expect(result.types).not.toContain("node");
|
|
67
|
-
expect(result.types).toContain("react");
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it("handles missing package.json with empty types", async () => {
|
|
71
|
-
const packageDir = "/project/packages/unknown";
|
|
72
|
-
vi.mocked(fsx.exists).mockResolvedValue(false);
|
|
73
|
-
|
|
74
|
-
const result = await getCompilerOptionsForPackage(baseOptions, "node", packageDir);
|
|
75
|
-
|
|
76
|
-
// includes only node (types from package are empty array)
|
|
77
|
-
expect(result.types).toEqual(["node"]);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
});
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import type ts from "typescript";
|
|
4
|
-
import { getPackageSourceFiles, getPackageFiles } from "../src/utils/tsconfig";
|
|
5
|
-
|
|
6
|
-
describe("getPackageSourceFiles", () => {
|
|
7
|
-
it("filters files within package src directory only", () => {
|
|
8
|
-
const pkgDir = `/project/packages/core-common`;
|
|
9
|
-
const parsedConfig = {
|
|
10
|
-
fileNames: [
|
|
11
|
-
`/project/packages/core-common/src/index.ts`,
|
|
12
|
-
`/project/packages/core-common/src/utils/string.ts`,
|
|
13
|
-
`/project/packages/core-common/tests/utils.spec.ts`,
|
|
14
|
-
`/project/packages/core-node/src/index.ts`,
|
|
15
|
-
],
|
|
16
|
-
} as ts.ParsedCommandLine;
|
|
17
|
-
|
|
18
|
-
const result = getPackageSourceFiles(pkgDir, parsedConfig);
|
|
19
|
-
|
|
20
|
-
expect(result).toEqual([
|
|
21
|
-
`/project/packages/core-common/src/index.ts`,
|
|
22
|
-
`/project/packages/core-common/src/utils/string.ts`,
|
|
23
|
-
]);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("excludes files from similar package names (core vs core-common)", () => {
|
|
27
|
-
const pkgDir = `/project/packages/core`;
|
|
28
|
-
const parsedConfig = {
|
|
29
|
-
fileNames: [
|
|
30
|
-
`/project/packages/core/src/index.ts`,
|
|
31
|
-
`/project/packages/core-common/src/index.ts`,
|
|
32
|
-
`/project/packages/core-node/src/index.ts`,
|
|
33
|
-
],
|
|
34
|
-
} as ts.ParsedCommandLine;
|
|
35
|
-
|
|
36
|
-
const result = getPackageSourceFiles(pkgDir, parsedConfig);
|
|
37
|
-
|
|
38
|
-
// core-common, core-node are excluded, only core is included
|
|
39
|
-
expect(result).toEqual([`/project/packages/core/src/index.ts`]);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("excludes files outside src directory (tests, scripts, etc)", () => {
|
|
43
|
-
const pkgDir = `/project/packages/cli`;
|
|
44
|
-
const parsedConfig = {
|
|
45
|
-
fileNames: [
|
|
46
|
-
`/project/packages/cli/src/index.ts`,
|
|
47
|
-
`/project/packages/cli/src/commands/lint.ts`,
|
|
48
|
-
`/project/packages/cli/tests/lint.spec.ts`,
|
|
49
|
-
`/project/packages/cli/scripts/build.ts`,
|
|
50
|
-
],
|
|
51
|
-
} as ts.ParsedCommandLine;
|
|
52
|
-
|
|
53
|
-
const result = getPackageSourceFiles(pkgDir, parsedConfig);
|
|
54
|
-
|
|
55
|
-
expect(result).toEqual([
|
|
56
|
-
`/project/packages/cli/src/index.ts`,
|
|
57
|
-
`/project/packages/cli/src/commands/lint.ts`,
|
|
58
|
-
]);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it("handles forward slash paths from TypeScript API correctly (Windows compatible)", () => {
|
|
62
|
-
// TypeScript API returns forward slash paths even on Windows
|
|
63
|
-
// pkgDir is created with path.join using OS-native separator
|
|
64
|
-
const pkgDir = path.resolve("/project/packages/core-common");
|
|
65
|
-
const parsedConfig = {
|
|
66
|
-
fileNames: [
|
|
67
|
-
"/project/packages/core-common/src/index.ts",
|
|
68
|
-
"/project/packages/core-common/src/utils/string.ts",
|
|
69
|
-
"/project/packages/core-common/tests/utils.spec.ts",
|
|
70
|
-
"/project/packages/core-node/src/index.ts",
|
|
71
|
-
],
|
|
72
|
-
} as ts.ParsedCommandLine;
|
|
73
|
-
|
|
74
|
-
const result = getPackageSourceFiles(pkgDir, parsedConfig);
|
|
75
|
-
|
|
76
|
-
expect(result).toHaveLength(2);
|
|
77
|
-
expect(result.every((f) => f.includes("core-common") && f.includes("src"))).toBe(true);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
describe("getPackageFiles", () => {
|
|
82
|
-
it("filters all files within package directory (src + tests)", () => {
|
|
83
|
-
const pkgDir = `/project/packages/core-common`;
|
|
84
|
-
const parsedConfig = {
|
|
85
|
-
fileNames: [
|
|
86
|
-
`/project/packages/core-common/src/index.ts`,
|
|
87
|
-
`/project/packages/core-common/src/utils/string.ts`,
|
|
88
|
-
`/project/packages/core-common/tests/utils.spec.ts`,
|
|
89
|
-
`/project/packages/core-common/tests/setup/helpers.ts`,
|
|
90
|
-
`/project/packages/core-node/src/index.ts`,
|
|
91
|
-
`/project/packages/core-node/tests/fs.spec.ts`,
|
|
92
|
-
],
|
|
93
|
-
} as ts.ParsedCommandLine;
|
|
94
|
-
|
|
95
|
-
const result = getPackageFiles(pkgDir, parsedConfig);
|
|
96
|
-
|
|
97
|
-
expect(result).toEqual([
|
|
98
|
-
`/project/packages/core-common/src/index.ts`,
|
|
99
|
-
`/project/packages/core-common/src/utils/string.ts`,
|
|
100
|
-
`/project/packages/core-common/tests/utils.spec.ts`,
|
|
101
|
-
`/project/packages/core-common/tests/setup/helpers.ts`,
|
|
102
|
-
]);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it("excludes files from similar package names (core vs core-common)", () => {
|
|
106
|
-
const pkgDir = `/project/packages/core`;
|
|
107
|
-
const parsedConfig = {
|
|
108
|
-
fileNames: [
|
|
109
|
-
`/project/packages/core/src/index.ts`,
|
|
110
|
-
`/project/packages/core/tests/utils.spec.ts`,
|
|
111
|
-
`/project/packages/core-common/src/index.ts`,
|
|
112
|
-
`/project/packages/core-common/tests/utils.spec.ts`,
|
|
113
|
-
],
|
|
114
|
-
} as ts.ParsedCommandLine;
|
|
115
|
-
|
|
116
|
-
const result = getPackageFiles(pkgDir, parsedConfig);
|
|
117
|
-
|
|
118
|
-
expect(result).toEqual([
|
|
119
|
-
`/project/packages/core/src/index.ts`,
|
|
120
|
-
`/project/packages/core/tests/utils.spec.ts`,
|
|
121
|
-
]);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it("handles forward slash paths from TypeScript API correctly (Windows compatible)", () => {
|
|
125
|
-
const pkgDir = path.resolve("/project/packages/core-common");
|
|
126
|
-
const parsedConfig = {
|
|
127
|
-
fileNames: [
|
|
128
|
-
"/project/packages/core-common/src/index.ts",
|
|
129
|
-
"/project/packages/core-common/tests/utils.spec.ts",
|
|
130
|
-
"/project/packages/core-node/src/index.ts",
|
|
131
|
-
],
|
|
132
|
-
} as ts.ParsedCommandLine;
|
|
133
|
-
|
|
134
|
-
const result = getPackageFiles(pkgDir, parsedConfig);
|
|
135
|
-
|
|
136
|
-
expect(result).toHaveLength(2);
|
|
137
|
-
expect(result.every((f) => f.includes("core-common"))).toBe(true);
|
|
138
|
-
});
|
|
139
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import path from "path";
|
|
3
|
-
|
|
4
|
-
// Mock core-node functions
|
|
5
|
-
vi.mock("@simplysm/core-node", () => ({
|
|
6
|
-
fsx: {
|
|
7
|
-
exists: vi.fn(),
|
|
8
|
-
readJson: vi.fn(),
|
|
9
|
-
},
|
|
10
|
-
pathx: {
|
|
11
|
-
posix: vi.fn((p: string) => p.replace(/\\/g, "/")),
|
|
12
|
-
},
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
import { fsx } from "@simplysm/core-node";
|
|
16
|
-
import { getTypesFromPackageJson } from "../src/utils/tsconfig";
|
|
17
|
-
|
|
18
|
-
describe("getTypesFromPackageJson", () => {
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
vi.clearAllMocks();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
afterEach(() => {
|
|
24
|
-
vi.restoreAllMocks();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("converts @types/* devDependencies to types list", async () => {
|
|
28
|
-
const packageDir = "/project/packages/core-common";
|
|
29
|
-
const mockFsExists = vi.mocked(fsx.exists);
|
|
30
|
-
const mockFsReadJson = vi.mocked(fsx.readJson);
|
|
31
|
-
|
|
32
|
-
mockFsExists.mockResolvedValue(true);
|
|
33
|
-
mockFsReadJson.mockResolvedValue({
|
|
34
|
-
devDependencies: {
|
|
35
|
-
"@types/node": "^20.0.0",
|
|
36
|
-
"@types/express": "^4.17.0",
|
|
37
|
-
"typescript": "^5.0.0",
|
|
38
|
-
"vitest": "^1.0.0",
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const result = await getTypesFromPackageJson(packageDir);
|
|
43
|
-
|
|
44
|
-
expect(mockFsExists).toHaveBeenCalledWith(path.join(packageDir, "package.json"));
|
|
45
|
-
expect(result).toEqual(["node", "express"]);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("returns empty array if package.json does not exist", async () => {
|
|
49
|
-
const packageDir = "/project/packages/unknown";
|
|
50
|
-
const mockFsExists = vi.mocked(fsx.exists);
|
|
51
|
-
|
|
52
|
-
mockFsExists.mockResolvedValue(false);
|
|
53
|
-
|
|
54
|
-
const result = await getTypesFromPackageJson(packageDir);
|
|
55
|
-
|
|
56
|
-
expect(result).toEqual([]);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it("returns empty array if devDependencies does not exist", async () => {
|
|
60
|
-
const packageDir = "/project/packages/core-common";
|
|
61
|
-
const mockFsExists = vi.mocked(fsx.exists);
|
|
62
|
-
const mockFsReadJson = vi.mocked(fsx.readJson);
|
|
63
|
-
|
|
64
|
-
mockFsExists.mockResolvedValue(true);
|
|
65
|
-
mockFsReadJson.mockResolvedValue({
|
|
66
|
-
name: "@simplysm/core-common",
|
|
67
|
-
version: "1.0.0",
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const result = await getTypesFromPackageJson(packageDir);
|
|
71
|
-
|
|
72
|
-
expect(result).toEqual([]);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("handles scoped @types packages correctly", async () => {
|
|
76
|
-
const packageDir = "/project/packages/core-common";
|
|
77
|
-
const mockFsExists = vi.mocked(fsx.exists);
|
|
78
|
-
const mockFsReadJson = vi.mocked(fsx.readJson);
|
|
79
|
-
|
|
80
|
-
mockFsExists.mockResolvedValue(true);
|
|
81
|
-
mockFsReadJson.mockResolvedValue({
|
|
82
|
-
devDependencies: {
|
|
83
|
-
"@types/node": "^20.0.0",
|
|
84
|
-
"@types/babel__core": "^7.0.0",
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const result = await getTypesFromPackageJson(packageDir);
|
|
89
|
-
|
|
90
|
-
expect(result).toEqual(["node", "babel__core"]);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { ResultCollector, type BuildResult } from "../../src/infra/ResultCollector";
|
|
3
|
-
|
|
4
|
-
describe("ResultCollector", () => {
|
|
5
|
-
it("adds and retrieves result", () => {
|
|
6
|
-
const collector = new ResultCollector();
|
|
7
|
-
const result: BuildResult = {
|
|
8
|
-
name: "core-common",
|
|
9
|
-
target: "neutral",
|
|
10
|
-
type: "build",
|
|
11
|
-
status: "success",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
collector.add(result);
|
|
15
|
-
|
|
16
|
-
expect(collector.get("core-common:build")).toEqual(result);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("overwrites result when added with same key", () => {
|
|
20
|
-
const collector = new ResultCollector();
|
|
21
|
-
collector.add({ name: "pkg1", target: "node", type: "build", status: "pending" });
|
|
22
|
-
collector.add({ name: "pkg1", target: "node", type: "build", status: "success" });
|
|
23
|
-
|
|
24
|
-
const result = collector.get("pkg1:build");
|
|
25
|
-
|
|
26
|
-
expect(result?.status).toBe("success");
|
|
27
|
-
expect(collector.toMap().size).toBe(1);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, afterEach } from "vitest";
|
|
2
|
-
import { SignalHandler } from "../../src/infra/SignalHandler";
|
|
3
|
-
|
|
4
|
-
describe("SignalHandler", () => {
|
|
5
|
-
afterEach(() => {
|
|
6
|
-
// Clean up process listeners between tests
|
|
7
|
-
process.removeAllListeners("SIGINT");
|
|
8
|
-
process.removeAllListeners("SIGTERM");
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("resolves waitForTermination when termination is requested", async () => {
|
|
12
|
-
const handler = new SignalHandler();
|
|
13
|
-
|
|
14
|
-
// Request termination asynchronously
|
|
15
|
-
setTimeout(() => handler.requestTermination(), 10);
|
|
16
|
-
|
|
17
|
-
await expect(handler.waitForTermination()).resolves.toBeUndefined();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("returns termination status correctly", () => {
|
|
21
|
-
const handler = new SignalHandler();
|
|
22
|
-
|
|
23
|
-
expect(handler.isTerminated()).toBe(false);
|
|
24
|
-
|
|
25
|
-
handler.requestTermination();
|
|
26
|
-
|
|
27
|
-
expect(handler.isTerminated()).toBe(true);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("ignores duplicate termination requests", () => {
|
|
31
|
-
const handler = new SignalHandler();
|
|
32
|
-
|
|
33
|
-
handler.requestTermination();
|
|
34
|
-
handler.requestTermination(); // Second call is ignored
|
|
35
|
-
|
|
36
|
-
expect(handler.isTerminated()).toBe(true);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
-
import { WorkerManager } from "../../src/infra/WorkerManager";
|
|
3
|
-
|
|
4
|
-
// Mock Worker
|
|
5
|
-
vi.mock("@simplysm/core-node", () => ({
|
|
6
|
-
Worker: {
|
|
7
|
-
create: vi.fn(() => ({
|
|
8
|
-
on: vi.fn(),
|
|
9
|
-
off: vi.fn(),
|
|
10
|
-
terminate: vi.fn().mockResolvedValue(undefined),
|
|
11
|
-
})),
|
|
12
|
-
},
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
describe("WorkerManager", () => {
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
vi.clearAllMocks();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("creates a Worker and retrieves it by ID", () => {
|
|
21
|
-
const manager = new WorkerManager();
|
|
22
|
-
|
|
23
|
-
const worker = manager.create("test-worker", "/path/to/worker.ts");
|
|
24
|
-
|
|
25
|
-
expect(worker).toBeDefined();
|
|
26
|
-
expect(manager.get("test-worker")).toBe(worker);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("terminates all Workers", async () => {
|
|
30
|
-
const manager = new WorkerManager();
|
|
31
|
-
const worker1 = manager.create("worker1", "/path/to/worker.ts");
|
|
32
|
-
const worker2 = manager.create("worker2", "/path/to/worker.ts");
|
|
33
|
-
|
|
34
|
-
await manager.terminateAll();
|
|
35
|
-
|
|
36
|
-
expect(worker1.terminate).toHaveBeenCalled();
|
|
37
|
-
expect(worker2.terminate).toHaveBeenCalled();
|
|
38
|
-
expect(manager.size).toBe(0);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("terminates a specific Worker only", async () => {
|
|
42
|
-
const manager = new WorkerManager();
|
|
43
|
-
const worker1 = manager.create("worker1", "/path/to/worker.ts");
|
|
44
|
-
const worker2 = manager.create("worker2", "/path/to/worker.ts");
|
|
45
|
-
|
|
46
|
-
await manager.terminate("worker1");
|
|
47
|
-
|
|
48
|
-
expect(worker1.terminate).toHaveBeenCalled();
|
|
49
|
-
expect(worker2.terminate).not.toHaveBeenCalled();
|
|
50
|
-
expect(manager.get("worker1")).toBeUndefined();
|
|
51
|
-
expect(manager.get("worker2")).toBe(worker2);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("overwrites existing Worker when creating with the same ID", () => {
|
|
55
|
-
const manager = new WorkerManager();
|
|
56
|
-
const worker1 = manager.create("same-id", "/path/to/worker1.ts");
|
|
57
|
-
const worker2 = manager.create("same-id", "/path/to/worker2.ts");
|
|
58
|
-
|
|
59
|
-
expect(manager.get("same-id")).toBe(worker2);
|
|
60
|
-
expect(manager.get("same-id")).not.toBe(worker1);
|
|
61
|
-
expect(manager.size).toBe(1);
|
|
62
|
-
});
|
|
63
|
-
});
|