@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
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { auth, defineService, type ServiceMethods } from "@simplysm/service-server";
|
|
2
|
-
import { createOrm, type DbConnConfig } from "@simplysm/orm-node";
|
|
3
|
-
import { expr } from "@simplysm/orm-common";
|
|
4
|
-
import { MainDbContext, type MainDbContext as MainDbContextType } from "@{{projectName}}/db-main";
|
|
5
|
-
import bcrypt from "bcrypt";
|
|
6
|
-
|
|
7
|
-
export interface IAuthData {
|
|
8
|
-
employeeId: number;
|
|
9
|
-
employeeName: string;
|
|
10
|
-
email: string;
|
|
11
|
-
permissions: Record<string, boolean>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface IAuthResult extends IAuthData {
|
|
15
|
-
token: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const AuthService = defineService("AuthService", (ctx) => {
|
|
19
|
-
async function getOrm() {
|
|
20
|
-
const ormConfig = await ctx.getConfig<{ default: DbConnConfig }>("orm");
|
|
21
|
-
|
|
22
|
-
return createOrm(MainDbContext, ormConfig.default);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async function getPermissions(
|
|
26
|
-
db: MainDbContextType,
|
|
27
|
-
roleId: number | undefined,
|
|
28
|
-
): Promise<Record<string, boolean>> {
|
|
29
|
-
const permissions: Record<string, boolean> = {};
|
|
30
|
-
|
|
31
|
-
if (roleId != null) {
|
|
32
|
-
const rolePermissions = await db
|
|
33
|
-
.rolePermission()
|
|
34
|
-
.where((c) => [expr.eq(c.roleId, roleId)])
|
|
35
|
-
.result();
|
|
36
|
-
|
|
37
|
-
for (const rp of rolePermissions) {
|
|
38
|
-
permissions[rp.code] = JSON.parse(rp.valueJson);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return permissions;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function buildAuthResult(
|
|
46
|
-
employee: { id: number; name: string; email: string | undefined },
|
|
47
|
-
permissions: Record<string, boolean>,
|
|
48
|
-
): Promise<IAuthResult> {
|
|
49
|
-
const authData: IAuthData = {
|
|
50
|
-
employeeId: employee.id,
|
|
51
|
-
employeeName: employee.name,
|
|
52
|
-
email: employee.email ?? "",
|
|
53
|
-
permissions,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const token = await ctx.server.generateAuthToken({
|
|
57
|
-
roles: [],
|
|
58
|
-
data: authData,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
return { token, ...authData };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function validateLoginInput(email: string, password: string): void {
|
|
65
|
-
if (email.length === 0 || email.length > 200) {
|
|
66
|
-
throw new Error("이메일은 1~200자의 문자열이어야 합니다.");
|
|
67
|
-
}
|
|
68
|
-
if (password.length === 0 || password.length > 500) {
|
|
69
|
-
throw new Error("비밀번호는 1~500자의 문자열이어야 합니다.");
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
login: async (email: string, password: string): Promise<IAuthResult> => {
|
|
75
|
-
const orm = await getOrm();
|
|
76
|
-
validateLoginInput(email, password);
|
|
77
|
-
|
|
78
|
-
return orm.connect(async (db) => {
|
|
79
|
-
const employee = await db
|
|
80
|
-
.employee()
|
|
81
|
-
.where((c) => [expr.eq(c.email, email), expr.eq(c.isDeleted, false)])
|
|
82
|
-
.single();
|
|
83
|
-
|
|
84
|
-
if (!employee) {
|
|
85
|
-
throw new Error("이메일 또는 비밀번호가 올바르지 않습니다.");
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (employee.encryptedPassword == null || employee.encryptedPassword === "") {
|
|
89
|
-
throw new Error("비밀번호가 설정되지 않은 계정입니다.");
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const isValid = await bcrypt.compare(password, employee.encryptedPassword);
|
|
93
|
-
if (!isValid) {
|
|
94
|
-
throw new Error("이메일 또는 비밀번호가 올바르지 않습니다.");
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const permissions = await getPermissions(db, employee.roleId);
|
|
98
|
-
|
|
99
|
-
return buildAuthResult(employee, permissions);
|
|
100
|
-
});
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
refresh: auth(async (): Promise<IAuthResult> => {
|
|
104
|
-
const currentAuth = ctx.authInfo as IAuthData | undefined;
|
|
105
|
-
if (!currentAuth) {
|
|
106
|
-
throw new Error("인증 정보가 없습니다.");
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const orm = await getOrm();
|
|
110
|
-
|
|
111
|
-
return orm.connect(async (db) => {
|
|
112
|
-
const employee = await db
|
|
113
|
-
.employee()
|
|
114
|
-
.where((c) => [expr.eq(c.id, currentAuth.employeeId), expr.eq(c.isDeleted, false)])
|
|
115
|
-
.single();
|
|
116
|
-
|
|
117
|
-
if (!employee) {
|
|
118
|
-
throw new Error("유효하지 않은 직원입니다.");
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const permissions = await getPermissions(db, employee.roleId);
|
|
122
|
-
|
|
123
|
-
return buildAuthResult(employee, permissions);
|
|
124
|
-
});
|
|
125
|
-
}),
|
|
126
|
-
|
|
127
|
-
changePassword: auth(async (currentPassword: string, newPassword: string): Promise<void> => {
|
|
128
|
-
const currentAuth = ctx.authInfo as IAuthData | undefined;
|
|
129
|
-
if (!currentAuth) {
|
|
130
|
-
throw new Error("인증 정보가 없습니다.");
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
validateLoginInput(currentAuth.email, currentPassword);
|
|
134
|
-
validateLoginInput(currentAuth.email, newPassword);
|
|
135
|
-
|
|
136
|
-
if (newPassword.length < 8) {
|
|
137
|
-
throw new Error("새 비밀번호는 최소 8자 이상이어야 합니다.");
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const orm = await getOrm();
|
|
141
|
-
|
|
142
|
-
await orm.connect(async (db) => {
|
|
143
|
-
const employee = await db
|
|
144
|
-
.employee()
|
|
145
|
-
.where((c) => [expr.eq(c.id, currentAuth.employeeId), expr.eq(c.isDeleted, false)])
|
|
146
|
-
.single();
|
|
147
|
-
|
|
148
|
-
if (!employee) {
|
|
149
|
-
throw new Error("유효하지 않은 직원입니다.");
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (employee.encryptedPassword == null || employee.encryptedPassword === "") {
|
|
153
|
-
throw new Error("비밀번호가 설정되지 않은 계정입니다.");
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const isCurrentValid = await bcrypt.compare(currentPassword, employee.encryptedPassword);
|
|
157
|
-
if (!isCurrentValid) {
|
|
158
|
-
throw new Error("현재 비밀번호가 올바르지 않습니다.");
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const encryptedPassword = await bcrypt.hash(newPassword, 10);
|
|
162
|
-
await db
|
|
163
|
-
.employee()
|
|
164
|
-
.where((c) => [expr.eq(c.id, employee.id)])
|
|
165
|
-
.update(() => ({ encryptedPassword: expr.val("string", encryptedPassword) }));
|
|
166
|
-
});
|
|
167
|
-
}),
|
|
168
|
-
};
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
export type AuthServiceMethods = ServiceMethods<typeof AuthService>;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { defineService, type ServiceMethods } from "@simplysm/service-server";
|
|
2
|
-
import { createOrm, type DbConnConfig } from "@simplysm/orm-node";
|
|
3
|
-
import { MainDbContext } from "@{{projectName}}/db-main";
|
|
4
|
-
import { ExcelWorkbook } from "@simplysm/excel";
|
|
5
|
-
import bcrypt from "bcrypt";
|
|
6
|
-
import fs from "fs";
|
|
7
|
-
import path from "path";
|
|
8
|
-
|
|
9
|
-
export const DevService = defineService("DevService", (ctx) => {
|
|
10
|
-
async function getOrm() {
|
|
11
|
-
const ormConfig = await ctx.getConfig<{ default: DbConnConfig }>("orm");
|
|
12
|
-
return createOrm(MainDbContext, ormConfig.default);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
initDb: async (permCodes: string[]) => {
|
|
17
|
-
const orm = await getOrm();
|
|
18
|
-
|
|
19
|
-
await orm.connectWithoutTransaction(async (db) => {
|
|
20
|
-
await db.initialize({ force: true });
|
|
21
|
-
|
|
22
|
-
const excelPath = path.resolve(ctx.server.options.rootPath, "dev/초기화.xlsx");
|
|
23
|
-
if (!fs.existsSync(excelPath)) {
|
|
24
|
-
throw new Error(`초기화 파일을 찾을 수 없습니다: ${excelPath}`);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const buffer = fs.readFileSync(excelPath);
|
|
28
|
-
const wb = new ExcelWorkbook(buffer);
|
|
29
|
-
const wsNames = await wb.getWorksheetNames();
|
|
30
|
-
|
|
31
|
-
// Role
|
|
32
|
-
if (wsNames.includes("권한그룹")) {
|
|
33
|
-
const ws = await wb.getWorksheet("권한그룹");
|
|
34
|
-
const rows = await ws.getDataTable();
|
|
35
|
-
const filtered = rows.filter((r: Record<string, any>) => r["ID"] != null);
|
|
36
|
-
if (filtered.length > 0) {
|
|
37
|
-
await db.role().insert(
|
|
38
|
-
filtered.map((r: Record<string, any>) => ({
|
|
39
|
-
id: Number(r["ID"]),
|
|
40
|
-
name: String(r["명칭"]),
|
|
41
|
-
})),
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// RolePermission
|
|
47
|
-
if (wsNames.includes("권한그룹권한")) {
|
|
48
|
-
const ws = await wb.getWorksheet("권한그룹권한");
|
|
49
|
-
const rows = await ws.getDataTable();
|
|
50
|
-
const filtered = rows.filter((r: Record<string, any>) => r["권한그룹.ID"] != null);
|
|
51
|
-
if (filtered.length > 0) {
|
|
52
|
-
const permRows = filtered.flatMap((r: Record<string, any>) => {
|
|
53
|
-
const roleId = Number(r["권한그룹.ID"]);
|
|
54
|
-
const code = String(r["코드"]);
|
|
55
|
-
const valueJson = String(r["값"]);
|
|
56
|
-
|
|
57
|
-
if (code === "ALL") {
|
|
58
|
-
return permCodes.map((pc) => ({ roleId, code: pc, valueJson }));
|
|
59
|
-
}
|
|
60
|
-
return [{ roleId, code, valueJson }];
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
await db.rolePermission().insert(permRows);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Employee (bcrypt hash passwords)
|
|
68
|
-
if (wsNames.includes("직원")) {
|
|
69
|
-
const ws = await wb.getWorksheet("직원");
|
|
70
|
-
const rows = await ws.getDataTable();
|
|
71
|
-
const filtered = rows.filter((r: Record<string, any>) => r["ID"] != null);
|
|
72
|
-
if (filtered.length > 0) {
|
|
73
|
-
const employees = [];
|
|
74
|
-
for (const r of filtered) {
|
|
75
|
-
const pw = r["비밀번호"];
|
|
76
|
-
employees.push({
|
|
77
|
-
id: Number(r["ID"]),
|
|
78
|
-
name: String(r["이름"]),
|
|
79
|
-
email: r["이메일"] != null ? String(r["이메일"]) : undefined,
|
|
80
|
-
encryptedPassword:
|
|
81
|
-
pw != null && String(pw) !== "" ? await bcrypt.hash(String(pw), 10) : undefined,
|
|
82
|
-
roleId: r["권한그룹.ID"] != null ? Number(r["권한그룹.ID"]) : undefined,
|
|
83
|
-
isDeleted: Boolean(r["삭제"]),
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
await db.employee().insert(employees);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
export type DevServiceMethods = ServiceMethods<typeof DevService>;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { auth, defineService, type ServiceMethods } from "@simplysm/service-server";
|
|
2
|
-
import { createOrm, type DbConnConfig } from "@simplysm/orm-node";
|
|
3
|
-
import { expr } from "@simplysm/orm-common";
|
|
4
|
-
import { MainDbContext } from "@{{projectName}}/db-main";
|
|
5
|
-
import { DateOnly, strIsNullOrEmpty } from "@simplysm/core-common";
|
|
6
|
-
import bcrypt from "bcrypt";
|
|
7
|
-
import type { IAuthData } from "./AuthService";
|
|
8
|
-
|
|
9
|
-
export const EmployeeService = defineService("EmployeeService", (ctx) => {
|
|
10
|
-
async function getOrm() {
|
|
11
|
-
const ormConfig = await ctx.getConfig<{ default: DbConnConfig }>("orm");
|
|
12
|
-
return createOrm(MainDbContext, ormConfig.default);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
save: auth(
|
|
17
|
-
async (
|
|
18
|
-
items: {
|
|
19
|
-
id?: number;
|
|
20
|
-
name?: string;
|
|
21
|
-
email?: string;
|
|
22
|
-
phoneNumber?: string;
|
|
23
|
-
birthDate?: DateOnly;
|
|
24
|
-
enteringDate?: DateOnly;
|
|
25
|
-
leavingDate?: DateOnly;
|
|
26
|
-
socialSecurityNumber?: string;
|
|
27
|
-
payrollAccountBank?: string;
|
|
28
|
-
payrollAccountNumber?: string;
|
|
29
|
-
password?: string;
|
|
30
|
-
isDeleted: boolean;
|
|
31
|
-
}[],
|
|
32
|
-
): Promise<number[]> => {
|
|
33
|
-
const authData = ctx.authInfo as IAuthData | undefined;
|
|
34
|
-
if (authData?.permissions["/home/base/employee/edit"] !== true) {
|
|
35
|
-
throw new Error("저장 권한이 없습니다.");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const ids: number[] = [];
|
|
39
|
-
const orm = await getOrm();
|
|
40
|
-
await orm.connect(async (db) => {
|
|
41
|
-
for (const item of items) {
|
|
42
|
-
if (
|
|
43
|
-
!item.isDeleted &&
|
|
44
|
-
!strIsNullOrEmpty(item.name) &&
|
|
45
|
-
(await db
|
|
46
|
-
.employee()
|
|
47
|
-
.where((c) => [
|
|
48
|
-
expr.not(expr.eq(c.id, item.id)),
|
|
49
|
-
expr.eq(c.isDeleted, false),
|
|
50
|
-
expr.eq(c.name, item.name),
|
|
51
|
-
])
|
|
52
|
-
.exists())
|
|
53
|
-
) {
|
|
54
|
-
throw new Error(`동일한 이름이 이미 등록되어 있습니다: ${item.name}`);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
!item.isDeleted &&
|
|
59
|
-
!strIsNullOrEmpty(item.email) &&
|
|
60
|
-
(await db
|
|
61
|
-
.employee()
|
|
62
|
-
.where((c) => [
|
|
63
|
-
expr.not(expr.eq(c.id, item.id)),
|
|
64
|
-
expr.eq(c.isDeleted, false),
|
|
65
|
-
expr.eq(c.email, item.email),
|
|
66
|
-
])
|
|
67
|
-
.exists())
|
|
68
|
-
) {
|
|
69
|
-
throw new Error(`동일한 이메일이 이미 등록되어 있습니다: ${item.email}`);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const passwordObj =
|
|
73
|
-
authData.permissions["/home/base/employee/auth/edit"] &&
|
|
74
|
-
!strIsNullOrEmpty(item.password)
|
|
75
|
-
? { encryptedPassword: await bcrypt.hash(item.password, 10) }
|
|
76
|
-
: {};
|
|
77
|
-
|
|
78
|
-
const upsertedId = (
|
|
79
|
-
await db
|
|
80
|
-
.employee()
|
|
81
|
-
.where((c) => [expr.eq(c.id, item.id)])
|
|
82
|
-
.upsert(
|
|
83
|
-
() => ({
|
|
84
|
-
name: item.name,
|
|
85
|
-
email: item.email,
|
|
86
|
-
phoneNumber: item.phoneNumber,
|
|
87
|
-
birthDate: item.birthDate,
|
|
88
|
-
enteringDate: item.enteringDate,
|
|
89
|
-
leavingDate: item.leavingDate,
|
|
90
|
-
isDeleted: item.isDeleted,
|
|
91
|
-
...(authData.permissions["/home/base/employee/personal/edit"]
|
|
92
|
-
? { socialSecurityNumber: item.socialSecurityNumber }
|
|
93
|
-
: {}),
|
|
94
|
-
...(authData.permissions["/home/base/employee/payroll/edit"]
|
|
95
|
-
? {
|
|
96
|
-
payrollAccountBank: item.payrollAccountBank,
|
|
97
|
-
payrollAccountNumber: item.payrollAccountNumber,
|
|
98
|
-
}
|
|
99
|
-
: {}),
|
|
100
|
-
...passwordObj,
|
|
101
|
-
}),
|
|
102
|
-
["id"],
|
|
103
|
-
)
|
|
104
|
-
).single()?.id;
|
|
105
|
-
|
|
106
|
-
if (upsertedId != null) {
|
|
107
|
-
ids.push(upsertedId);
|
|
108
|
-
await db.employee().insertDataLog({
|
|
109
|
-
action: item.id == null ? "등록" : "수정",
|
|
110
|
-
itemId: upsertedId,
|
|
111
|
-
employeeId: authData.employeeId,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
return ids;
|
|
117
|
-
},
|
|
118
|
-
),
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
export type EmployeeServiceMethods = ServiceMethods<typeof EmployeeService>;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { auth, defineService, type ServiceMethods } from "@simplysm/service-server";
|
|
2
|
-
import { createOrm, type DbConnConfig } from "@simplysm/orm-node";
|
|
3
|
-
import { expr } from "@simplysm/orm-common";
|
|
4
|
-
import { MainDbContext } from "@{{projectName}}/db-main";
|
|
5
|
-
import { strIsNullOrEmpty } from "@simplysm/core-common";
|
|
6
|
-
import type { IAuthData } from "./AuthService";
|
|
7
|
-
|
|
8
|
-
export const RoleService = defineService("RoleService", (ctx) => {
|
|
9
|
-
async function getOrm() {
|
|
10
|
-
const ormConfig = await ctx.getConfig<{ default: DbConnConfig }>("orm");
|
|
11
|
-
return createOrm(MainDbContext, ormConfig.default);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
save: auth(
|
|
16
|
-
async (
|
|
17
|
-
items: {
|
|
18
|
-
id?: number;
|
|
19
|
-
name?: string;
|
|
20
|
-
}[],
|
|
21
|
-
): Promise<void> => {
|
|
22
|
-
const authData = ctx.authInfo as IAuthData | undefined;
|
|
23
|
-
if (authData?.permissions["/home/base/role-permission/edit"] !== true) {
|
|
24
|
-
throw new Error("저장 권한이 없습니다.");
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const orm = await getOrm();
|
|
28
|
-
await orm.connect(async (db) => {
|
|
29
|
-
for (const item of items) {
|
|
30
|
-
if (
|
|
31
|
-
!strIsNullOrEmpty(item.name) &&
|
|
32
|
-
(await db
|
|
33
|
-
.role()
|
|
34
|
-
.where((c) => [
|
|
35
|
-
expr.not(expr.eq(c.id, item.id)),
|
|
36
|
-
expr.eq(c.name, item.name),
|
|
37
|
-
])
|
|
38
|
-
.exists())
|
|
39
|
-
) {
|
|
40
|
-
throw new Error(`이미 존재하는 권한그룹 이름입니다: ${item.name}`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
await db
|
|
44
|
-
.role()
|
|
45
|
-
.where((c) => [expr.eq(c.id, item.id)])
|
|
46
|
-
.upsert(
|
|
47
|
-
() => ({
|
|
48
|
-
name: item.name ?? "",
|
|
49
|
-
}),
|
|
50
|
-
["id"],
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
),
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
export type RoleServiceMethods = ServiceMethods<typeof RoleService>;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { SdConfigFn } from "@simplysm/sd-cli";
|
|
2
|
-
|
|
3
|
-
const dbPort = Number(process.env["DB_PORT"] ?? 5432);
|
|
4
|
-
const dbDatabase = process.env["DB_DATABASE"] ?? "{{projectName}}";
|
|
5
|
-
|
|
6
|
-
const config: SdConfigFn = ({ dev }) => ({
|
|
7
|
-
replaceDeps: {
|
|
8
|
-
"@simplysm/*": "../simplysm/packages/*",
|
|
9
|
-
},
|
|
10
|
-
packages: {
|
|
11
|
-
"db-main": { target: "neutral" },
|
|
12
|
-
"client-admin": {
|
|
13
|
-
target: "client",
|
|
14
|
-
server: "server",
|
|
15
|
-
},
|
|
16
|
-
"server": {
|
|
17
|
-
target: "server",
|
|
18
|
-
packageManager: "volta",
|
|
19
|
-
pm2: {},
|
|
20
|
-
configs: {
|
|
21
|
-
orm: {
|
|
22
|
-
default: dev
|
|
23
|
-
? {
|
|
24
|
-
dialect: "postgresql",
|
|
25
|
-
host: "localhost",
|
|
26
|
-
port: dbPort,
|
|
27
|
-
username: "postgres",
|
|
28
|
-
password: "1234",
|
|
29
|
-
database: dbDatabase,
|
|
30
|
-
}
|
|
31
|
-
: {
|
|
32
|
-
dialect: "postgresql",
|
|
33
|
-
host: "localhost",
|
|
34
|
-
port: 5432,
|
|
35
|
-
username: "postgres",
|
|
36
|
-
password: "TODO",
|
|
37
|
-
database: "{{projectName}}",
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
auth: {
|
|
41
|
-
jwtSecret: "{{jwtSecret}}",
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export default config;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"lib": ["ESNext", "DOM", "DOM.Iterable", "WebWorker"],
|
|
6
|
-
"moduleResolution": "bundler",
|
|
7
|
-
"jsx": "preserve",
|
|
8
|
-
"jsxImportSource": "solid-js",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"noImplicitOverride": true,
|
|
11
|
-
"noImplicitReturns": true,
|
|
12
|
-
"noImplicitAny": true,
|
|
13
|
-
"noFallthroughCasesInSwitch": true,
|
|
14
|
-
"useUnknownInCatchVariables": true,
|
|
15
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
16
|
-
"forceConsistentCasingInFileNames": true,
|
|
17
|
-
"useDefineForClassFields": true,
|
|
18
|
-
"esModuleInterop": true,
|
|
19
|
-
"verbatimModuleSyntax": true,
|
|
20
|
-
"declaration": true,
|
|
21
|
-
"declarationMap": true,
|
|
22
|
-
"sourceMap": true,
|
|
23
|
-
"skipLibCheck": true,
|
|
24
|
-
"importHelpers": true,
|
|
25
|
-
"baseUrl": ".",
|
|
26
|
-
"paths": {
|
|
27
|
-
"@{{projectName}}/*": ["packages/*/src/index.ts"]
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"include": [
|
|
31
|
-
"*.ts",
|
|
32
|
-
"packages/*/*.ts",
|
|
33
|
-
"packages/*/src/**/*.ts",
|
|
34
|
-
"packages/*/src/**/*.tsx",
|
|
35
|
-
"packages/*/tests/**/*.ts",
|
|
36
|
-
"packages/*/tests/**/*.tsx",
|
|
37
|
-
"tests/**/*.ts"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
import { defineConfig } from "vitest/config";
|
|
4
|
-
import tsconfigPaths from "vite-tsconfig-paths";
|
|
5
|
-
|
|
6
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
-
|
|
8
|
-
export default defineConfig({
|
|
9
|
-
plugins: [
|
|
10
|
-
tsconfigPaths({
|
|
11
|
-
root: __dirname,
|
|
12
|
-
projects: ["./tsconfig.json"],
|
|
13
|
-
}),
|
|
14
|
-
],
|
|
15
|
-
define: {
|
|
16
|
-
"process.env.DEV": JSON.stringify("true"),
|
|
17
|
-
"process.env.VER": JSON.stringify("1.0.0-test"),
|
|
18
|
-
},
|
|
19
|
-
test: {
|
|
20
|
-
globals: true,
|
|
21
|
-
environment: "node",
|
|
22
|
-
coverage: {
|
|
23
|
-
reportsDirectory: "./.coverage",
|
|
24
|
-
},
|
|
25
|
-
projects: [
|
|
26
|
-
{
|
|
27
|
-
extends: true,
|
|
28
|
-
test: {
|
|
29
|
-
name: "node",
|
|
30
|
-
include: ["packages/*/tests/**/*.spec.{ts,tsx,js}"],
|
|
31
|
-
testTimeout: 30000,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
});
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
|
|
3
|
-
const { mockWriteJson, mockReadJson, mockExists } = vi.hoisted(() => ({
|
|
4
|
-
mockWriteJson: vi.fn().mockResolvedValue(undefined),
|
|
5
|
-
mockReadJson: vi.fn(),
|
|
6
|
-
mockExists: vi.fn(),
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
|
-
vi.mock("@simplysm/core-node", () => ({
|
|
10
|
-
fsx: {
|
|
11
|
-
readJson: mockReadJson,
|
|
12
|
-
exists: mockExists,
|
|
13
|
-
mkdir: vi.fn().mockResolvedValue(undefined),
|
|
14
|
-
writeJson: mockWriteJson,
|
|
15
|
-
write: vi.fn().mockResolvedValue(undefined),
|
|
16
|
-
},
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
vi.mock("consola", () => {
|
|
20
|
-
const withTag = () => ({ debug: vi.fn(), warn: vi.fn() });
|
|
21
|
-
const consola = { withTag };
|
|
22
|
-
return { default: consola, consola };
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
vi.mock("sharp", () => ({ default: vi.fn() }));
|
|
26
|
-
vi.mock("execa", () => ({ execa: vi.fn() }));
|
|
27
|
-
|
|
28
|
-
import { Capacitor } from "../src/capacitor/capacitor";
|
|
29
|
-
|
|
30
|
-
describe("Capacitor exclude packages", () => {
|
|
31
|
-
beforeEach(() => {
|
|
32
|
-
vi.clearAllMocks();
|
|
33
|
-
mockReadJson.mockImplementation((filePath: string) => {
|
|
34
|
-
if (filePath.includes(".capacitor")) {
|
|
35
|
-
return Promise.resolve({ name: "", version: "", dependencies: {} });
|
|
36
|
-
}
|
|
37
|
-
return Promise.resolve({
|
|
38
|
-
name: "@test/app",
|
|
39
|
-
version: "1.0.0",
|
|
40
|
-
dependencies: { "jeep-sqlite": "^0.0.1" },
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
mockExists.mockImplementation((filePath: string) => {
|
|
44
|
-
if (filePath.endsWith("package.json")) return Promise.resolve(true);
|
|
45
|
-
return Promise.resolve(false);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("exclude 패키지가 .capacitor/package.json dependencies에 추가된다", async () => {
|
|
50
|
-
const cap = await Capacitor.create("/test/packages/app", {
|
|
51
|
-
appId: "com.test.app",
|
|
52
|
-
appName: "Test App",
|
|
53
|
-
}, ["jeep-sqlite"]);
|
|
54
|
-
|
|
55
|
-
await (cap as unknown as { _setupNpmConf(): Promise<boolean> })._setupNpmConf();
|
|
56
|
-
|
|
57
|
-
expect(mockWriteJson).toHaveBeenCalled();
|
|
58
|
-
const writtenConfig = mockWriteJson.mock.calls[0][1] as {
|
|
59
|
-
dependencies: Record<string, string>;
|
|
60
|
-
};
|
|
61
|
-
expect(writtenConfig.dependencies["jeep-sqlite"]).toBe("^0.0.1");
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("exclude 없이 생성해도 정상 동작한다", async () => {
|
|
65
|
-
const cap = await Capacitor.create("/test/packages/app", {
|
|
66
|
-
appId: "com.test.app",
|
|
67
|
-
appName: "Test App",
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
await (cap as unknown as { _setupNpmConf(): Promise<boolean> })._setupNpmConf();
|
|
71
|
-
|
|
72
|
-
expect(mockWriteJson).toHaveBeenCalled();
|
|
73
|
-
const writtenConfig = mockWriteJson.mock.calls[0][1] as {
|
|
74
|
-
dependencies: Record<string, string>;
|
|
75
|
-
};
|
|
76
|
-
expect(writtenConfig.dependencies["jeep-sqlite"]).toBeUndefined();
|
|
77
|
-
});
|
|
78
|
-
});
|