@buenojs/bueno 0.8.6 → 0.8.8
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/.claude/settings.local.json +9 -0
- package/README.md +132 -15
- package/dist/cache/index.d.ts +187 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cli/bin.d.ts +8 -0
- package/dist/cli/bin.d.ts.map +1 -0
- package/dist/cli/bin.js +483 -155
- package/dist/cli/commands/add-frontend.d.ts +7 -0
- package/dist/cli/commands/add-frontend.d.ts.map +1 -0
- package/dist/cli/commands/build.d.ts +7 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/dev.d.ts +7 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/generate.d.ts +7 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/help.d.ts +7 -0
- package/dist/cli/commands/help.d.ts.map +1 -0
- package/dist/cli/commands/index.d.ts +59 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/migration.d.ts +7 -0
- package/dist/cli/commands/migration.d.ts.map +1 -0
- package/dist/cli/commands/new.d.ts +7 -0
- package/dist/cli/commands/new.d.ts.map +1 -0
- package/dist/cli/commands/start.d.ts +7 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/core/args.d.ts +61 -0
- package/dist/cli/core/args.d.ts.map +1 -0
- package/dist/cli/core/console.d.ts +135 -0
- package/dist/cli/core/console.d.ts.map +1 -0
- package/dist/cli/core/index.d.ts +10 -0
- package/dist/cli/core/index.d.ts.map +1 -0
- package/dist/cli/core/prompt.d.ts +63 -0
- package/dist/cli/core/prompt.d.ts.map +1 -0
- package/dist/cli/core/spinner.d.ts +111 -0
- package/dist/cli/core/spinner.d.ts.map +1 -0
- package/dist/cli/index.d.ts +47 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/templates/database/index.d.ts +24 -0
- package/dist/cli/templates/database/index.d.ts.map +1 -0
- package/dist/cli/templates/database/mysql.d.ts +6 -0
- package/dist/cli/templates/database/mysql.d.ts.map +1 -0
- package/dist/cli/templates/database/none.d.ts +8 -0
- package/dist/cli/templates/database/none.d.ts.map +1 -0
- package/dist/cli/templates/database/postgresql.d.ts +6 -0
- package/dist/cli/templates/database/postgresql.d.ts.map +1 -0
- package/dist/cli/templates/database/sqlite.d.ts +6 -0
- package/dist/cli/templates/database/sqlite.d.ts.map +1 -0
- package/dist/cli/templates/deploy.d.ts +41 -0
- package/dist/cli/templates/deploy.d.ts.map +1 -0
- package/dist/cli/templates/docker.d.ts +30 -0
- package/dist/cli/templates/docker.d.ts.map +1 -0
- package/dist/cli/templates/frontend/index.d.ts +25 -0
- package/dist/cli/templates/frontend/index.d.ts.map +1 -0
- package/dist/cli/templates/frontend/none.d.ts +8 -0
- package/dist/cli/templates/frontend/none.d.ts.map +1 -0
- package/dist/cli/templates/frontend/react.d.ts +6 -0
- package/dist/cli/templates/frontend/react.d.ts.map +1 -0
- package/dist/cli/templates/frontend/solid.d.ts +6 -0
- package/dist/cli/templates/frontend/solid.d.ts.map +1 -0
- package/dist/cli/templates/frontend/svelte.d.ts +6 -0
- package/dist/cli/templates/frontend/svelte.d.ts.map +1 -0
- package/dist/cli/templates/frontend/vue.d.ts +6 -0
- package/dist/cli/templates/frontend/vue.d.ts.map +1 -0
- package/dist/cli/templates/generators/index.d.ts +29 -0
- package/dist/cli/templates/generators/index.d.ts.map +1 -0
- package/dist/cli/templates/generators/types.d.ts +32 -0
- package/dist/cli/templates/generators/types.d.ts.map +1 -0
- package/dist/cli/templates/index.d.ts +12 -0
- package/dist/cli/templates/index.d.ts.map +1 -0
- package/dist/cli/templates/project/api.d.ts +6 -0
- package/dist/cli/templates/project/api.d.ts.map +1 -0
- package/dist/cli/templates/project/default.d.ts +6 -0
- package/dist/cli/templates/project/default.d.ts.map +1 -0
- package/dist/cli/templates/project/fullstack.d.ts +14 -0
- package/dist/cli/templates/project/fullstack.d.ts.map +1 -0
- package/dist/cli/templates/project/index.d.ts +26 -0
- package/dist/cli/templates/project/index.d.ts.map +1 -0
- package/dist/cli/templates/project/minimal.d.ts +6 -0
- package/dist/cli/templates/project/minimal.d.ts.map +1 -0
- package/dist/cli/templates/project/types.d.ts +80 -0
- package/dist/cli/templates/project/types.d.ts.map +1 -0
- package/dist/cli/templates/project/website.d.ts +8 -0
- package/dist/cli/templates/project/website.d.ts.map +1 -0
- package/dist/cli/utils/fs.d.ts +137 -0
- package/dist/cli/utils/fs.d.ts.map +1 -0
- package/dist/cli/utils/index.d.ts +9 -0
- package/dist/cli/utils/index.d.ts.map +1 -0
- package/dist/cli/utils/strings.d.ts +86 -0
- package/dist/cli/utils/strings.d.ts.map +1 -0
- package/dist/cli/utils/version.d.ts +15 -0
- package/dist/cli/utils/version.d.ts.map +1 -0
- package/dist/config/env-validation.d.ts +49 -0
- package/dist/config/env-validation.d.ts.map +1 -0
- package/dist/config/env.d.ts +167 -0
- package/dist/config/env.d.ts.map +1 -0
- package/dist/config/index.d.ts +168 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/loader.d.ts +81 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/merge.d.ts +66 -0
- package/dist/config/merge.d.ts.map +1 -0
- package/dist/config/types.d.ts +322 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/validation.d.ts +100 -0
- package/dist/config/validation.d.ts.map +1 -0
- package/dist/container/forward-ref.d.ts +116 -0
- package/dist/container/forward-ref.d.ts.map +1 -0
- package/dist/container/index.d.ts +95 -0
- package/dist/container/index.d.ts.map +1 -0
- package/dist/context/index.d.ts +143 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/database/index.d.ts +219 -0
- package/dist/database/index.d.ts.map +1 -0
- package/dist/database/migrations/index.d.ts +146 -0
- package/dist/database/migrations/index.d.ts.map +1 -0
- package/dist/database/orm/builder.d.ts +122 -0
- package/dist/database/orm/builder.d.ts.map +1 -0
- package/dist/database/orm/casts/index.d.ts +16 -0
- package/dist/database/orm/casts/index.d.ts.map +1 -0
- package/dist/database/orm/casts/types.d.ts +16 -0
- package/dist/database/orm/casts/types.d.ts.map +1 -0
- package/dist/database/orm/compiler.d.ts +90 -0
- package/dist/database/orm/compiler.d.ts.map +1 -0
- package/dist/database/orm/hooks/index.d.ts +53 -0
- package/dist/database/orm/hooks/index.d.ts.map +1 -0
- package/dist/database/orm/index.d.ts +21 -0
- package/dist/database/orm/index.d.ts.map +1 -0
- package/dist/database/orm/model-registry.d.ts +33 -0
- package/dist/database/orm/model-registry.d.ts.map +1 -0
- package/dist/database/orm/model.d.ts +245 -0
- package/dist/database/orm/model.d.ts.map +1 -0
- package/dist/database/orm/relationships/base.d.ts +69 -0
- package/dist/database/orm/relationships/base.d.ts.map +1 -0
- package/dist/database/orm/relationships/belongs-to-many.d.ts +47 -0
- package/dist/database/orm/relationships/belongs-to-many.d.ts.map +1 -0
- package/dist/database/orm/relationships/belongs-to.d.ts +17 -0
- package/dist/database/orm/relationships/belongs-to.d.ts.map +1 -0
- package/dist/database/orm/relationships/has-many.d.ts +14 -0
- package/dist/database/orm/relationships/has-many.d.ts.map +1 -0
- package/dist/database/orm/relationships/has-one.d.ts +14 -0
- package/dist/database/orm/relationships/has-one.d.ts.map +1 -0
- package/dist/database/orm/relationships/index.d.ts +10 -0
- package/dist/database/orm/relationships/index.d.ts.map +1 -0
- package/dist/database/orm/scopes/index.d.ts +36 -0
- package/dist/database/orm/scopes/index.d.ts.map +1 -0
- package/dist/database/schema/index.d.ts +155 -0
- package/dist/database/schema/index.d.ts.map +1 -0
- package/dist/events/__tests__/event-system.test.d.ts +2 -0
- package/dist/events/__tests__/event-system.test.d.ts.map +1 -0
- package/dist/events/config.d.ts +16 -0
- package/dist/events/config.d.ts.map +1 -0
- package/dist/events/example-usage.d.ts +12 -0
- package/dist/events/example-usage.d.ts.map +1 -0
- package/dist/events/index.d.ts +27 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/manager.d.ts +33 -0
- package/dist/events/manager.d.ts.map +1 -0
- package/dist/events/registry.d.ts +31 -0
- package/dist/events/registry.d.ts.map +1 -0
- package/dist/events/types.d.ts +105 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/frontend/api-routes.d.ts +189 -0
- package/dist/frontend/api-routes.d.ts.map +1 -0
- package/dist/frontend/bundler.d.ts +99 -0
- package/dist/frontend/bundler.d.ts.map +1 -0
- package/dist/frontend/console-client.d.ts +11 -0
- package/dist/frontend/console-client.d.ts.map +1 -0
- package/dist/frontend/console-stream.d.ts +138 -0
- package/dist/frontend/console-stream.d.ts.map +1 -0
- package/dist/frontend/dev-server.d.ts +174 -0
- package/dist/frontend/dev-server.d.ts.map +1 -0
- package/dist/frontend/file-router.d.ts +170 -0
- package/dist/frontend/file-router.d.ts.map +1 -0
- package/dist/frontend/frameworks/index.d.ts +41 -0
- package/dist/frontend/frameworks/index.d.ts.map +1 -0
- package/dist/frontend/frameworks/react.d.ts +32 -0
- package/dist/frontend/frameworks/react.d.ts.map +1 -0
- package/dist/frontend/frameworks/solid.d.ts +42 -0
- package/dist/frontend/frameworks/solid.d.ts.map +1 -0
- package/dist/frontend/frameworks/svelte.d.ts +57 -0
- package/dist/frontend/frameworks/svelte.d.ts.map +1 -0
- package/dist/frontend/frameworks/vue.d.ts +36 -0
- package/dist/frontend/frameworks/vue.d.ts.map +1 -0
- package/dist/frontend/hmr-client.d.ts +22 -0
- package/dist/frontend/hmr-client.d.ts.map +1 -0
- package/dist/frontend/hmr.d.ts +185 -0
- package/dist/frontend/hmr.d.ts.map +1 -0
- package/dist/frontend/index.d.ts +34 -0
- package/dist/frontend/index.d.ts.map +1 -0
- package/dist/frontend/islands.d.ts +135 -0
- package/dist/frontend/islands.d.ts.map +1 -0
- package/dist/frontend/isr.d.ts +143 -0
- package/dist/frontend/isr.d.ts.map +1 -0
- package/dist/frontend/layout.d.ts +140 -0
- package/dist/frontend/layout.d.ts.map +1 -0
- package/dist/frontend/ssr/react.d.ts +118 -0
- package/dist/frontend/ssr/react.d.ts.map +1 -0
- package/dist/frontend/ssr/solid.d.ts +141 -0
- package/dist/frontend/ssr/solid.d.ts.map +1 -0
- package/dist/frontend/ssr/svelte.d.ts +158 -0
- package/dist/frontend/ssr/svelte.d.ts.map +1 -0
- package/dist/frontend/ssr/vue.d.ts +161 -0
- package/dist/frontend/ssr/vue.d.ts.map +1 -0
- package/dist/frontend/ssr.d.ts +147 -0
- package/dist/frontend/ssr.d.ts.map +1 -0
- package/dist/frontend/types.d.ts +1902 -0
- package/dist/frontend/types.d.ts.map +1 -0
- package/dist/graphql/built-in-engine.d.ts +36 -0
- package/dist/graphql/built-in-engine.d.ts.map +1 -0
- package/dist/graphql/context-builder.d.ts +44 -0
- package/dist/graphql/context-builder.d.ts.map +1 -0
- package/dist/graphql/decorators.d.ts +162 -0
- package/dist/graphql/decorators.d.ts.map +1 -0
- package/dist/graphql/execution-pipeline.d.ts +67 -0
- package/dist/graphql/execution-pipeline.d.ts.map +1 -0
- package/dist/graphql/graphql-module.d.ts +70 -0
- package/dist/graphql/graphql-module.d.ts.map +1 -0
- package/dist/graphql/index.d.ts +48 -0
- package/dist/graphql/index.d.ts.map +1 -0
- package/dist/graphql/metadata.d.ts +37 -0
- package/dist/graphql/metadata.d.ts.map +1 -0
- package/dist/graphql/schema-builder.d.ts +34 -0
- package/dist/graphql/schema-builder.d.ts.map +1 -0
- package/dist/graphql/subscription-handler.d.ts +47 -0
- package/dist/graphql/subscription-handler.d.ts.map +1 -0
- package/dist/graphql/types.d.ts +252 -0
- package/dist/graphql/types.d.ts.map +1 -0
- package/dist/health/index.d.ts +176 -0
- package/dist/health/index.d.ts.map +1 -0
- package/dist/i18n/engine.d.ts +105 -0
- package/dist/i18n/engine.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +13 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/loader.d.ts +79 -0
- package/dist/i18n/loader.d.ts.map +1 -0
- package/dist/i18n/middleware.d.ts +96 -0
- package/dist/i18n/middleware.d.ts.map +1 -0
- package/dist/i18n/negotiator.d.ts +84 -0
- package/dist/i18n/negotiator.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +129 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/jobs/drivers/memory.d.ts +38 -0
- package/dist/jobs/drivers/memory.d.ts.map +1 -0
- package/dist/jobs/drivers/redis.d.ts +34 -0
- package/dist/jobs/drivers/redis.d.ts.map +1 -0
- package/dist/jobs/index.d.ts +12 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/queue.d.ts +93 -0
- package/dist/jobs/queue.d.ts.map +1 -0
- package/dist/jobs/types.d.ts +193 -0
- package/dist/jobs/types.d.ts.map +1 -0
- package/dist/jobs/worker.d.ts +91 -0
- package/dist/jobs/worker.d.ts.map +1 -0
- package/dist/lock/index.d.ts +141 -0
- package/dist/lock/index.d.ts.map +1 -0
- package/dist/logger/index.d.ts +156 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/transports/index.d.ts +371 -0
- package/dist/logger/transports/index.d.ts.map +1 -0
- package/dist/metrics/index.d.ts +163 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/middleware/built-in.d.ts +50 -0
- package/dist/middleware/built-in.d.ts.map +1 -0
- package/dist/middleware/index.d.ts +40 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/migrations/index.d.ts +10 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/modules/filters.d.ts +150 -0
- package/dist/modules/filters.d.ts.map +1 -0
- package/dist/modules/guards.d.ts +188 -0
- package/dist/modules/guards.d.ts.map +1 -0
- package/dist/modules/index.d.ts +266 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/interceptors.d.ts +242 -0
- package/dist/modules/interceptors.d.ts.map +1 -0
- package/dist/modules/lazy.d.ts +187 -0
- package/dist/modules/lazy.d.ts.map +1 -0
- package/dist/modules/lifecycle.d.ts +221 -0
- package/dist/modules/lifecycle.d.ts.map +1 -0
- package/dist/modules/metadata.d.ts +32 -0
- package/dist/modules/metadata.d.ts.map +1 -0
- package/dist/modules/pipes.d.ts +287 -0
- package/dist/modules/pipes.d.ts.map +1 -0
- package/dist/notification/channels/base.d.ts +32 -0
- package/dist/notification/channels/base.d.ts.map +1 -0
- package/dist/notification/channels/email.d.ts +37 -0
- package/dist/notification/channels/email.d.ts.map +1 -0
- package/dist/notification/channels/push.d.ts +37 -0
- package/dist/notification/channels/push.d.ts.map +1 -0
- package/dist/notification/channels/sms.d.ts +37 -0
- package/dist/notification/channels/sms.d.ts.map +1 -0
- package/dist/notification/channels/whatsapp.d.ts +37 -0
- package/dist/notification/channels/whatsapp.d.ts.map +1 -0
- package/dist/notification/index.d.ts +15 -0
- package/dist/notification/index.d.ts.map +1 -0
- package/dist/notification/service.d.ts +100 -0
- package/dist/notification/service.d.ts.map +1 -0
- package/dist/notification/types.d.ts +253 -0
- package/dist/notification/types.d.ts.map +1 -0
- package/dist/observability/__tests__/observability.test.d.ts +2 -0
- package/dist/observability/__tests__/observability.test.d.ts.map +1 -0
- package/dist/observability/breadcrumbs.d.ts +48 -0
- package/dist/observability/breadcrumbs.d.ts.map +1 -0
- package/dist/observability/index.d.ts +95 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/interceptor.d.ts +19 -0
- package/dist/observability/interceptor.d.ts.map +1 -0
- package/dist/observability/service.d.ts +101 -0
- package/dist/observability/service.d.ts.map +1 -0
- package/dist/observability/trace.d.ts +21 -0
- package/dist/observability/trace.d.ts.map +1 -0
- package/dist/observability/types.d.ts +172 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/openapi/__tests__/decorators.test.d.ts +2 -0
- package/dist/openapi/__tests__/decorators.test.d.ts.map +1 -0
- package/dist/openapi/__tests__/document-builder.test.d.ts +2 -0
- package/dist/openapi/__tests__/document-builder.test.d.ts.map +1 -0
- package/dist/openapi/__tests__/route-scanner.test.d.ts +2 -0
- package/dist/openapi/__tests__/route-scanner.test.d.ts.map +1 -0
- package/dist/openapi/__tests__/schema-generator.test.d.ts +2 -0
- package/dist/openapi/__tests__/schema-generator.test.d.ts.map +1 -0
- package/dist/openapi/decorators.d.ts +173 -0
- package/dist/openapi/decorators.d.ts.map +1 -0
- package/dist/openapi/document-builder.d.ts +82 -0
- package/dist/openapi/document-builder.d.ts.map +1 -0
- package/dist/openapi/index.d.ts +48 -0
- package/dist/openapi/index.d.ts.map +1 -0
- package/dist/openapi/metadata.d.ts +36 -0
- package/dist/openapi/metadata.d.ts.map +1 -0
- package/dist/openapi/route-scanner.d.ts +34 -0
- package/dist/openapi/route-scanner.d.ts.map +1 -0
- package/dist/openapi/schema-generator.d.ts +53 -0
- package/dist/openapi/schema-generator.d.ts.map +1 -0
- package/dist/openapi/swagger-module.d.ts +57 -0
- package/dist/openapi/swagger-module.d.ts.map +1 -0
- package/dist/openapi/types.d.ts +344 -0
- package/dist/openapi/types.d.ts.map +1 -0
- package/dist/orm/index.d.ts +10 -0
- package/dist/orm/index.d.ts.map +1 -0
- package/dist/router/index.d.ts +73 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/linear.d.ts +54 -0
- package/dist/router/linear.d.ts.map +1 -0
- package/dist/router/regex.d.ts +49 -0
- package/dist/router/regex.d.ts.map +1 -0
- package/dist/router/tree.d.ts +112 -0
- package/dist/router/tree.d.ts.map +1 -0
- package/dist/rpc/index.d.ts +321 -0
- package/dist/rpc/index.d.ts.map +1 -0
- package/dist/schema/index.d.ts +10 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/security/index.d.ts +126 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/ssg/index.d.ts +73 -0
- package/dist/ssg/index.d.ts.map +1 -0
- package/dist/storage/index.d.ts +99 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/telemetry/index.d.ts +376 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/template/index.d.ts +7 -0
- package/dist/template/index.d.ts.map +1 -0
- package/dist/templates/engine.d.ts +60 -0
- package/dist/templates/engine.d.ts.map +1 -0
- package/dist/templates/index.d.ts +9 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/loader.d.ts +45 -0
- package/dist/templates/loader.d.ts.map +1 -0
- package/dist/templates/renderers/markdown.d.ts +46 -0
- package/dist/templates/renderers/markdown.d.ts.map +1 -0
- package/dist/templates/renderers/simple.d.ts +35 -0
- package/dist/templates/renderers/simple.d.ts.map +1 -0
- package/dist/templates/types.d.ts +138 -0
- package/dist/templates/types.d.ts.map +1 -0
- package/dist/testing/index.d.ts +539 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +116 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/validation/index.d.ts +89 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/schemas.d.ts +243 -0
- package/dist/validation/schemas.d.ts.map +1 -0
- package/dist/websocket/index.d.ts +252 -0
- package/dist/websocket/index.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/cli/commands/add-frontend.ts +444 -0
- package/src/cli/commands/new.ts +23 -0
- package/src/cli/index.ts +1 -0
- package/src/cli/templates/frontend/react.ts +2 -1
- package/src/cli/templates/frontend/solid.ts +2 -1
- package/src/cli/templates/frontend/svelte.ts +2 -1
- package/src/cli/templates/frontend/vue.ts +2 -1
- package/src/cli/templates/project/api.ts +1 -1
- package/src/cli/templates/project/default.ts +1 -1
- package/src/cli/templates/project/fullstack.ts +14 -104
- package/src/cli/templates/project/website.ts +62 -11
- package/tsconfig.declaration.json +14 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add Frontend Command
|
|
3
|
+
*
|
|
4
|
+
* Add a frontend framework to an existing or new Bueno project
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { cliConsole, colors, printTable } from "../core/console";
|
|
8
|
+
import { isInteractive, select } from "../core/prompt";
|
|
9
|
+
import { type TaskOptions, runTasks, spinner } from "../core/spinner";
|
|
10
|
+
import { CLIError, CLIErrorType } from "../index";
|
|
11
|
+
import {
|
|
12
|
+
type FrontendFramework,
|
|
13
|
+
getFrontendOptions,
|
|
14
|
+
getFrontendTemplate,
|
|
15
|
+
} from "../templates";
|
|
16
|
+
import { createDirectory, fileExists, joinPaths, readFile, writeFile } from "../utils/fs";
|
|
17
|
+
import { defineCommand } from "./index";
|
|
18
|
+
import type { ParsedArgs } from "../core/args";
|
|
19
|
+
import { getOption, hasFlag } from "../core/args";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Validate we're in a Bueno project
|
|
23
|
+
*/
|
|
24
|
+
async function validateBuenoProject(projectPath: string): Promise<boolean> {
|
|
25
|
+
const packageJsonPath = joinPaths(projectPath, "package.json");
|
|
26
|
+
const buenoCofigPath = joinPaths(projectPath, "bueno.config.ts");
|
|
27
|
+
|
|
28
|
+
const hasPackageJson = await fileExists(packageJsonPath);
|
|
29
|
+
const hasBuenoConfig = await fileExists(buenoCofigPath);
|
|
30
|
+
|
|
31
|
+
return hasPackageJson && hasBuenoConfig;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Check if client directory exists
|
|
36
|
+
*/
|
|
37
|
+
async function clientDirExists(projectPath: string): Promise<boolean> {
|
|
38
|
+
return await fileExists(joinPaths(projectPath, "client"));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Generate Bun bundler config for framework
|
|
43
|
+
*/
|
|
44
|
+
function getBunBundlerConfig(framework: FrontendFramework): string {
|
|
45
|
+
const configBase = {
|
|
46
|
+
react: {
|
|
47
|
+
entrypoints: ["./src/main.tsx"],
|
|
48
|
+
loaders: {
|
|
49
|
+
".tsx": "tsx",
|
|
50
|
+
".ts": "tsx",
|
|
51
|
+
".css": "file",
|
|
52
|
+
".svg": "file",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
vue: {
|
|
56
|
+
entrypoints: ["./src/main.ts"],
|
|
57
|
+
loaders: {
|
|
58
|
+
".vue": "file",
|
|
59
|
+
".ts": "ts",
|
|
60
|
+
".css": "file",
|
|
61
|
+
".svg": "file",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
svelte: {
|
|
65
|
+
entrypoints: ["./src/main.ts"],
|
|
66
|
+
loaders: {
|
|
67
|
+
".svelte": "file",
|
|
68
|
+
".ts": "ts",
|
|
69
|
+
".css": "file",
|
|
70
|
+
".svg": "file",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
solid: {
|
|
74
|
+
entrypoints: ["./src/main.tsx"],
|
|
75
|
+
loaders: {
|
|
76
|
+
".tsx": "tsx",
|
|
77
|
+
".ts": "tsx",
|
|
78
|
+
".css": "file",
|
|
79
|
+
".svg": "file",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const config = configBase[framework] || configBase.react;
|
|
85
|
+
|
|
86
|
+
return `import type { BunPlugin } from 'bun';
|
|
87
|
+
import postcss from 'postcss';
|
|
88
|
+
import tailwindcss from 'tailwindcss';
|
|
89
|
+
import autoprefixer from 'autoprefixer';
|
|
90
|
+
import * as fs from 'fs';
|
|
91
|
+
import * as path from 'path';
|
|
92
|
+
|
|
93
|
+
// PostCSS processor for Tailwind
|
|
94
|
+
const postcssPlugin: BunPlugin = {
|
|
95
|
+
name: 'postcss-plugin',
|
|
96
|
+
setup(build) {
|
|
97
|
+
build.onLoad({ filter: /\\.css$/ }, async (args) => {
|
|
98
|
+
const css = fs.readFileSync(args.path, 'utf-8');
|
|
99
|
+
const result = await postcss([tailwindcss, autoprefixer]).process(css, {
|
|
100
|
+
from: args.path,
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
contents: result.css,
|
|
104
|
+
loader: 'text',
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const config = {
|
|
111
|
+
entrypoints: [${config.entrypoints.map((e) => `"${e}"`).join(", ")}],
|
|
112
|
+
outdir: "../dist/client",
|
|
113
|
+
minify: true,
|
|
114
|
+
sourcemap: "external",
|
|
115
|
+
loaders: {
|
|
116
|
+
${Object.entries(config.loaders)
|
|
117
|
+
.map(([ext, loader]) => ` "${ext}": "${loader}",`)
|
|
118
|
+
.join("\n")}
|
|
119
|
+
},
|
|
120
|
+
plugins: [postcssPlugin],
|
|
121
|
+
};
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Generate Tailwind config
|
|
127
|
+
*/
|
|
128
|
+
function getTailwindConfig(): string {
|
|
129
|
+
return `export default {
|
|
130
|
+
content: [
|
|
131
|
+
"./index.html",
|
|
132
|
+
"./src/**/*.{tsx,ts,jsx,js}",
|
|
133
|
+
],
|
|
134
|
+
theme: {
|
|
135
|
+
extend: {},
|
|
136
|
+
},
|
|
137
|
+
plugins: [],
|
|
138
|
+
};
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Generate PostCSS config
|
|
144
|
+
*/
|
|
145
|
+
function getPostCSSConfig(): string {
|
|
146
|
+
return `export default {
|
|
147
|
+
plugins: {
|
|
148
|
+
tailwindcss: {},
|
|
149
|
+
autoprefixer: {},
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
`;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Merge package.json dependencies and scripts
|
|
157
|
+
*/
|
|
158
|
+
async function mergePackageJson(
|
|
159
|
+
projectPath: string,
|
|
160
|
+
newDeps: Record<string, string>,
|
|
161
|
+
newDevDeps: Record<string, string>,
|
|
162
|
+
newScripts: Record<string, string>,
|
|
163
|
+
): Promise<void> {
|
|
164
|
+
const packageJsonPath = joinPaths(projectPath, "package.json");
|
|
165
|
+
const content = await readFile(packageJsonPath);
|
|
166
|
+
const packageJson = JSON.parse(content);
|
|
167
|
+
|
|
168
|
+
// Merge dependencies
|
|
169
|
+
packageJson.dependencies = {
|
|
170
|
+
...packageJson.dependencies,
|
|
171
|
+
...newDeps,
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// Merge devDependencies
|
|
175
|
+
packageJson.devDependencies = {
|
|
176
|
+
...packageJson.devDependencies,
|
|
177
|
+
...newDevDeps,
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// Merge scripts (preserve existing, add new)
|
|
181
|
+
packageJson.scripts = {
|
|
182
|
+
...packageJson.scripts,
|
|
183
|
+
...newScripts,
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// Write back
|
|
187
|
+
await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Handle add frontend command
|
|
192
|
+
*/
|
|
193
|
+
async function handleAddFrontend(args: ParsedArgs): Promise<void> {
|
|
194
|
+
// Get project path from option or use current directory
|
|
195
|
+
const projectPath = getOption(args, "project-path", {
|
|
196
|
+
name: "project-path",
|
|
197
|
+
type: "string",
|
|
198
|
+
description: "Path to the Bueno project",
|
|
199
|
+
}) as string || process.cwd();
|
|
200
|
+
|
|
201
|
+
// Validate we're in a Bueno project
|
|
202
|
+
const isValid = await validateBuenoProject(projectPath);
|
|
203
|
+
if (!isValid) {
|
|
204
|
+
throw new CLIError(
|
|
205
|
+
"Not a Bueno project. Please run this command in a Bueno project directory (must have package.json and bueno.config.ts)",
|
|
206
|
+
CLIErrorType.INVALID_ARGS,
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Get framework choice (from positional arg or option)
|
|
211
|
+
let framework = (args.positionals[0] ||
|
|
212
|
+
getOption(args, "framework", {
|
|
213
|
+
name: "framework",
|
|
214
|
+
alias: "f",
|
|
215
|
+
type: "string",
|
|
216
|
+
description: "",
|
|
217
|
+
})) as FrontendFramework;
|
|
218
|
+
|
|
219
|
+
const skipInstall = hasFlag(args, "skip-install");
|
|
220
|
+
|
|
221
|
+
// Interactive prompt if no framework specified
|
|
222
|
+
if (!framework && isInteractive()) {
|
|
223
|
+
framework = await select<FrontendFramework>(
|
|
224
|
+
"Select a frontend framework:",
|
|
225
|
+
getFrontendOptions(),
|
|
226
|
+
{ default: "react" },
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
framework = framework || "react";
|
|
231
|
+
|
|
232
|
+
// Check if client already exists
|
|
233
|
+
if (await clientDirExists(projectPath)) {
|
|
234
|
+
cliConsole.warn("client/ directory already exists");
|
|
235
|
+
// In a real implementation, we'd prompt to overwrite
|
|
236
|
+
// For now, we'll throw an error
|
|
237
|
+
throw new CLIError(
|
|
238
|
+
"client/ directory already exists. Please remove it first or use a different project.",
|
|
239
|
+
CLIErrorType.FILE_EXISTS,
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Get frontend template
|
|
244
|
+
const frontendTemplate = getFrontendTemplate(framework);
|
|
245
|
+
|
|
246
|
+
// Display info
|
|
247
|
+
cliConsole.header(`Adding ${colors.cyan(framework)} frontend to project`);
|
|
248
|
+
|
|
249
|
+
const rows = [
|
|
250
|
+
["Framework", framework],
|
|
251
|
+
["Frontend Directory", "client/"],
|
|
252
|
+
["Include Tailwind CSS", "Yes"],
|
|
253
|
+
["Bundler", "Bun (native)"],
|
|
254
|
+
["Install dependencies", skipInstall ? colors.red("No") : colors.green("Yes")],
|
|
255
|
+
];
|
|
256
|
+
|
|
257
|
+
printTable(["Setting", "Value"], rows);
|
|
258
|
+
cliConsole.log("");
|
|
259
|
+
|
|
260
|
+
const tasks: TaskOptions[] = [];
|
|
261
|
+
|
|
262
|
+
// Create client directory structure
|
|
263
|
+
tasks.push({
|
|
264
|
+
text: "Creating client directory structure",
|
|
265
|
+
task: async () => {
|
|
266
|
+
await createDirectory(joinPaths(projectPath, "client", "src", "components"));
|
|
267
|
+
await createDirectory(joinPaths(projectPath, "client", "src", "styles"));
|
|
268
|
+
await createDirectory(joinPaths(projectPath, "client", "public"));
|
|
269
|
+
|
|
270
|
+
// Create template-specific directories
|
|
271
|
+
for (const dir of frontendTemplate.directories) {
|
|
272
|
+
// Strip 'client/' prefix if present in directory path
|
|
273
|
+
const dirPath = dir.startsWith("client/") ? dir.slice(7) : dir;
|
|
274
|
+
await createDirectory(joinPaths(projectPath, "client", dirPath));
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
// Create client files
|
|
280
|
+
for (const file of frontendTemplate.files) {
|
|
281
|
+
tasks.push({
|
|
282
|
+
text: `Creating ${file.path}`,
|
|
283
|
+
task: async () => {
|
|
284
|
+
// Strip 'client/' prefix if present in file path
|
|
285
|
+
const filePath = file.path.startsWith("client/")
|
|
286
|
+
? file.path.slice(7)
|
|
287
|
+
: file.path;
|
|
288
|
+
await writeFile(joinPaths(projectPath, "client", filePath), file.content);
|
|
289
|
+
},
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Create Bun bundler config
|
|
294
|
+
tasks.push({
|
|
295
|
+
text: "Creating Bun bundler configuration",
|
|
296
|
+
task: async () => {
|
|
297
|
+
const bundlerConfig = getBunBundlerConfig(framework);
|
|
298
|
+
await writeFile(joinPaths(projectPath, "client", "bun.bundler.ts"), bundlerConfig);
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// Create Tailwind config
|
|
303
|
+
tasks.push({
|
|
304
|
+
text: "Creating Tailwind CSS configuration",
|
|
305
|
+
task: async () => {
|
|
306
|
+
const tailwindConfig = getTailwindConfig();
|
|
307
|
+
await writeFile(joinPaths(projectPath, "client", "tailwind.config.ts"), tailwindConfig);
|
|
308
|
+
},
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
// Create PostCSS config
|
|
312
|
+
tasks.push({
|
|
313
|
+
text: "Creating PostCSS configuration",
|
|
314
|
+
task: async () => {
|
|
315
|
+
const postCSSConfig = getPostCSSConfig();
|
|
316
|
+
await writeFile(joinPaths(projectPath, "client", "postcss.config.js"), postCSSConfig);
|
|
317
|
+
},
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// Create TypeScript config for client
|
|
321
|
+
tasks.push({
|
|
322
|
+
text: "Creating client TypeScript configuration",
|
|
323
|
+
task: async () => {
|
|
324
|
+
const tsConfig = JSON.stringify(
|
|
325
|
+
{
|
|
326
|
+
extends: "../tsconfig.json",
|
|
327
|
+
compilerOptions: {
|
|
328
|
+
jsx: framework === "solid" ? "preserve" : "react-jsx",
|
|
329
|
+
jsxImportSource: framework === "solid" ? "solid-js" : "react",
|
|
330
|
+
},
|
|
331
|
+
include: ["src/**/*"],
|
|
332
|
+
},
|
|
333
|
+
null,
|
|
334
|
+
2,
|
|
335
|
+
);
|
|
336
|
+
await writeFile(joinPaths(projectPath, "client", "tsconfig.json"), tsConfig);
|
|
337
|
+
},
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// Update package.json with frontend deps and scripts
|
|
341
|
+
tasks.push({
|
|
342
|
+
text: "Updating package.json with frontend dependencies and scripts",
|
|
343
|
+
task: async () => {
|
|
344
|
+
const newDeps = frontendTemplate.dependencies || {};
|
|
345
|
+
const newDevDeps = {
|
|
346
|
+
...frontendTemplate.devDependencies,
|
|
347
|
+
concurrently: "^8.2.0", // Add concurrently for running server + client
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
const entryFile = framework === "react" || framework === "solid" ? ".tsx" : ".ts";
|
|
351
|
+
const newScripts = {
|
|
352
|
+
"dev:server": "bun run --watch server/main.ts",
|
|
353
|
+
"dev:client": `bun build client/src/main${entryFile} --watch --outdir ./dist/client 2>&1 | grep -v "invalid @ rule"`,
|
|
354
|
+
"dev": "concurrently 'bun run dev:server' 'bun run dev:client'",
|
|
355
|
+
"build:client": `bun build client/src/main${entryFile} --outdir ./dist/client --minify 2>&1 | grep -v "invalid @ rule"`,
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
await mergePackageJson(projectPath, newDeps, newDevDeps, newScripts);
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
// Run all tasks
|
|
363
|
+
await runTasks(tasks);
|
|
364
|
+
|
|
365
|
+
// Install dependencies
|
|
366
|
+
if (!skipInstall) {
|
|
367
|
+
cliConsole.subheader("Installing dependencies...");
|
|
368
|
+
const installSpinner = spinner("Running bun install...");
|
|
369
|
+
|
|
370
|
+
try {
|
|
371
|
+
const proc = Bun.spawn(["bun", "install"], {
|
|
372
|
+
cwd: projectPath,
|
|
373
|
+
stdout: "pipe",
|
|
374
|
+
stderr: "pipe",
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
const exitCode = await proc.exited;
|
|
378
|
+
|
|
379
|
+
if (exitCode === 0) {
|
|
380
|
+
installSpinner.success("Dependencies installed");
|
|
381
|
+
} else {
|
|
382
|
+
installSpinner.warn("Failed to install dependencies. Run `bun install` manually.");
|
|
383
|
+
}
|
|
384
|
+
} catch {
|
|
385
|
+
installSpinner.warn("Failed to install dependencies. Run `bun install` manually.");
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Success message
|
|
390
|
+
cliConsole.log("");
|
|
391
|
+
const frameworkName = framework.charAt(0).toUpperCase() + framework.slice(1);
|
|
392
|
+
cliConsole.success(`${colors.cyan(frameworkName)} frontend added successfully!`);
|
|
393
|
+
cliConsole.log("");
|
|
394
|
+
cliConsole.log("Next steps:");
|
|
395
|
+
cliConsole.log(" Terminal 1: bun run dev:server");
|
|
396
|
+
cliConsole.log(" Terminal 2: bun run dev:client");
|
|
397
|
+
cliConsole.log("");
|
|
398
|
+
cliConsole.log(" Or run both together:");
|
|
399
|
+
cliConsole.log(" bun run dev");
|
|
400
|
+
cliConsole.log("");
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// Register the command
|
|
404
|
+
defineCommand(
|
|
405
|
+
{
|
|
406
|
+
name: "add:frontend",
|
|
407
|
+
description: "Add a frontend framework to your Bueno project",
|
|
408
|
+
positionals: [
|
|
409
|
+
{
|
|
410
|
+
name: "framework",
|
|
411
|
+
required: false,
|
|
412
|
+
description: "Frontend framework (react, vue, svelte, solid)",
|
|
413
|
+
},
|
|
414
|
+
],
|
|
415
|
+
options: [
|
|
416
|
+
{
|
|
417
|
+
name: "framework",
|
|
418
|
+
alias: "f",
|
|
419
|
+
type: "string",
|
|
420
|
+
description: "Frontend framework (react, vue, svelte, solid)",
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
name: "skip-install",
|
|
424
|
+
type: "boolean",
|
|
425
|
+
default: false,
|
|
426
|
+
description: "Skip dependency installation",
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
name: "project-path",
|
|
430
|
+
type: "string",
|
|
431
|
+
description: "Path to the Bueno project (internal use)",
|
|
432
|
+
},
|
|
433
|
+
],
|
|
434
|
+
examples: [
|
|
435
|
+
"bueno add:frontend",
|
|
436
|
+
"bueno add:frontend react",
|
|
437
|
+
"bueno add:frontend vue",
|
|
438
|
+
"bueno add:frontend svelte",
|
|
439
|
+
"bueno add:frontend solid",
|
|
440
|
+
"bueno add:frontend react --skip-install",
|
|
441
|
+
],
|
|
442
|
+
},
|
|
443
|
+
handleAddFrontend,
|
|
444
|
+
);
|
package/src/cli/commands/new.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getOption,
|
|
10
10
|
getOptionValues,
|
|
11
11
|
hasFlag,
|
|
12
|
+
parseArgs,
|
|
12
13
|
} from "../core/args";
|
|
13
14
|
import { cliConsole, colors, printTable } from "../core/console";
|
|
14
15
|
import { isInteractive, prompt, select } from "../core/prompt";
|
|
@@ -709,6 +710,28 @@ async function handleNew(args: ParsedArgs): Promise<void> {
|
|
|
709
710
|
}
|
|
710
711
|
}
|
|
711
712
|
|
|
713
|
+
// Stage 2: For fullstack template, add frontend
|
|
714
|
+
if (template === "fullstack") {
|
|
715
|
+
cliConsole.subheader("Adding frontend framework...");
|
|
716
|
+
|
|
717
|
+
try {
|
|
718
|
+
const { registry } = await import("./index");
|
|
719
|
+
const args = parseArgs([
|
|
720
|
+
"add:frontend",
|
|
721
|
+
framework,
|
|
722
|
+
skipInstall ? "--skip-install" : null,
|
|
723
|
+
`--project-path=${projectPath}`,
|
|
724
|
+
].filter(Boolean) as string[]);
|
|
725
|
+
|
|
726
|
+
await registry.execute("add:frontend", args);
|
|
727
|
+
} catch (error) {
|
|
728
|
+
cliConsole.error(
|
|
729
|
+
`Failed to add frontend: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
730
|
+
);
|
|
731
|
+
cliConsole.warn("You can manually run: bueno add:frontend " + framework);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
|
|
712
735
|
// Git initialization - now disabled by default (removed)
|
|
713
736
|
// Users can run `git init` manually if needed
|
|
714
737
|
|
package/src/cli/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { cliConsole, colors, setColorEnabled } from "./core/console";
|
|
|
18
18
|
|
|
19
19
|
// Import commands to register them
|
|
20
20
|
import "./commands/new";
|
|
21
|
+
import "./commands/add-frontend";
|
|
21
22
|
import "./commands/generate";
|
|
22
23
|
import "./commands/migration";
|
|
23
24
|
import "./commands/dev";
|
|
@@ -31,7 +31,7 @@ export class AppController {
|
|
|
31
31
|
return Response.json({ message: 'Welcome to Bueno API!', version: '1.0.0' });
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
@Get('health')
|
|
34
|
+
@Get('/health')
|
|
35
35
|
health(ctx: Context) {
|
|
36
36
|
return Response.json({ status: 'ok', timestamp: new Date().toISOString() });
|
|
37
37
|
}
|
|
@@ -68,7 +68,7 @@ export class AppController {
|
|
|
68
68
|
</ul>
|
|
69
69
|
|
|
70
70
|
<h2>Documentation</h2>
|
|
71
|
-
<p>Visit <a href="https://
|
|
71
|
+
<p>Visit <a href="https://bueno.github.io">https://bueno.github.io</a> for full documentation.</p>
|
|
72
72
|
|
|
73
73
|
<h2>Quick Example</h2>
|
|
74
74
|
<pre><code>@Controller('/api')
|
|
@@ -1,111 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Fullstack Project Template
|
|
3
|
+
*
|
|
4
|
+
* Two-stage fullstack creation:
|
|
5
|
+
* Stage 1: Creates API template (backend)
|
|
6
|
+
* Stage 2: Runs add:frontend command (frontend)
|
|
7
|
+
*
|
|
8
|
+
* This template is actually just the API template.
|
|
9
|
+
* The frontend is added via the add:frontend command,
|
|
10
|
+
* making fullstack setup transparent and reusable.
|
|
3
11
|
*/
|
|
4
12
|
|
|
5
|
-
import {
|
|
6
|
-
import { reactTemplate } from "../frontend/react";
|
|
7
|
-
import { solidTemplate } from "../frontend/solid";
|
|
8
|
-
import { svelteTemplate } from "../frontend/svelte";
|
|
9
|
-
import { vueTemplate } from "../frontend/vue";
|
|
13
|
+
import { apiTemplate } from "./api";
|
|
10
14
|
import type { ProjectConfig, ProjectTemplateResult } from "./types";
|
|
11
15
|
|
|
12
|
-
export function fullstackTemplate(
|
|
13
|
-
|
|
14
|
-
)
|
|
15
|
-
//
|
|
16
|
-
|
|
17
|
-
react: reactTemplate,
|
|
18
|
-
vue: vueTemplate,
|
|
19
|
-
svelte: svelteTemplate,
|
|
20
|
-
solid: solidTemplate,
|
|
21
|
-
none: noneTemplate,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const frontendTemplate = frontendTemplates[config.framework]
|
|
25
|
-
? frontendTemplates[config.framework]()
|
|
26
|
-
: reactTemplate();
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
files: [
|
|
30
|
-
{
|
|
31
|
-
path: "server/main.ts",
|
|
32
|
-
content: `import { createApp, Module, Controller, Get, Post, Injectable } from '@buenojs/bueno';
|
|
33
|
-
import type { Context } from '@buenojs/bueno';
|
|
34
|
-
|
|
35
|
-
// Services
|
|
36
|
-
@Injectable()
|
|
37
|
-
export class AppService {
|
|
38
|
-
findAll() {
|
|
39
|
-
return { message: 'Welcome to Bueno!', items: [] };
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Controllers
|
|
44
|
-
@Controller('/api')
|
|
45
|
-
export class AppController {
|
|
46
|
-
constructor(private readonly appService: AppService) {}
|
|
47
|
-
|
|
48
|
-
@Get()
|
|
49
|
-
hello() {
|
|
50
|
-
return { message: 'Welcome to Bueno API!', version: '1.0.0' };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@Get('health')
|
|
54
|
-
health(ctx: Context) {
|
|
55
|
-
return { status: 'ok', timestamp: new Date().toISOString() };
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Module
|
|
60
|
-
@Module({
|
|
61
|
-
controllers: [AppController],
|
|
62
|
-
providers: [AppService],
|
|
63
|
-
})
|
|
64
|
-
export class AppModule {}
|
|
65
|
-
|
|
66
|
-
// Bootstrap
|
|
67
|
-
const app = createApp(AppModule);
|
|
68
|
-
|
|
69
|
-
// Serve static files in production
|
|
70
|
-
// app.serveStatic('./dist/client');
|
|
71
|
-
|
|
72
|
-
await app.listen(3000);
|
|
73
|
-
console.log('🚀 Server running at http://localhost:3000');
|
|
74
|
-
`,
|
|
75
|
-
},
|
|
76
|
-
// Include frontend files
|
|
77
|
-
...frontendTemplate.files,
|
|
78
|
-
],
|
|
79
|
-
directories: [
|
|
80
|
-
"server/modules/app",
|
|
81
|
-
"server/common/middleware",
|
|
82
|
-
"server/common/guards",
|
|
83
|
-
"server/common/interceptors",
|
|
84
|
-
"server/common/pipes",
|
|
85
|
-
"server/common/filters",
|
|
86
|
-
"server/database/migrations",
|
|
87
|
-
"server/config",
|
|
88
|
-
"tests/unit",
|
|
89
|
-
"tests/integration",
|
|
90
|
-
// Include frontend directories
|
|
91
|
-
...frontendTemplate.directories,
|
|
92
|
-
],
|
|
93
|
-
dependencies: {
|
|
94
|
-
zod: "^3.24.0",
|
|
95
|
-
// Include frontend dependencies
|
|
96
|
-
...frontendTemplate.dependencies,
|
|
97
|
-
},
|
|
98
|
-
devDependencies: {
|
|
99
|
-
// Include frontend dev dependencies
|
|
100
|
-
...frontendTemplate.devDependencies,
|
|
101
|
-
},
|
|
102
|
-
scripts: {
|
|
103
|
-
dev: "bun run --watch server/main.ts",
|
|
104
|
-
build: "bun build ./server/main.ts --outdir ./dist --target bun",
|
|
105
|
-
start: "bun run dist/main.js",
|
|
106
|
-
test: "bun test",
|
|
107
|
-
// Include frontend scripts
|
|
108
|
-
...frontendTemplate.scripts,
|
|
109
|
-
},
|
|
110
|
-
};
|
|
16
|
+
export function fullstackTemplate(config: ProjectConfig): ProjectTemplateResult {
|
|
17
|
+
// Stage 1: Return API template
|
|
18
|
+
// Stage 2 will be handled by handleNew() in new.ts
|
|
19
|
+
// which will automatically call add:frontend with the selected framework
|
|
20
|
+
return apiTemplate(config);
|
|
111
21
|
}
|