zudojs-cli 0.1.2 → 1.0.0
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/LICENSE +21 -0
- package/README.md +14 -1
- package/dist/src/adapters/databases/postgres.adapter.d.ts +0 -14
- package/dist/src/adapters/databases/postgres.adapter.js +0 -30
- package/dist/src/adapters/frontend/angular.adapter.js +6 -0
- package/dist/src/adapters/frontend/astro.adapter.js +2 -2
- package/dist/src/adapters/frontend/react.adapter.js +26 -17
- package/dist/src/adapters/frontend/svelte.adapter.js +1 -0
- package/dist/src/adapters/frontend/sveltekit.adapter.js +7 -8
- package/dist/src/adapters/frontend/vanilla.adapter.js +1 -1
- package/dist/src/adapters/frontend/vue.adapter.js +1 -0
- package/dist/src/adapters/package-managers/bun.adapter.js +5 -5
- package/dist/src/adapters/package-managers/npm.adapter.js +5 -5
- package/dist/src/adapters/package-managers/pnpm.adapter.js +5 -5
- package/dist/src/adapters/package-managers/yarn.adapter.js +5 -5
- package/dist/src/bin/zudojs.js +42 -6
- package/dist/src/cliApplication/cliApplication.builtins.d.ts +11 -2
- package/dist/src/cliApplication/cliApplication.builtins.js +15 -4
- package/dist/src/cliApplication/cliApplication.core.js +20 -5
- package/dist/src/cliConstant/cliConstant.value.d.ts +1 -1
- package/dist/src/cliConstant/cliConstant.value.js +2 -1
- package/dist/src/cliConstant/cliVersion.d.ts +16 -0
- package/dist/src/cliConstant/cliVersion.js +57 -0
- package/dist/src/cliParser/cliParser.core.js +7 -0
- package/dist/src/cliParser/cliParser.shortOption.js +1 -1
- package/dist/src/commands/add.command.js +27 -24
- package/dist/src/commands/build.command.js +13 -7
- package/dist/src/commands/create.command.js +169 -51
- package/dist/src/commands/dev.command.js +62 -27
- package/dist/src/commands/doctor.command.js +45 -23
- package/dist/src/commands/generate.command.js +103 -34
- package/dist/src/constants/index.d.ts +3 -1
- package/dist/src/constants/index.js +3 -1
- package/dist/src/generators/command/command.generator.d.ts +1 -0
- package/dist/src/generators/command/command.generator.js +10 -4
- package/dist/src/generators/controller/controller.generator.d.ts +1 -0
- package/dist/src/generators/controller/controller.generator.js +12 -9
- package/dist/src/generators/dto/dto.generator.d.ts +1 -0
- package/dist/src/generators/dto/dto.generator.js +9 -3
- package/dist/src/generators/event/event.generator.d.ts +1 -0
- package/dist/src/generators/event/event.generator.js +10 -4
- package/dist/src/generators/frontend/frontendGenerator.core.js +4 -28
- package/dist/src/generators/frontend/frontendPipeline.d.ts +26 -0
- package/dist/src/generators/frontend/frontendPipeline.js +93 -0
- package/dist/src/generators/fullstack/fullstackComposer.core.d.ts +1 -2
- package/dist/src/generators/fullstack/fullstackComposer.core.js +72 -43
- package/dist/src/generators/infrastructure/infrastructure.generator.d.ts +11 -0
- package/dist/src/generators/infrastructure/infrastructure.generator.js +101 -61
- package/dist/src/generators/integration/integrationGenerator.core.d.ts +6 -0
- package/dist/src/generators/integration/integrationGenerator.core.js +35 -6
- package/dist/src/generators/job/job.generator.d.ts +1 -0
- package/dist/src/generators/job/job.generator.js +9 -3
- package/dist/src/generators/middleware/middleware.generator.d.ts +1 -0
- package/dist/src/generators/middleware/middleware.generator.js +10 -4
- package/dist/src/generators/model/model.generator.d.ts +1 -0
- package/dist/src/generators/model/model.generator.js +9 -3
- package/dist/src/generators/module/module.generator.d.ts +1 -0
- package/dist/src/generators/module/module.generator.js +11 -24
- package/dist/src/generators/project/project.generator.js +2 -23
- package/dist/src/generators/query/query.generator.d.ts +1 -0
- package/dist/src/generators/query/query.generator.js +10 -4
- package/dist/src/generators/repository/repository.generator.d.ts +1 -0
- package/dist/src/generators/repository/repository.generator.js +12 -9
- package/dist/src/generators/route/route.generator.d.ts +1 -0
- package/dist/src/generators/route/route.generator.js +11 -5
- package/dist/src/generators/service/service.generator.d.ts +1 -0
- package/dist/src/generators/service/service.generator.js +12 -9
- package/dist/src/generators/validator/validator.generator.d.ts +1 -0
- package/dist/src/generators/validator/validator.generator.js +9 -3
- package/dist/src/installers/dependency.installer.js +6 -2
- package/dist/src/manifest/manifestManager.core.d.ts +3 -0
- package/dist/src/prompts/backend/index.d.ts +1 -0
- package/dist/src/prompts/backend/index.js +1 -0
- package/dist/src/prompts/backend/services.prompt.d.ts +7 -0
- package/dist/src/prompts/backend/services.prompt.js +39 -0
- package/dist/src/prompts/index.d.ts +0 -1
- package/dist/src/prompts/index.js +0 -1
- package/dist/src/rollback/rollbackManager.core.js +0 -1
- package/dist/src/runners/process/processRunner.core.d.ts +4 -0
- package/dist/src/runners/process/processRunner.core.js +17 -3
- package/dist/src/scaffolders/framework.scaffolder.js +9 -6
- package/dist/src/scaffolders/scaffolder.helper.js +7 -2
- package/dist/src/scripts/postinstall.cjs +24 -3
- package/dist/src/templates/microservice/index.d.ts +1 -1
- package/dist/src/templates/microservice/index.js +1 -1
- package/dist/src/templates/microservice/microservice.template.d.ts +15 -0
- package/dist/src/templates/microservice/microservice.template.js +148 -162
- package/dist/src/templates/modular-monolith/modularMonolith.template.js +45 -76
- package/dist/src/templates/monolith/monolith.template.d.ts +1 -0
- package/dist/src/templates/monolith/monolith.template.js +48 -68
- package/dist/src/templates/shared/appRuntime.template.d.ts +71 -0
- package/dist/src/templates/shared/appRuntime.template.js +209 -0
- package/dist/src/templates/shared/index.d.ts +5 -0
- package/dist/src/templates/shared/index.js +5 -0
- package/dist/src/utils/index.d.ts +3 -3
- package/dist/src/utils/index.js +3 -3
- package/dist/src/utils/utils.exec.d.ts +19 -1
- package/dist/src/utils/utils.exec.js +37 -3
- package/dist/src/utils/utils.fileSystem.d.ts +6 -0
- package/dist/src/utils/utils.fileSystem.js +19 -0
- package/dist/src/utils/utils.name.d.ts +26 -0
- package/dist/src/utils/utils.name.js +51 -1
- package/package.json +29 -22
- package/src/scripts/postinstall.cjs +24 -3
- package/dist/.tsbuildinfo +0 -1
- package/dist/src/adapters/databases/index.d.ts.map +0 -1
- package/dist/src/adapters/databases/index.js.map +0 -1
- package/dist/src/adapters/databases/mysql.adapter.d.ts.map +0 -1
- package/dist/src/adapters/databases/mysql.adapter.js.map +0 -1
- package/dist/src/adapters/databases/postgres.adapter.d.ts.map +0 -1
- package/dist/src/adapters/databases/postgres.adapter.js.map +0 -1
- package/dist/src/adapters/databases/sqlite.adapter.d.ts.map +0 -1
- package/dist/src/adapters/databases/sqlite.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/angular.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/angular.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/astro.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/astro.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/flutter.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/flutter.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/frontendAdapter.type.d.ts.map +0 -1
- package/dist/src/adapters/frontend/frontendAdapter.type.js.map +0 -1
- package/dist/src/adapters/frontend/index.d.ts.map +0 -1
- package/dist/src/adapters/frontend/index.js.map +0 -1
- package/dist/src/adapters/frontend/next.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/next.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/nuxt.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/nuxt.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/react-native.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/react-native.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/react.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/react.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/svelte.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/svelte.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/sveltekit.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/sveltekit.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/vanilla.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/vanilla.adapter.js.map +0 -1
- package/dist/src/adapters/frontend/vue.adapter.d.ts.map +0 -1
- package/dist/src/adapters/frontend/vue.adapter.js.map +0 -1
- package/dist/src/adapters/package-managers/bun.adapter.d.ts.map +0 -1
- package/dist/src/adapters/package-managers/bun.adapter.js.map +0 -1
- package/dist/src/adapters/package-managers/index.d.ts.map +0 -1
- package/dist/src/adapters/package-managers/index.js.map +0 -1
- package/dist/src/adapters/package-managers/npm.adapter.d.ts.map +0 -1
- package/dist/src/adapters/package-managers/npm.adapter.js.map +0 -1
- package/dist/src/adapters/package-managers/packageManager.type.d.ts.map +0 -1
- package/dist/src/adapters/package-managers/packageManager.type.js.map +0 -1
- package/dist/src/adapters/package-managers/pnpm.adapter.d.ts.map +0 -1
- package/dist/src/adapters/package-managers/pnpm.adapter.js.map +0 -1
- package/dist/src/adapters/package-managers/yarn.adapter.d.ts.map +0 -1
- package/dist/src/adapters/package-managers/yarn.adapter.js.map +0 -1
- package/dist/src/bin/zudojs.d.ts.map +0 -1
- package/dist/src/bin/zudojs.js.map +0 -1
- package/dist/src/cliApplication/cliApplication.builtins.d.ts.map +0 -1
- package/dist/src/cliApplication/cliApplication.builtins.js.map +0 -1
- package/dist/src/cliApplication/cliApplication.core.d.ts.map +0 -1
- package/dist/src/cliApplication/cliApplication.core.js.map +0 -1
- package/dist/src/cliApplication/cliApplication.writer.d.ts.map +0 -1
- package/dist/src/cliApplication/cliApplication.writer.js.map +0 -1
- package/dist/src/cliApplication/index.d.ts.map +0 -1
- package/dist/src/cliApplication/index.js.map +0 -1
- package/dist/src/cliCommand/cliCommand.builder.d.ts.map +0 -1
- package/dist/src/cliCommand/cliCommand.builder.js.map +0 -1
- package/dist/src/cliCommand/cliCommand.factory.d.ts.map +0 -1
- package/dist/src/cliCommand/cliCommand.factory.js.map +0 -1
- package/dist/src/cliCommand/cliCommand.registry.d.ts.map +0 -1
- package/dist/src/cliCommand/cliCommand.registry.js.map +0 -1
- package/dist/src/cliCommand/cliCommand.validator.d.ts.map +0 -1
- package/dist/src/cliCommand/cliCommand.validator.js.map +0 -1
- package/dist/src/cliCommand/index.d.ts.map +0 -1
- package/dist/src/cliCommand/index.js.map +0 -1
- package/dist/src/cliConstant/cliConstant.value.d.ts.map +0 -1
- package/dist/src/cliConstant/cliConstant.value.js.map +0 -1
- package/dist/src/cliConstant/index.d.ts.map +0 -1
- package/dist/src/cliConstant/index.js.map +0 -1
- package/dist/src/cliError/cliError.argument.d.ts.map +0 -1
- package/dist/src/cliError/cliError.argument.js.map +0 -1
- package/dist/src/cliError/cliError.base.d.ts.map +0 -1
- package/dist/src/cliError/cliError.base.js.map +0 -1
- package/dist/src/cliError/cliError.command.d.ts.map +0 -1
- package/dist/src/cliError/cliError.command.js.map +0 -1
- package/dist/src/cliError/cliError.execution.d.ts.map +0 -1
- package/dist/src/cliError/cliError.execution.js.map +0 -1
- package/dist/src/cliError/cliError.option.d.ts.map +0 -1
- package/dist/src/cliError/cliError.option.js.map +0 -1
- package/dist/src/cliError/index.d.ts.map +0 -1
- package/dist/src/cliError/index.js.map +0 -1
- package/dist/src/cliParser/cliParser.core.d.ts.map +0 -1
- package/dist/src/cliParser/cliParser.core.js.map +0 -1
- package/dist/src/cliParser/cliParser.helper.d.ts.map +0 -1
- package/dist/src/cliParser/cliParser.helper.js.map +0 -1
- package/dist/src/cliParser/cliParser.longOption.d.ts.map +0 -1
- package/dist/src/cliParser/cliParser.longOption.js.map +0 -1
- package/dist/src/cliParser/cliParser.shortOption.d.ts.map +0 -1
- package/dist/src/cliParser/cliParser.shortOption.js.map +0 -1
- package/dist/src/cliParser/index.d.ts.map +0 -1
- package/dist/src/cliParser/index.js.map +0 -1
- package/dist/src/cliType/cliType.type.d.ts.map +0 -1
- package/dist/src/cliType/cliType.type.js.map +0 -1
- package/dist/src/cliType/index.d.ts.map +0 -1
- package/dist/src/cliType/index.js.map +0 -1
- package/dist/src/cliVersion/cliVersion.core.d.ts.map +0 -1
- package/dist/src/cliVersion/cliVersion.core.js.map +0 -1
- package/dist/src/cliVersion/index.d.ts.map +0 -1
- package/dist/src/cliVersion/index.js.map +0 -1
- package/dist/src/commands/add.command.d.ts.map +0 -1
- package/dist/src/commands/add.command.js.map +0 -1
- package/dist/src/commands/build.command.d.ts.map +0 -1
- package/dist/src/commands/build.command.js.map +0 -1
- package/dist/src/commands/create.command.d.ts.map +0 -1
- package/dist/src/commands/create.command.js.map +0 -1
- package/dist/src/commands/dev.command.d.ts.map +0 -1
- package/dist/src/commands/dev.command.js.map +0 -1
- package/dist/src/commands/doctor.command.d.ts.map +0 -1
- package/dist/src/commands/doctor.command.js.map +0 -1
- package/dist/src/commands/generate.command.d.ts.map +0 -1
- package/dist/src/commands/generate.command.js.map +0 -1
- package/dist/src/commands/index.d.ts.map +0 -1
- package/dist/src/commands/index.js.map +0 -1
- package/dist/src/commands/info.command.d.ts.map +0 -1
- package/dist/src/commands/info.command.js.map +0 -1
- package/dist/src/constants/index.d.ts.map +0 -1
- package/dist/src/constants/index.js.map +0 -1
- package/dist/src/errors/index.d.ts.map +0 -1
- package/dist/src/errors/index.js.map +0 -1
- package/dist/src/generators/backend/backend.generator.d.ts.map +0 -1
- package/dist/src/generators/backend/backend.generator.js.map +0 -1
- package/dist/src/generators/backend/index.d.ts.map +0 -1
- package/dist/src/generators/backend/index.js.map +0 -1
- package/dist/src/generators/command/command.generator.d.ts.map +0 -1
- package/dist/src/generators/command/command.generator.js.map +0 -1
- package/dist/src/generators/controller/controller.generator.d.ts.map +0 -1
- package/dist/src/generators/controller/controller.generator.js.map +0 -1
- package/dist/src/generators/dto/dto.generator.d.ts.map +0 -1
- package/dist/src/generators/dto/dto.generator.js.map +0 -1
- package/dist/src/generators/dto/index.d.ts.map +0 -1
- package/dist/src/generators/dto/index.js.map +0 -1
- package/dist/src/generators/event/event.generator.d.ts.map +0 -1
- package/dist/src/generators/event/event.generator.js.map +0 -1
- package/dist/src/generators/event/index.d.ts.map +0 -1
- package/dist/src/generators/event/index.js.map +0 -1
- package/dist/src/generators/frontend/frontendGenerator.core.d.ts.map +0 -1
- package/dist/src/generators/frontend/frontendGenerator.core.js.map +0 -1
- package/dist/src/generators/frontend/index.d.ts.map +0 -1
- package/dist/src/generators/frontend/index.js.map +0 -1
- package/dist/src/generators/fullstack/fullstackComposer.core.d.ts.map +0 -1
- package/dist/src/generators/fullstack/fullstackComposer.core.js.map +0 -1
- package/dist/src/generators/fullstack/index.d.ts.map +0 -1
- package/dist/src/generators/fullstack/index.js.map +0 -1
- package/dist/src/generators/index.d.ts.map +0 -1
- package/dist/src/generators/index.js.map +0 -1
- package/dist/src/generators/infrastructure/index.d.ts.map +0 -1
- package/dist/src/generators/infrastructure/index.js.map +0 -1
- package/dist/src/generators/infrastructure/infrastructure.generator.d.ts.map +0 -1
- package/dist/src/generators/infrastructure/infrastructure.generator.js.map +0 -1
- package/dist/src/generators/integration/index.d.ts.map +0 -1
- package/dist/src/generators/integration/index.js.map +0 -1
- package/dist/src/generators/integration/integrationGenerator.core.d.ts.map +0 -1
- package/dist/src/generators/integration/integrationGenerator.core.js.map +0 -1
- package/dist/src/generators/job/index.d.ts.map +0 -1
- package/dist/src/generators/job/index.js.map +0 -1
- package/dist/src/generators/job/job.generator.d.ts.map +0 -1
- package/dist/src/generators/job/job.generator.js.map +0 -1
- package/dist/src/generators/middleware/index.d.ts.map +0 -1
- package/dist/src/generators/middleware/index.js.map +0 -1
- package/dist/src/generators/middleware/middleware.generator.d.ts.map +0 -1
- package/dist/src/generators/middleware/middleware.generator.js.map +0 -1
- package/dist/src/generators/model/index.d.ts.map +0 -1
- package/dist/src/generators/model/index.js.map +0 -1
- package/dist/src/generators/model/model.generator.d.ts.map +0 -1
- package/dist/src/generators/model/model.generator.js.map +0 -1
- package/dist/src/generators/module/module.generator.d.ts.map +0 -1
- package/dist/src/generators/module/module.generator.js.map +0 -1
- package/dist/src/generators/project/project.generator.d.ts.map +0 -1
- package/dist/src/generators/project/project.generator.js.map +0 -1
- package/dist/src/generators/query/query.generator.d.ts.map +0 -1
- package/dist/src/generators/query/query.generator.js.map +0 -1
- package/dist/src/generators/repository/repository.generator.d.ts.map +0 -1
- package/dist/src/generators/repository/repository.generator.js.map +0 -1
- package/dist/src/generators/route/index.d.ts.map +0 -1
- package/dist/src/generators/route/index.js.map +0 -1
- package/dist/src/generators/route/route.generator.d.ts.map +0 -1
- package/dist/src/generators/route/route.generator.js.map +0 -1
- package/dist/src/generators/service/service.generator.d.ts.map +0 -1
- package/dist/src/generators/service/service.generator.js.map +0 -1
- package/dist/src/generators/validator/index.d.ts.map +0 -1
- package/dist/src/generators/validator/index.js.map +0 -1
- package/dist/src/generators/validator/validator.generator.d.ts.map +0 -1
- package/dist/src/generators/validator/validator.generator.js.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/installers/dependency.installer.d.ts.map +0 -1
- package/dist/src/installers/dependency.installer.js.map +0 -1
- package/dist/src/installers/index.d.ts.map +0 -1
- package/dist/src/installers/index.js.map +0 -1
- package/dist/src/manifest/index.d.ts.map +0 -1
- package/dist/src/manifest/index.js.map +0 -1
- package/dist/src/manifest/manifestManager.core.d.ts.map +0 -1
- package/dist/src/manifest/manifestManager.core.js.map +0 -1
- package/dist/src/prompts/backend/api-style.prompt.d.ts.map +0 -1
- package/dist/src/prompts/backend/api-style.prompt.js.map +0 -1
- package/dist/src/prompts/backend/backend-architecture.prompt.d.ts.map +0 -1
- package/dist/src/prompts/backend/backend-architecture.prompt.js.map +0 -1
- package/dist/src/prompts/backend/database.prompt.d.ts.map +0 -1
- package/dist/src/prompts/backend/database.prompt.js.map +0 -1
- package/dist/src/prompts/backend/index.d.ts.map +0 -1
- package/dist/src/prompts/backend/index.js.map +0 -1
- package/dist/src/prompts/capabilities/capabilities.prompt.d.ts.map +0 -1
- package/dist/src/prompts/capabilities/capabilities.prompt.js.map +0 -1
- package/dist/src/prompts/capabilities/index.d.ts.map +0 -1
- package/dist/src/prompts/capabilities/index.js.map +0 -1
- package/dist/src/prompts/frontend/framework.prompt.d.ts.map +0 -1
- package/dist/src/prompts/frontend/framework.prompt.js.map +0 -1
- package/dist/src/prompts/frontend/frontend-architecture.prompt.d.ts.map +0 -1
- package/dist/src/prompts/frontend/frontend-architecture.prompt.js.map +0 -1
- package/dist/src/prompts/frontend/index.d.ts.map +0 -1
- package/dist/src/prompts/frontend/index.js.map +0 -1
- package/dist/src/prompts/index.d.ts.map +0 -1
- package/dist/src/prompts/index.js.map +0 -1
- package/dist/src/prompts/project/confirmation.prompt.d.ts.map +0 -1
- package/dist/src/prompts/project/confirmation.prompt.js.map +0 -1
- package/dist/src/prompts/project/index.d.ts.map +0 -1
- package/dist/src/prompts/project/index.js.map +0 -1
- package/dist/src/prompts/project/project-name.prompt.d.ts.map +0 -1
- package/dist/src/prompts/project/project-name.prompt.js.map +0 -1
- package/dist/src/prompts/project/project-type.prompt.d.ts.map +0 -1
- package/dist/src/prompts/project/project-type.prompt.js.map +0 -1
- package/dist/src/prompts/prompts.createProject.d.ts +0 -33
- package/dist/src/prompts/prompts.createProject.d.ts.map +0 -1
- package/dist/src/prompts/prompts.createProject.js +0 -150
- package/dist/src/prompts/prompts.createProject.js.map +0 -1
- package/dist/src/prompts/workspace/index.d.ts.map +0 -1
- package/dist/src/prompts/workspace/index.js.map +0 -1
- package/dist/src/prompts/workspace/package-manager.prompt.d.ts.map +0 -1
- package/dist/src/prompts/workspace/package-manager.prompt.js.map +0 -1
- package/dist/src/registries/adapter/frontendAdapterRegistry.core.d.ts.map +0 -1
- package/dist/src/registries/adapter/frontendAdapterRegistry.core.js.map +0 -1
- package/dist/src/registries/adapter/packageManagerRegistry.core.d.ts.map +0 -1
- package/dist/src/registries/adapter/packageManagerRegistry.core.js.map +0 -1
- package/dist/src/registries/dependency/dependencyRegistry.core.d.ts.map +0 -1
- package/dist/src/registries/dependency/dependencyRegistry.core.js.map +0 -1
- package/dist/src/registries/dependency/index.d.ts.map +0 -1
- package/dist/src/registries/dependency/index.js.map +0 -1
- package/dist/src/registries/generator/generatorRegistry.core.d.ts.map +0 -1
- package/dist/src/registries/generator/generatorRegistry.core.js.map +0 -1
- package/dist/src/registries/generator/index.d.ts.map +0 -1
- package/dist/src/registries/generator/index.js.map +0 -1
- package/dist/src/registries/index.d.ts.map +0 -1
- package/dist/src/registries/index.js.map +0 -1
- package/dist/src/resolvers/architecture.resolver.d.ts.map +0 -1
- package/dist/src/resolvers/architecture.resolver.js.map +0 -1
- package/dist/src/resolvers/capability/capabilityResolver.core.d.ts.map +0 -1
- package/dist/src/resolvers/capability/capabilityResolver.core.js.map +0 -1
- package/dist/src/resolvers/capability/index.d.ts.map +0 -1
- package/dist/src/resolvers/capability/index.js.map +0 -1
- package/dist/src/resolvers/configuration/configurationResolver.core.d.ts.map +0 -1
- package/dist/src/resolvers/configuration/configurationResolver.core.js.map +0 -1
- package/dist/src/resolvers/configuration/index.d.ts.map +0 -1
- package/dist/src/resolvers/configuration/index.js.map +0 -1
- package/dist/src/resolvers/dependency/dependencyResolver.core.d.ts.map +0 -1
- package/dist/src/resolvers/dependency/dependencyResolver.core.js.map +0 -1
- package/dist/src/resolvers/dependency/index.d.ts.map +0 -1
- package/dist/src/resolvers/dependency/index.js.map +0 -1
- package/dist/src/resolvers/index.d.ts.map +0 -1
- package/dist/src/resolvers/index.js.map +0 -1
- package/dist/src/resolvers/project.resolver.d.ts.map +0 -1
- package/dist/src/resolvers/project.resolver.js.map +0 -1
- package/dist/src/rollback/index.d.ts.map +0 -1
- package/dist/src/rollback/index.js.map +0 -1
- package/dist/src/rollback/rollbackManager.core.d.ts.map +0 -1
- package/dist/src/rollback/rollbackManager.core.js.map +0 -1
- package/dist/src/runners/package-manager/index.d.ts.map +0 -1
- package/dist/src/runners/package-manager/index.js.map +0 -1
- package/dist/src/runners/package-manager/packageManagerRunner.core.d.ts.map +0 -1
- package/dist/src/runners/package-manager/packageManagerRunner.core.js.map +0 -1
- package/dist/src/runners/process/index.d.ts.map +0 -1
- package/dist/src/runners/process/index.js.map +0 -1
- package/dist/src/runners/process/processRunner.core.d.ts.map +0 -1
- package/dist/src/runners/process/processRunner.core.js.map +0 -1
- package/dist/src/runners/task/index.d.ts.map +0 -1
- package/dist/src/runners/task/index.js.map +0 -1
- package/dist/src/runners/task/taskRunner.core.d.ts.map +0 -1
- package/dist/src/runners/task/taskRunner.core.js.map +0 -1
- package/dist/src/scaffolders/framework.scaffolder.d.ts.map +0 -1
- package/dist/src/scaffolders/framework.scaffolder.js.map +0 -1
- package/dist/src/scaffolders/index.d.ts.map +0 -1
- package/dist/src/scaffolders/index.js.map +0 -1
- package/dist/src/scaffolders/scaffolder.helper.d.ts.map +0 -1
- package/dist/src/scaffolders/scaffolder.helper.js.map +0 -1
- package/dist/src/templates/microservice/index.d.ts.map +0 -1
- package/dist/src/templates/microservice/index.js.map +0 -1
- package/dist/src/templates/microservice/microservice.template.d.ts.map +0 -1
- package/dist/src/templates/microservice/microservice.template.js.map +0 -1
- package/dist/src/templates/modular-monolith/index.d.ts.map +0 -1
- package/dist/src/templates/modular-monolith/index.js.map +0 -1
- package/dist/src/templates/modular-monolith/modularMonolith.template.d.ts.map +0 -1
- package/dist/src/templates/modular-monolith/modularMonolith.template.js.map +0 -1
- package/dist/src/templates/monolith/index.d.ts.map +0 -1
- package/dist/src/templates/monolith/index.js.map +0 -1
- package/dist/src/templates/monolith/monolith.template.d.ts.map +0 -1
- package/dist/src/templates/monolith/monolith.template.js.map +0 -1
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/index.js.map +0 -1
- package/dist/src/types/projectConfiguration.type.d.ts.map +0 -1
- package/dist/src/types/projectConfiguration.type.js.map +0 -1
- package/dist/src/types/scaffold.type.d.ts.map +0 -1
- package/dist/src/types/scaffold.type.js.map +0 -1
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/utils.detect.d.ts.map +0 -1
- package/dist/src/utils/utils.detect.js.map +0 -1
- package/dist/src/utils/utils.exec.d.ts.map +0 -1
- package/dist/src/utils/utils.exec.js.map +0 -1
- package/dist/src/utils/utils.fileSystem.d.ts.map +0 -1
- package/dist/src/utils/utils.fileSystem.js.map +0 -1
- package/dist/src/utils/utils.name.d.ts.map +0 -1
- package/dist/src/utils/utils.name.js.map +0 -1
- package/dist/src/validators/compatibility/compatibilityValidator.core.d.ts.map +0 -1
- package/dist/src/validators/compatibility/compatibilityValidator.core.js.map +0 -1
- package/dist/src/validators/compatibility/index.d.ts.map +0 -1
- package/dist/src/validators/compatibility/index.js.map +0 -1
- package/dist/src/validators/environment/environmentValidator.core.d.ts.map +0 -1
- package/dist/src/validators/environment/environmentValidator.core.js.map +0 -1
- package/dist/src/validators/environment/index.d.ts.map +0 -1
- package/dist/src/validators/environment/index.js.map +0 -1
- package/dist/src/validators/index.d.ts.map +0 -1
- package/dist/src/validators/index.js.map +0 -1
- package/dist/src/validators/project/index.d.ts.map +0 -1
- package/dist/src/validators/project/index.js.map +0 -1
- package/dist/src/validators/project/projectValidator.core.d.ts.map +0 -1
- package/dist/src/validators/project/projectValidator.core.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zudojs-cli — Version resolution
|
|
3
|
+
*
|
|
4
|
+
* The CLI's own version, read from its `package.json` at runtime.
|
|
5
|
+
*
|
|
6
|
+
* It used to be a hand-maintained string literal duplicated in two places
|
|
7
|
+
* (`constants/index.ts` and `cliConstant.value.ts`). Both are stamped into the
|
|
8
|
+
* manifest of every generated project, so a release that bumped `package.json`
|
|
9
|
+
* without editing both copies would silently scaffold projects claiming the
|
|
10
|
+
* previous version. Reading the manifest removes the duplication entirely.
|
|
11
|
+
*
|
|
12
|
+
* @module cliConstant/cliVersion
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
15
|
+
import { dirname, join } from "node:path";
|
|
16
|
+
import { fileURLToPath } from "node:url";
|
|
17
|
+
/** Package name to match, so a parent workspace manifest is never picked up. */
|
|
18
|
+
const PACKAGE_NAME = "zudojs-cli";
|
|
19
|
+
/** Directory levels to walk upward before giving up. */
|
|
20
|
+
const MAX_LOOKUP_DEPTH = 8;
|
|
21
|
+
/**
|
|
22
|
+
* Walks upward from this module looking for the CLI's own `package.json`.
|
|
23
|
+
*
|
|
24
|
+
* The compiled layout (`dist/src/cliConstant/`) sits one level deeper than the
|
|
25
|
+
* source layout (`src/cliConstant/`), so a fixed relative path would be correct
|
|
26
|
+
* in only one of them. Matching on `name` also means a parent workspace
|
|
27
|
+
* manifest cannot be mistaken for ours.
|
|
28
|
+
*
|
|
29
|
+
* @returns The version string declared in the CLI's `package.json`.
|
|
30
|
+
* @throws {Error} If the manifest cannot be located or has no string version.
|
|
31
|
+
*/
|
|
32
|
+
function readOwnVersion() {
|
|
33
|
+
let directory = dirname(fileURLToPath(import.meta.url));
|
|
34
|
+
for (let depth = 0; depth < MAX_LOOKUP_DEPTH; depth += 1) {
|
|
35
|
+
const manifestPath = join(directory, "package.json");
|
|
36
|
+
if (existsSync(manifestPath)) {
|
|
37
|
+
const parsed = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
38
|
+
if (typeof parsed === "object" && parsed !== null) {
|
|
39
|
+
const { name, version } = parsed;
|
|
40
|
+
if (name === PACKAGE_NAME &&
|
|
41
|
+
typeof version === "string" &&
|
|
42
|
+
version.length > 0) {
|
|
43
|
+
return version;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const parent = dirname(directory);
|
|
48
|
+
if (parent === directory) {
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
directory = parent;
|
|
52
|
+
}
|
|
53
|
+
throw new Error(`${PACKAGE_NAME}: could not resolve its own package.json to read the version.`);
|
|
54
|
+
}
|
|
55
|
+
/** The CLI's version, matching its `package.json`. */
|
|
56
|
+
export const CLI_VERSION = readOwnVersion();
|
|
57
|
+
//# sourceMappingURL=cliVersion.js.map
|
|
@@ -57,6 +57,13 @@ export class CLIParser {
|
|
|
57
57
|
positional.push(token);
|
|
58
58
|
index++;
|
|
59
59
|
}
|
|
60
|
+
// Apply documented option defaults for options not provided on the CLI.
|
|
61
|
+
for (const definition of definitions) {
|
|
62
|
+
if (definition.defaultValue !== undefined &&
|
|
63
|
+
!(definition.name in options)) {
|
|
64
|
+
options[definition.name] = definition.defaultValue;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
60
67
|
const parsedArguments = this.parseArguments(positional, argumentsDefinitions);
|
|
61
68
|
if (!this.allowUnknownCommands &&
|
|
62
69
|
!command &&
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { CLI_OPTION_PREFIXES } from "../cliConstant/cliConstant.value.js";
|
|
7
7
|
import { InvalidOptionError, MissingOptionValueError, } from "../cliError/cliError.option.js";
|
|
8
|
-
import {
|
|
8
|
+
import { assignOptionValue } from "./cliParser.longOption.js";
|
|
9
9
|
/** Parses a short option token from the token stream. */
|
|
10
10
|
export function parseShortOption(tokens, index, definitions, values, allowUnknownOptions) {
|
|
11
11
|
const token = tokens[index];
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The `zudojs add` command for adding feature packages.
|
|
5
5
|
*/
|
|
6
|
-
import { join
|
|
6
|
+
import { join } from "node:path";
|
|
7
7
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
|
-
import {
|
|
8
|
+
import { runStreaming } from "../utils/utils.exec.js";
|
|
9
9
|
import { CLIValidationError, CLIGenerationError } from "../errors/index.js";
|
|
10
10
|
import { ManifestManager } from "../manifest/manifestManager.core.js";
|
|
11
|
+
import { ZUDOJS_PACKAGES_VERSION } from "../constants/index.js";
|
|
11
12
|
const FEATURE_PACKAGES = {
|
|
12
13
|
database: ["@zudojs/database"],
|
|
13
14
|
queue: ["@zudojs/queue"],
|
|
@@ -32,9 +33,9 @@ export async function runAddCommand(context) {
|
|
|
32
33
|
context.logger.info(`Adding feature: ${feature}`);
|
|
33
34
|
context.logger.info(`Packages: ${packages.join(", ")}`);
|
|
34
35
|
try {
|
|
35
|
-
const { manager, rootPkg, isWorkspace } = detectPackageManager();
|
|
36
|
+
const { manager, rootPkg, isWorkspace } = detectPackageManager(context.cwd);
|
|
36
37
|
const pkgPath = join(context.cwd, rootPkg);
|
|
37
|
-
const version = isWorkspace ? "workspace:*" :
|
|
38
|
+
const version = isWorkspace ? "workspace:*" : ZUDOJS_PACKAGES_VERSION;
|
|
38
39
|
if (!existsSync(pkgPath)) {
|
|
39
40
|
throw new CLIGenerationError(`Could not find package.json at ${pkgPath}`);
|
|
40
41
|
}
|
|
@@ -64,7 +65,7 @@ export async function runAddCommand(context) {
|
|
|
64
65
|
}
|
|
65
66
|
if (context.values["skip-install"] !== true) {
|
|
66
67
|
context.logger.info(`Installing dependencies with ${manager}...`);
|
|
67
|
-
await
|
|
68
|
+
await runStreaming(manager, ["install"], context.cwd);
|
|
68
69
|
}
|
|
69
70
|
context.logger.info(`Feature "${feature}" added successfully.`);
|
|
70
71
|
context.logger.info(`Next steps:`);
|
|
@@ -79,30 +80,32 @@ export async function runAddCommand(context) {
|
|
|
79
80
|
throw new CLIGenerationError(`Failed to add feature: ${feature}: ${message}`, error);
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
|
-
function detectPackageManager() {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
if (existsSync("lerna.json")) {
|
|
90
|
-
return { manager: "npm", rootPkg: "package.json", isWorkspace: true };
|
|
91
|
-
}
|
|
92
|
-
return { manager: "npm", rootPkg: "package.json", isWorkspace: false };
|
|
93
|
-
}
|
|
94
|
-
function readZudojsVersion() {
|
|
83
|
+
function detectPackageManager(cwd) {
|
|
84
|
+
// A project is a workspace only when a workspace definition exists:
|
|
85
|
+
// pnpm-workspace.yaml or a "workspaces" field in package.json. Lock files
|
|
86
|
+
// merely indicate the package manager.
|
|
87
|
+
const hasPnpmWorkspace = existsSync(join(cwd, "pnpm-workspace.yaml"));
|
|
88
|
+
let hasWorkspacesField = false;
|
|
95
89
|
try {
|
|
96
|
-
const
|
|
97
|
-
if (existsSync(
|
|
98
|
-
const pkg = JSON.parse(readFileSync(
|
|
99
|
-
|
|
90
|
+
const pkgPath = join(cwd, "package.json");
|
|
91
|
+
if (existsSync(pkgPath)) {
|
|
92
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
93
|
+
hasWorkspacesField = pkg.workspaces !== undefined;
|
|
100
94
|
}
|
|
101
95
|
}
|
|
102
96
|
catch {
|
|
103
|
-
// ignore
|
|
97
|
+
// ignore malformed package.json
|
|
104
98
|
}
|
|
105
|
-
|
|
99
|
+
const isWorkspace = hasPnpmWorkspace || hasWorkspacesField;
|
|
100
|
+
const manager = hasPnpmWorkspace || existsSync(join(cwd, "pnpm-lock.yaml"))
|
|
101
|
+
? "pnpm"
|
|
102
|
+
: existsSync(join(cwd, "yarn.lock"))
|
|
103
|
+
? "yarn"
|
|
104
|
+
: existsSync(join(cwd, "bun.lock")) ||
|
|
105
|
+
existsSync(join(cwd, "bun.lockb"))
|
|
106
|
+
? "bun"
|
|
107
|
+
: "npm";
|
|
108
|
+
return { manager, rootPkg: "package.json", isWorkspace };
|
|
106
109
|
}
|
|
107
110
|
function updateZudojsConfig(cwd, feature) {
|
|
108
111
|
const configPath = join(cwd, "zudojs.config.ts");
|
|
@@ -5,24 +5,28 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { join } from "node:path";
|
|
8
|
-
import {
|
|
8
|
+
import { runStreaming } from "../utils/utils.exec.js";
|
|
9
9
|
import { findProjectRoot } from "../resolvers/project.resolver.js";
|
|
10
|
+
import { CLIGenerationError, CLINotInProjectError } from "../errors/index.js";
|
|
10
11
|
export async function runBuildCommand(context) {
|
|
11
12
|
const projectRoot = findProjectRoot(context.cwd);
|
|
12
13
|
if (!projectRoot) {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
// Throwing (rather than returning) is what gives the process a non-zero
|
|
15
|
+
// exit code; CI must not see a green build for a missing project.
|
|
16
|
+
throw new CLINotInProjectError();
|
|
15
17
|
}
|
|
16
18
|
context.logger.info(`Building project at: ${projectRoot}`);
|
|
17
19
|
const packageManager = detectPackageManager(projectRoot);
|
|
18
20
|
const buildArgs = getBuildArgs(packageManager);
|
|
19
21
|
try {
|
|
20
|
-
await
|
|
22
|
+
await runStreaming(packageManager, buildArgs, projectRoot);
|
|
21
23
|
context.logger.info("Build completed successfully.");
|
|
22
24
|
}
|
|
23
25
|
catch (error) {
|
|
24
26
|
const message = error instanceof Error ? error.message : String(error);
|
|
25
27
|
context.logger.error(`Build failed: ${message}`);
|
|
28
|
+
// A failed build must fail the command so CI does not report success.
|
|
29
|
+
throw new CLIGenerationError(`Build failed: ${message}`, error);
|
|
26
30
|
}
|
|
27
31
|
}
|
|
28
32
|
function detectPackageManager(cwd) {
|
|
@@ -32,7 +36,7 @@ function detectPackageManager(cwd) {
|
|
|
32
36
|
return "yarn";
|
|
33
37
|
if (existsSync(join(cwd, "package-lock.json")))
|
|
34
38
|
return "npm";
|
|
35
|
-
if (existsSync(join(cwd, "bun.lockb")))
|
|
39
|
+
if (existsSync(join(cwd, "bun.lock")) || existsSync(join(cwd, "bun.lockb")))
|
|
36
40
|
return "bun";
|
|
37
41
|
return "npm";
|
|
38
42
|
}
|
|
@@ -41,9 +45,11 @@ function getBuildArgs(packageManager) {
|
|
|
41
45
|
case "pnpm":
|
|
42
46
|
return ["-r", "run", "build"];
|
|
43
47
|
case "yarn":
|
|
44
|
-
|
|
48
|
+
// Plain `yarn run build` works on both Yarn classic and Berry without
|
|
49
|
+
// requiring the workspace-tools plugin.
|
|
50
|
+
return ["run", "build"];
|
|
45
51
|
case "bun":
|
|
46
|
-
return ["
|
|
52
|
+
return ["run", "build"];
|
|
47
53
|
default:
|
|
48
54
|
return ["run", "build"];
|
|
49
55
|
}
|
|
@@ -15,17 +15,25 @@ import { InfrastructureGenerator } from "../generators/infrastructure/infrastruc
|
|
|
15
15
|
import { BackendGenerator } from "../generators/backend/backend.generator.js";
|
|
16
16
|
import { RollbackManager } from "../rollback/rollbackManager.core.js";
|
|
17
17
|
import { promptProjectName, promptProjectType, promptConfirmation, } from "../prompts/project/index.js";
|
|
18
|
-
import { promptBackendArchitecture, promptDatabase, promptApiStyle, } from "../prompts/backend/index.js";
|
|
18
|
+
import { promptBackendArchitecture, promptDatabase, promptApiStyle, promptServices, } from "../prompts/backend/index.js";
|
|
19
19
|
import { promptFramework, promptFrontendArchitecture, } from "../prompts/frontend/index.js";
|
|
20
20
|
import { promptPackageManager } from "../prompts/workspace/index.js";
|
|
21
21
|
import { promptCapabilities } from "../prompts/capabilities/index.js";
|
|
22
22
|
import { CLIValidationError, CLIGenerationError } from "../errors/index.js";
|
|
23
|
-
import { execCommand } from "../utils/utils.exec.js";
|
|
23
|
+
import { execCommand, runStreaming } from "../utils/utils.exec.js";
|
|
24
24
|
import { writeFileTree } from "../utils/utils.fileSystem.js";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
25
|
+
import { resolveMicroserviceServices } from "../templates/microservice/index.js";
|
|
26
|
+
import { ManifestManager } from "../manifest/manifestManager.core.js";
|
|
27
|
+
import { CLI_VERSION } from "../constants/index.js";
|
|
28
28
|
const VALID_PROJECT_TYPES = ["backend", "frontend", "fullstack"];
|
|
29
|
+
const VALID_ARCHITECTURES = [
|
|
30
|
+
"monolith",
|
|
31
|
+
"modular-monolith",
|
|
32
|
+
"microservice",
|
|
33
|
+
];
|
|
34
|
+
const VALID_DATABASES = ["postgresql", "mysql", "sqlite", "mongodb"];
|
|
35
|
+
const VALID_PACKAGE_MANAGERS = ["npm", "pnpm", "yarn", "bun"];
|
|
36
|
+
const SERVICE_NAME_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
29
37
|
const VALID_FRONTENDS = [
|
|
30
38
|
"none",
|
|
31
39
|
"react",
|
|
@@ -59,8 +67,54 @@ function validateProjectName(name) {
|
|
|
59
67
|
throw new CLIValidationError("Project name must contain only alphanumeric characters, hyphens, and underscores.");
|
|
60
68
|
}
|
|
61
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns whether the user typed a flag on the command line.
|
|
72
|
+
*
|
|
73
|
+
* All the shapes the parser accepts must be recognised here, otherwise an
|
|
74
|
+
* explicitly supplied flag is silently dropped and the interactive prompt
|
|
75
|
+
* offers its own default instead:
|
|
76
|
+
*
|
|
77
|
+
* `--type backend` `--type=backend` `-t backend` `-tbackend` `-abt`
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* Narrows a raw CLI string to one of a fixed set of choices.
|
|
81
|
+
*
|
|
82
|
+
* The returned value is typed as the union, which is what lets the
|
|
83
|
+
* non-interactive branch build ScaffoldOptions without `as any` casts. The
|
|
84
|
+
* cast below is guarded by the membership test immediately above it.
|
|
85
|
+
*/
|
|
86
|
+
function validateChoice(value, allowed, label) {
|
|
87
|
+
if (!allowed.includes(value)) {
|
|
88
|
+
throw new CLIValidationError(`Invalid ${label}: ${value}. Valid: ${allowed.join(", ")}`);
|
|
89
|
+
}
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
62
92
|
function hasExplicitFlag(args, long, short) {
|
|
63
|
-
|
|
93
|
+
const longName = long.startsWith("--") ? long.slice(2) : long;
|
|
94
|
+
const shortName = short !== undefined && short.startsWith("-") ? short.slice(1) : short;
|
|
95
|
+
for (const arg of args) {
|
|
96
|
+
if (arg === "--")
|
|
97
|
+
break;
|
|
98
|
+
if (arg.startsWith("--")) {
|
|
99
|
+
const body = arg.slice(2);
|
|
100
|
+
const separator = body.indexOf("=");
|
|
101
|
+
const name = separator >= 0 ? body.slice(0, separator) : body;
|
|
102
|
+
// `--no-install` negates the boolean `install`; both count as explicit.
|
|
103
|
+
if (name === longName || name === `no-${longName}`)
|
|
104
|
+
return true;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (shortName === undefined)
|
|
108
|
+
continue;
|
|
109
|
+
if (arg.startsWith("-") && arg.length > 1) {
|
|
110
|
+
// Every short flag `create` defines takes a value, so it can only be
|
|
111
|
+
// the first character of the token: `-t backend` or `-tbackend`.
|
|
112
|
+
// Matching anywhere would treat the "t" in `-fnuxt` as `--type`.
|
|
113
|
+
if (arg[1] === shortName)
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
64
118
|
}
|
|
65
119
|
export async function runCreateCommand(context) {
|
|
66
120
|
const projectName = context.values["project-name"];
|
|
@@ -76,34 +130,36 @@ export async function runCreateCommand(context) {
|
|
|
76
130
|
const noInstall = context.values["no-install"] === true;
|
|
77
131
|
const noGit = context.values["no-git"] === true;
|
|
78
132
|
const servicesRaw = context.values.services;
|
|
79
|
-
const
|
|
133
|
+
const servicesExplicit = hasExplicitFlag(context.args, "--services");
|
|
134
|
+
const parsedServices = servicesRaw
|
|
80
135
|
? servicesRaw
|
|
81
136
|
.split(",")
|
|
82
137
|
.map((s) => s.trim())
|
|
83
138
|
.filter(Boolean)
|
|
84
139
|
: [];
|
|
140
|
+
// The --services option only applies to microservice architecture; ignore
|
|
141
|
+
// its parser-applied default for other architectures.
|
|
142
|
+
const services = servicesExplicit || architecture === "microservice" ? parsedServices : [];
|
|
85
143
|
if (projectName) {
|
|
86
144
|
validateProjectName(projectName);
|
|
87
145
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (!VALID_APIS.includes(api)) {
|
|
101
|
-
throw new CLIValidationError(`Invalid API style: ${api}. Valid: ${VALID_APIS.join(", ")}`);
|
|
146
|
+
const projectTypeValue = validateChoice(projectType, VALID_PROJECT_TYPES, "project type");
|
|
147
|
+
const architectureValue = validateChoice(architecture, VALID_ARCHITECTURES, "architecture");
|
|
148
|
+
const databaseValue = validateChoice(database, VALID_DATABASES, "database");
|
|
149
|
+
const packageManagerValue = validateChoice(packageManager, VALID_PACKAGE_MANAGERS, "package manager");
|
|
150
|
+
const frontendValue = validateChoice(frontend, VALID_FRONTENDS, "frontend");
|
|
151
|
+
const frontendArchitectureValue = validateChoice(frontendArchitecture, VALID_FRONTEND_ARCHITECTURES, "frontend architecture");
|
|
152
|
+
const languageValue = validateChoice(language, VALID_LANGUAGES, "language");
|
|
153
|
+
const apiValue = validateChoice(api, VALID_APIS, "API style");
|
|
154
|
+
for (const service of services) {
|
|
155
|
+
if (!SERVICE_NAME_PATTERN.test(service)) {
|
|
156
|
+
throw new CLIValidationError(`Invalid service name: "${service}". Service names must contain only alphanumeric characters, hyphens, and underscores.`);
|
|
157
|
+
}
|
|
102
158
|
}
|
|
103
|
-
const resolvedFrontend =
|
|
104
|
-
?
|
|
159
|
+
const resolvedFrontend = projectTypeValue === "frontend" || projectTypeValue === "fullstack"
|
|
160
|
+
? frontendValue === "none"
|
|
105
161
|
? "react"
|
|
106
|
-
:
|
|
162
|
+
: frontendValue
|
|
107
163
|
: undefined;
|
|
108
164
|
const explicitOverrides = {
|
|
109
165
|
projectName,
|
|
@@ -126,7 +182,7 @@ export async function runCreateCommand(context) {
|
|
|
126
182
|
if (hasExplicitFlag(context.args, "--frontend", "-f")) {
|
|
127
183
|
explicitOverrides.frontend = resolvedFrontend;
|
|
128
184
|
}
|
|
129
|
-
if (hasExplicitFlag(context.args, "--frontend-architecture", "-
|
|
185
|
+
if (hasExplicitFlag(context.args, "--frontend-architecture", "-F")) {
|
|
130
186
|
explicitOverrides.frontendArchitecture = frontendArchitecture;
|
|
131
187
|
}
|
|
132
188
|
if (hasExplicitFlag(context.args, "--language", "-l")) {
|
|
@@ -138,9 +194,17 @@ export async function runCreateCommand(context) {
|
|
|
138
194
|
p.intro("Zudojs");
|
|
139
195
|
const name = (await promptProjectName(projectName ?? undefined));
|
|
140
196
|
const type = await promptProjectType(explicitOverrides.projectType);
|
|
141
|
-
|
|
197
|
+
// `architecture` is a required ScaffoldOptions field and is written to
|
|
198
|
+
// the project manifest. For a frontend-only project no prompt runs, so
|
|
199
|
+
// without this default it was `undefined` and the generated manifest
|
|
200
|
+
// came out with no architecture at all, breaking `zudojs dev` and
|
|
201
|
+
// `zudojs generate` in the new project.
|
|
202
|
+
const arch = type === "backend" || type === "fullstack"
|
|
142
203
|
? await promptBackendArchitecture(explicitOverrides.architecture)
|
|
143
|
-
: explicitOverrides.architecture;
|
|
204
|
+
: (explicitOverrides.architecture ?? architectureValue);
|
|
205
|
+
const interactiveServices = arch === "microservice"
|
|
206
|
+
? await promptServices(servicesExplicit ? services : undefined)
|
|
207
|
+
: services;
|
|
144
208
|
const db = type === "backend" || type === "fullstack"
|
|
145
209
|
? await promptDatabase(explicitOverrides.database)
|
|
146
210
|
: explicitOverrides.database;
|
|
@@ -179,7 +243,7 @@ export async function runCreateCommand(context) {
|
|
|
179
243
|
frontendPath: "apps/web",
|
|
180
244
|
language: (explicitOverrides.language ??
|
|
181
245
|
"typescript"),
|
|
182
|
-
services:
|
|
246
|
+
services: interactiveServices,
|
|
183
247
|
enableCQRS,
|
|
184
248
|
enableMessaging,
|
|
185
249
|
enableObservability,
|
|
@@ -194,15 +258,17 @@ export async function runCreateCommand(context) {
|
|
|
194
258
|
else {
|
|
195
259
|
answers = {
|
|
196
260
|
projectName: projectName ?? "",
|
|
197
|
-
projectType:
|
|
198
|
-
architecture:
|
|
199
|
-
packageManager:
|
|
200
|
-
database:
|
|
201
|
-
api:
|
|
202
|
-
|
|
203
|
-
|
|
261
|
+
projectType: projectTypeValue,
|
|
262
|
+
architecture: architectureValue,
|
|
263
|
+
packageManager: packageManagerValue,
|
|
264
|
+
database: databaseValue,
|
|
265
|
+
api: apiValue,
|
|
266
|
+
...(resolvedFrontend !== undefined
|
|
267
|
+
? { frontend: resolvedFrontend }
|
|
268
|
+
: {}),
|
|
269
|
+
frontendArchitecture: frontendArchitectureValue,
|
|
204
270
|
frontendPath: "apps/web",
|
|
205
|
-
language:
|
|
271
|
+
language: languageValue,
|
|
206
272
|
services,
|
|
207
273
|
enableCQRS: true,
|
|
208
274
|
enableMessaging: true,
|
|
@@ -210,7 +276,8 @@ export async function runCreateCommand(context) {
|
|
|
210
276
|
enableOpenAPI: true,
|
|
211
277
|
enableDatabase: true,
|
|
212
278
|
enableQueue: false,
|
|
213
|
-
|
|
279
|
+
// Match the interactive branch, which enables Docker for microservices.
|
|
280
|
+
enableDocker: architectureValue === "microservice",
|
|
214
281
|
installDeps: !noInstall,
|
|
215
282
|
initGit: !noGit,
|
|
216
283
|
};
|
|
@@ -254,6 +321,7 @@ async function createProject(options, context) {
|
|
|
254
321
|
context.logger.info(`Files created: ${result.filesCreated.length}`);
|
|
255
322
|
spinner.stop("Backend project generated");
|
|
256
323
|
}
|
|
324
|
+
await writeProjectManifest(options, targetPath);
|
|
257
325
|
if (options.installDeps) {
|
|
258
326
|
spinner.start("Installing dependencies");
|
|
259
327
|
const installFile = packageManager === "pnpm"
|
|
@@ -264,11 +332,14 @@ async function createProject(options, context) {
|
|
|
264
332
|
? "bun"
|
|
265
333
|
: "npm";
|
|
266
334
|
try {
|
|
267
|
-
|
|
268
|
-
|
|
335
|
+
// Streamed with no timeout: installs can be slow and their output
|
|
336
|
+
// should reach the user.
|
|
337
|
+
spinner.stop("Installing dependencies...");
|
|
338
|
+
await runStreaming(installFile, ["install"], targetPath);
|
|
339
|
+
p.log.success("Dependencies installed");
|
|
269
340
|
}
|
|
270
341
|
catch {
|
|
271
|
-
|
|
342
|
+
p.log.warn("Dependency installation skipped");
|
|
272
343
|
}
|
|
273
344
|
}
|
|
274
345
|
if (options.initGit) {
|
|
@@ -298,6 +369,58 @@ async function createProject(options, context) {
|
|
|
298
369
|
throw new CLIGenerationError(`Failed to create project "${projectName}"`, error);
|
|
299
370
|
}
|
|
300
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Writes the machine-managed .zudojs/manifest.json so follow-up commands
|
|
374
|
+
* (`zudojs dev`, `generate`, `add`) recognize the project immediately.
|
|
375
|
+
*/
|
|
376
|
+
async function writeProjectManifest(options, targetPath) {
|
|
377
|
+
const capabilities = [];
|
|
378
|
+
if (options.enableCQRS)
|
|
379
|
+
capabilities.push("cqrs");
|
|
380
|
+
if (options.enableMessaging)
|
|
381
|
+
capabilities.push("messaging");
|
|
382
|
+
if (options.enableObservability)
|
|
383
|
+
capabilities.push("observability");
|
|
384
|
+
if (options.enableOpenAPI)
|
|
385
|
+
capabilities.push("openapi");
|
|
386
|
+
if (options.enableDatabase)
|
|
387
|
+
capabilities.push("database");
|
|
388
|
+
if (options.enableQueue)
|
|
389
|
+
capabilities.push("queue");
|
|
390
|
+
// Record the services actually generated, not the raw request: the
|
|
391
|
+
// template drops reserved names (gateway) and duplicates, and substitutes
|
|
392
|
+
// its own defaults for an empty list.
|
|
393
|
+
const services = options.architecture === "microservice"
|
|
394
|
+
? resolveMicroserviceServices(options.services)
|
|
395
|
+
: undefined;
|
|
396
|
+
const hasFrontend = options.frontend !== undefined && options.frontend !== "none";
|
|
397
|
+
const hasBackend = options.projectType !== "frontend";
|
|
398
|
+
await new ManifestManager(targetPath).create({
|
|
399
|
+
version: CLI_VERSION,
|
|
400
|
+
projectType: options.projectType ?? "backend",
|
|
401
|
+
architecture: options.architecture,
|
|
402
|
+
...(hasBackend
|
|
403
|
+
? {
|
|
404
|
+
backend: {
|
|
405
|
+
architecture: options.architecture,
|
|
406
|
+
api: options.api ?? "rest",
|
|
407
|
+
},
|
|
408
|
+
}
|
|
409
|
+
: {}),
|
|
410
|
+
...(hasFrontend
|
|
411
|
+
? {
|
|
412
|
+
frontend: {
|
|
413
|
+
framework: options.frontend,
|
|
414
|
+
architecture: options.frontendArchitecture ?? "zudojs-standard",
|
|
415
|
+
},
|
|
416
|
+
}
|
|
417
|
+
: {}),
|
|
418
|
+
...(options.database ? { database: { provider: options.database } } : {}),
|
|
419
|
+
workspace: { packageManager: options.packageManager },
|
|
420
|
+
capabilities,
|
|
421
|
+
...(services ? { services: [...services] } : {}),
|
|
422
|
+
});
|
|
423
|
+
}
|
|
301
424
|
async function generateFullstackProject(options, projectPath, rollback) {
|
|
302
425
|
const composer = new FullstackComposer();
|
|
303
426
|
const result = await composer.generate({
|
|
@@ -326,17 +449,12 @@ async function generateFullstackProject(options, projectPath, rollback) {
|
|
|
326
449
|
if (!result.success) {
|
|
327
450
|
throw new CLIGenerationError(`Fullstack generation failed:\n${result.errors.join("\n")}`);
|
|
328
451
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
backendFiles = generateMicroserviceFiles(options);
|
|
336
|
-
break;
|
|
337
|
-
default:
|
|
338
|
-
backendFiles = generateMonolithFiles(options);
|
|
339
|
-
}
|
|
452
|
+
// Uses the same BackendGenerator the generator registry exposes rather
|
|
453
|
+
// than a third private copy of the architecture switch.
|
|
454
|
+
const backendFiles = await new BackendGenerator().generate(options, join(projectPath, "apps/api"));
|
|
455
|
+
// The backend template may carry its own workspace definition; nested in
|
|
456
|
+
// apps/api it would create a second workspace root, so strip it.
|
|
457
|
+
delete backendFiles["pnpm-workspace.yaml"];
|
|
340
458
|
await writeFileTree(join(projectPath, "apps/api"), backendFiles);
|
|
341
459
|
rollback.trackDirectory(join(projectPath, "apps/api"));
|
|
342
460
|
const integrationGenerator = new IntegrationGenerator();
|