alepha 0.20.1 → 0.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/assets/swagger-ui/swagger-ui-bundle.js +1 -1
- package/assets/swagger-ui/swagger-ui.css +1 -1
- package/dist/api/audits/index.browser.js +49 -0
- package/dist/api/audits/index.browser.js.map +1 -1
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +49 -0
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +2 -1
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.browser.js +64 -148
- package/dist/api/jobs/index.browser.js.map +1 -1
- package/dist/api/jobs/index.d.ts +339 -600
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +605 -1012
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/keys/index.js.map +1 -1
- package/dist/api/notifications/index.d.ts +79 -27
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +90 -23
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/organizations/index.d.ts.map +1 -1
- package/dist/api/parameters/index.browser.js +37 -0
- package/dist/api/parameters/index.browser.js.map +1 -1
- package/dist/api/parameters/index.d.ts +4 -65
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +37 -0
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/payments/index.d.ts +2 -1
- package/dist/api/payments/index.d.ts.map +1 -1
- package/dist/api/payments/index.js +4 -2
- package/dist/api/payments/index.js.map +1 -1
- package/dist/api/users/index.d.ts +225 -5199
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +15 -11
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +4 -2
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/bucket/index.js +5 -1
- package/dist/bucket/index.js.map +1 -1
- package/dist/bucket/index.workerd.js +5 -1
- package/dist/bucket/index.workerd.js.map +1 -1
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cache/core/index.workerd.js.map +1 -1
- package/dist/captcha/index.js.map +1 -1
- package/dist/cli/core/index.d.ts +225 -11681
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +732 -257
- package/dist/cli/core/index.js.map +1 -1
- package/dist/cli/devtools/index.js +7 -1
- package/dist/cli/devtools/index.js.map +1 -1
- package/dist/cli/platform/index.d.ts +65 -63
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +140 -27
- package/dist/cli/platform/index.js.map +1 -1
- package/dist/cli/vendor/index.js +15 -0
- package/dist/cli/vendor/index.js.map +1 -1
- package/dist/command/index.d.ts +1 -1
- package/dist/command/index.js +1 -1
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +6 -0
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +8 -8
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +6 -0
- package/dist/core/index.native.js.map +1 -1
- package/dist/core/index.workerd.js +6 -0
- package/dist/core/index.workerd.js.map +1 -1
- package/dist/crypto/index.js.map +1 -1
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/core/index.js.map +1 -1
- package/dist/email/smtp/index.js +2 -10522
- package/dist/email/smtp/index.js.map +1 -1
- package/dist/fake/index.d.ts +4 -8085
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +3 -33554
- package/dist/fake/index.js.map +1 -1
- package/dist/lock/core/index.js.map +1 -1
- package/dist/lock/redis/index.js.map +1 -1
- package/dist/logger/index.js +32 -1
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.js +5 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/core/index.browser.js +1 -361
- package/dist/orm/core/index.browser.js.map +1 -1
- package/dist/orm/core/index.bun.js +14 -406
- package/dist/orm/core/index.bun.js.map +1 -1
- package/dist/orm/core/index.d.ts +96 -5117
- package/dist/orm/core/index.d.ts.map +1 -1
- package/dist/orm/core/index.js +23 -419
- package/dist/orm/core/index.js.map +1 -1
- package/dist/orm/postgres/index.bun.js +17 -20
- package/dist/orm/postgres/index.bun.js.map +1 -1
- package/dist/orm/postgres/index.d.ts +2 -613
- package/dist/orm/postgres/index.d.ts.map +1 -1
- package/dist/orm/postgres/index.js +17 -20
- package/dist/orm/postgres/index.js.map +1 -1
- package/dist/react/core/index.js.map +1 -1
- package/dist/react/form/index.d.ts +60 -1
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/form/index.js +86 -1
- package/dist/react/form/index.js.map +1 -1
- package/dist/react/head/index.browser.js +16 -1
- package/dist/react/head/index.browser.js.map +1 -1
- package/dist/react/head/index.d.ts +6 -0
- package/dist/react/head/index.d.ts.map +1 -1
- package/dist/react/head/index.js +16 -1
- package/dist/react/head/index.js.map +1 -1
- package/dist/react/i18n/index.js.map +1 -1
- package/dist/react/intro/index.js +22 -17
- package/dist/react/intro/index.js.map +1 -1
- package/dist/react/router/index.browser.js +78 -12
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +57 -13
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +102 -14
- package/dist/react/router/index.js.map +1 -1
- package/dist/react/testing/index.d.ts +1 -411
- package/dist/react/testing/index.d.ts.map +1 -1
- package/dist/react/testing/index.js +13 -12293
- package/dist/react/testing/index.js.map +1 -1
- package/dist/react/ui/index.d.ts +124 -0
- package/dist/react/ui/index.d.ts.map +1 -0
- package/dist/react/ui/index.js +209 -0
- package/dist/react/ui/index.js.map +1 -0
- package/dist/react/websocket/index.js.map +1 -1
- package/dist/redis/index.js.map +1 -1
- package/dist/router/index.d.ts +13 -13
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +45 -32
- package/dist/router/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +1 -83
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +2 -391
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/index.workerd.js +2 -391
- package/dist/scheduler/index.workerd.js.map +1 -1
- package/dist/security/index.browser.js.map +1 -1
- package/dist/security/index.d.ts +2 -325
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +3 -1362
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +1 -1054
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +16 -1224
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.browser.js.map +1 -1
- package/dist/server/core/index.d.ts +1 -4
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +19 -4
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +1 -514
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +4 -4356
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/static/index.js.map +1 -1
- package/dist/server/swagger/index.js +1 -1
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.js.map +1 -1
- package/dist/system/index.browser.js.map +1 -1
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +1 -0
- package/dist/system/index.js.map +1 -1
- package/dist/system/index.workerd.js.map +1 -1
- package/dist/topic/core/index.js +1 -1
- package/dist/topic/core/index.js.map +1 -1
- package/dist/websocket/index.browser.js +21 -0
- package/dist/websocket/index.browser.js.map +1 -1
- package/dist/websocket/index.js +21 -0
- package/dist/websocket/index.js.map +1 -1
- package/package.json +23 -37
- package/src/api/files/__tests__/FileController.spec.ts +1 -1
- package/src/api/files/jobs/FileJobs.ts +2 -1
- package/src/api/jobs/__tests__/$job.spec.ts +320 -2867
- package/src/api/jobs/controllers/AdminJobController.ts +29 -138
- package/src/api/jobs/entities/jobExecutionEntity.ts +27 -19
- package/src/api/jobs/index.browser.ts +5 -7
- package/src/api/jobs/index.ts +23 -51
- package/src/api/jobs/primitives/$job.ts +66 -58
- package/src/api/jobs/providers/JobProvider.ts +561 -566
- package/src/api/jobs/providers/JobQueueProvider.ts +18 -19
- package/src/api/jobs/schemas/jobConfigAtom.ts +20 -23
- package/src/api/jobs/schemas/jobExecutionQuerySchema.ts +3 -27
- package/src/api/jobs/schemas/jobExecutionResourceSchema.ts +5 -7
- package/src/api/jobs/schemas/jobRegistrationSchema.ts +7 -4
- package/src/api/jobs/schemas/triggerJobSchema.ts +0 -1
- package/src/api/jobs/services/JobService.ts +90 -483
- package/src/api/notifications/controllers/AdminNotificationController.ts +19 -12
- package/src/api/notifications/index.ts +7 -4
- package/src/api/notifications/jobs/NotificationJobs.ts +83 -12
- package/src/api/payments/services/PaymentService.ts +4 -2
- package/src/api/users/__tests__/UserJobs.spec.ts +10 -49
- package/src/api/users/audits/UserAudits.ts +3 -1
- package/src/api/users/buckets/UserBuckets.ts +2 -1
- package/src/api/users/index.ts +1 -4
- package/src/api/users/jobs/UserJobs.ts +5 -4
- package/src/api/users/schemas/userQuerySchema.ts +0 -1
- package/src/api/users/services/UserService.ts +1 -5
- package/src/api/verifications/__tests__/CodeVerification.spec.ts +14 -0
- package/src/api/verifications/__tests__/LinkVerification.spec.ts +14 -0
- package/src/api/verifications/jobs/VerificationJobs.ts +2 -1
- package/src/api/verifications/services/VerificationService.ts +1 -0
- package/src/cli/core/__tests__/init.spec.ts +209 -1
- package/src/cli/core/commands/init.ts +9 -9
- package/src/cli/core/services/PackageManagerUtils.ts +22 -12
- package/src/cli/core/services/ProjectScaffolder.ts +300 -70
- package/src/cli/core/tasks/BuildDockerTask.ts +9 -10
- package/src/cli/core/tasks/BuildServerTask.ts +8 -0
- package/src/cli/core/templates/agentMd.ts +2 -8
- package/src/cli/core/templates/apiIndexTs.ts +22 -14
- package/src/cli/core/templates/componentsJsonTs.ts +39 -0
- package/src/cli/core/templates/mainCss.ts +2 -36
- package/src/cli/core/templates/saasAdminLayoutTsx.ts +77 -0
- package/src/cli/core/templates/saasAdminPagesTsx.ts +26 -0
- package/src/cli/core/templates/saasAuthLayoutTsx.ts +20 -0
- package/src/cli/core/templates/saasAuthPagesTsx.ts +62 -0
- package/src/cli/core/templates/saasRealmProviderTs.ts +46 -0
- package/src/cli/core/templates/vitestConfigTs.ts +17 -0
- package/src/cli/core/templates/webAppRouterTs.ts +102 -82
- package/src/cli/core/templates/webIndexTs.ts +23 -1
- package/src/cli/platform/__tests__/CloudflareAdapter.spec.ts +22 -71
- package/src/cli/platform/__tests__/SecretsCommand.spec.ts +2 -0
- package/src/cli/platform/adapters/CloudflareAdapter.ts +12 -11
- package/src/cli/platform/atoms/platformOptions.ts +9 -0
- package/src/cli/platform/schemas/cloudflare.ts +3 -2
- package/src/cli/platform/services/CloudflareApi.ts +164 -25
- package/src/cli/platform/services/WranglerApi.ts +0 -17
- package/src/command/providers/CliProvider.ts +1 -1
- package/src/core/Alepha.ts +9 -0
- package/src/core/interfaces/Service.ts +3 -1
- package/src/core/providers/TypeProvider.ts +1 -1
- package/src/logger/services/Logger.ts +1 -1
- package/src/mcp/__tests__/$resource.spec.ts +1 -1
- package/src/mcp/__tests__/$tool.spec.ts +1 -1
- package/src/mcp/__tests__/McpServerProvider.spec.ts +1 -1
- package/src/orm/__tests__/$repository-tests.ts +1 -0
- package/src/orm/__tests__/orm-next-tests.ts +2 -67
- package/src/orm/__tests__/orm-next.spec.ts +0 -21
- package/src/orm/core/index.shared.ts +0 -2
- package/src/orm/core/index.ts +1 -2
- package/src/orm/core/primitives/$repository.ts +3 -6
- package/src/orm/core/providers/drivers/DatabaseProvider.ts +0 -5
- package/src/orm/core/providers/drivers/NodeSqliteProvider.ts +11 -13
- package/src/orm/core/services/ModelBuilder.ts +1 -13
- package/src/orm/core/services/Repository.ts +1 -42
- package/src/orm/core/services/SqliteModelBuilder.ts +2 -33
- package/src/orm/postgres/services/PostgresModelBuilder.ts +10 -45
- package/src/react/form/index.ts +2 -0
- package/src/react/form/services/parseField.ts +163 -0
- package/src/react/form/services/prettyName.ts +19 -0
- package/src/react/head/providers/BrowserHeadProvider.ts +31 -10
- package/src/react/intro/components/GettingStartedAuthSlide.tsx +11 -4
- package/src/react/router/__tests__/ReactBrowserProvider.browser.spec.ts +213 -2
- package/src/react/router/primitives/$page.ts +35 -12
- package/src/react/router/providers/ReactBrowserProvider.ts +73 -0
- package/src/react/router/providers/ReactBrowserRouterProvider.ts +1 -1
- package/src/react/router/providers/ReactPreloadProvider.ts +1 -1
- package/src/react/router/providers/ReactServerProvider.ts +1 -0
- package/src/react/ui/atoms/uiAtom.ts +28 -0
- package/src/react/ui/components/ColorScheme.tsx +36 -0
- package/src/react/ui/hooks/useColorMode.ts +49 -0
- package/src/react/ui/hooks/useSidebarState.ts +26 -0
- package/src/react/ui/hooks/useTheme.ts +22 -0
- package/src/react/ui/index.ts +35 -0
- package/src/react/ui/services/UiPersistence.ts +41 -0
- package/src/router/TemplatedPathParser.ts +50 -51
- package/src/router/__tests__/RouterProvider.spec.ts +62 -0
- package/src/router/__tests__/TemplatedPathParser.spec.ts +18 -0
- package/src/router/providers/RouterProvider.ts +10 -5
- package/src/scheduler/providers/CronProvider.ts +1 -1
- package/src/security/primitives/$basicAuth.ts +1 -1
- package/src/server/auth/providers/ServerAuthProvider.ts +5 -1
- package/src/server/core/interfaces/ServerRequest.ts +1 -0
- package/src/server/core/providers/ServerProvider.ts +1 -1
- package/src/server/core/providers/ServerRouterProvider.ts +2 -2
- package/src/server/core/services/HttpClient.ts +1 -1
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +1 -1
- package/src/system/providers/NodeShellProvider.ts +1 -0
- package/src/topic/core/providers/TopicProvider.ts +1 -1
- package/dist/api/invitations/index.d.ts +0 -790
- package/dist/api/invitations/index.d.ts.map +0 -1
- package/dist/api/invitations/index.js +0 -662
- package/dist/api/invitations/index.js.map +0 -1
- package/dist/api/issues/index.d.ts +0 -810
- package/dist/api/issues/index.d.ts.map +0 -1
- package/dist/api/issues/index.js +0 -444
- package/dist/api/issues/index.js.map +0 -1
- package/dist/api/subscriptions/index.d.ts +0 -1692
- package/dist/api/subscriptions/index.d.ts.map +0 -1
- package/dist/api/subscriptions/index.js +0 -1867
- package/dist/api/subscriptions/index.js.map +0 -1
- package/dist/api/workflows/index.browser.js +0 -246
- package/dist/api/workflows/index.browser.js.map +0 -1
- package/dist/api/workflows/index.d.ts +0 -1618
- package/dist/api/workflows/index.d.ts.map +0 -1
- package/dist/api/workflows/index.js +0 -1495
- package/dist/api/workflows/index.js.map +0 -1
- package/dist/react/testing/chunk-DBEY4PJZ.js +0 -16
- package/src/api/invitations/__tests__/InvitationService.spec.ts +0 -439
- package/src/api/invitations/controllers/AdminInvitationController.ts +0 -86
- package/src/api/invitations/controllers/InvitationController.ts +0 -84
- package/src/api/invitations/entities/invitations.ts +0 -33
- package/src/api/invitations/index.ts +0 -58
- package/src/api/invitations/jobs/InvitationJobs.ts +0 -37
- package/src/api/invitations/providers/InvitationProvider.ts +0 -45
- package/src/api/invitations/schemas/createInvitationSchema.ts +0 -12
- package/src/api/invitations/schemas/invitationConfigAtom.ts +0 -20
- package/src/api/invitations/schemas/invitationQuerySchema.ts +0 -15
- package/src/api/invitations/schemas/invitationResourceSchema.ts +0 -6
- package/src/api/invitations/schemas/invitationWithResourceInfoSchema.ts +0 -22
- package/src/api/invitations/schemas/myInvitationsQuerySchema.ts +0 -10
- package/src/api/invitations/services/InvitationService.ts +0 -556
- package/src/api/issues/__tests__/IssueService.spec.ts +0 -263
- package/src/api/issues/controllers/AdminIssueController.ts +0 -149
- package/src/api/issues/controllers/IssueController.ts +0 -44
- package/src/api/issues/entities/issues.ts +0 -49
- package/src/api/issues/index.ts +0 -50
- package/src/api/issues/schemas/createIssueSchema.ts +0 -13
- package/src/api/issues/schemas/issueConfigAtom.ts +0 -13
- package/src/api/issues/schemas/issueQuerySchema.ts +0 -18
- package/src/api/issues/schemas/issueResourceSchema.ts +0 -6
- package/src/api/issues/schemas/myIssueQuerySchema.ts +0 -10
- package/src/api/issues/schemas/updateIssueSchema.ts +0 -13
- package/src/api/issues/services/IssueService.ts +0 -264
- package/src/api/jobs/__tests__/$job-middleware.spec.ts +0 -126
- package/src/api/jobs/__tests__/JobService.spec.ts +0 -31
- package/src/api/jobs/entities/jobExecutionLogEntity.ts +0 -13
- package/src/api/jobs/schemas/jobActivitySchema.ts +0 -15
- package/src/api/jobs/schemas/jobCronInfoSchema.ts +0 -22
- package/src/api/jobs/schemas/jobExecutionDetailResourceSchema.ts +0 -20
- package/src/api/jobs/schemas/jobFailureSchema.ts +0 -9
- package/src/api/jobs/schemas/jobQueueDepthSchema.ts +0 -14
- package/src/api/jobs/schemas/jobStatsSchema.ts +0 -14
- package/src/api/jobs/services/JobService-tests.ts +0 -157
- package/src/api/subscriptions/__tests__/BillingService.spec.ts +0 -218
- package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +0 -278
- package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +0 -212
- package/src/api/subscriptions/controllers/SubscriptionController.ts +0 -189
- package/src/api/subscriptions/entities/subscriptionEvents.ts +0 -54
- package/src/api/subscriptions/entities/subscriptions.ts +0 -68
- package/src/api/subscriptions/index.ts +0 -133
- package/src/api/subscriptions/jobs/SubscriptionJobs.ts +0 -382
- package/src/api/subscriptions/middleware/$requireLimit.ts +0 -50
- package/src/api/subscriptions/middleware/$requirePlan.ts +0 -49
- package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +0 -110
- package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +0 -8
- package/src/api/subscriptions/schemas/changePlanSchema.ts +0 -9
- package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +0 -11
- package/src/api/subscriptions/schemas/entitlementsSchema.ts +0 -21
- package/src/api/subscriptions/schemas/mrrSchema.ts +0 -13
- package/src/api/subscriptions/schemas/planDefinitionSchema.ts +0 -71
- package/src/api/subscriptions/schemas/planResourceSchema.ts +0 -25
- package/src/api/subscriptions/schemas/subscriptionEventResourceSchema.ts +0 -8
- package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +0 -19
- package/src/api/subscriptions/schemas/subscriptionResourceSchema.ts +0 -6
- package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +0 -32
- package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +0 -23
- package/src/api/subscriptions/services/BillingService.ts +0 -437
- package/src/api/subscriptions/services/SubscriptionConfig.ts +0 -56
- package/src/api/subscriptions/services/SubscriptionService.ts +0 -867
- package/src/api/subscriptions/services/UsageService.ts +0 -118
- package/src/api/workflows/__tests__/$workflow.spec.ts +0 -616
- package/src/api/workflows/controllers/AdminWorkflowController.ts +0 -191
- package/src/api/workflows/entities/workflowExecutions.ts +0 -74
- package/src/api/workflows/entities/workflowStepExecutions.ts +0 -74
- package/src/api/workflows/entities/workflowStepLogs.ts +0 -13
- package/src/api/workflows/index.browser.ts +0 -22
- package/src/api/workflows/index.ts +0 -115
- package/src/api/workflows/jobs/WorkflowJobs.ts +0 -77
- package/src/api/workflows/primitives/$workflow.ts +0 -202
- package/src/api/workflows/providers/WorkflowProvider.ts +0 -1284
- package/src/api/workflows/schemas/workflowActivitySchema.ts +0 -15
- package/src/api/workflows/schemas/workflowConfigAtom.ts +0 -51
- package/src/api/workflows/schemas/workflowExecutionDetailSchema.ts +0 -18
- package/src/api/workflows/schemas/workflowExecutionQuerySchema.ts +0 -26
- package/src/api/workflows/schemas/workflowExecutionResourceSchema.ts +0 -30
- package/src/api/workflows/schemas/workflowRegistrationSchema.ts +0 -26
- package/src/api/workflows/schemas/workflowStatsSchema.ts +0 -16
- package/src/api/workflows/schemas/workflowStepExecutionResourceSchema.ts +0 -15
- package/src/api/workflows/services/WorkflowService.ts +0 -382
- package/src/cli/core/templates/apiAppSecurityTs.ts +0 -43
- package/src/cli/core/templates/webAdminDashboardTsx.ts +0 -17
- package/src/orm/core/__tests__/parseQueryString.spec.ts +0 -196
- package/src/orm/core/helpers/parseQueryString.ts +0 -502
- package/src/orm/core/primitives/$view.ts +0 -88
|
@@ -2,14 +2,14 @@ import { basename, dirname } from "node:path";
|
|
|
2
2
|
import { $inject, AlephaError } from "alepha";
|
|
3
3
|
import type { RunnerMethod } from "alepha/command";
|
|
4
4
|
import { $logger, ConsoleColorProvider } from "alepha/logger";
|
|
5
|
-
import { FileSystemProvider } from "alepha/system";
|
|
5
|
+
import { FileSystemProvider, ShellProvider } from "alepha/system";
|
|
6
6
|
import { type AgentMdOptions, agentMd } from "../templates/agentMd.ts";
|
|
7
7
|
import { alephaConfigTs } from "../templates/alephaConfigTs.ts";
|
|
8
|
-
import { apiAppSecurityTs } from "../templates/apiAppSecurityTs.ts";
|
|
9
8
|
import { apiHelloControllerTs } from "../templates/apiHelloControllerTs.ts";
|
|
10
9
|
import { apiHelloResponseSchemaTs } from "../templates/apiHelloResponseSchemaTs.ts";
|
|
11
10
|
import { apiIndexTs } from "../templates/apiIndexTs.ts";
|
|
12
11
|
import { biomeJson } from "../templates/biomeJson.ts";
|
|
12
|
+
import { componentsJsonTs } from "../templates/componentsJsonTs.ts";
|
|
13
13
|
import { dummySpecTs } from "../templates/dummySpecTs.ts";
|
|
14
14
|
import { editorconfig } from "../templates/editorconfig.ts";
|
|
15
15
|
import { gitignore } from "../templates/gitignore.ts";
|
|
@@ -17,9 +17,22 @@ import { logoSvg } from "../templates/logoSvg.ts";
|
|
|
17
17
|
import { mainBrowserTs } from "../templates/mainBrowserTs.ts";
|
|
18
18
|
import { mainCss } from "../templates/mainCss.ts";
|
|
19
19
|
import { mainServerTs } from "../templates/mainServerTs.ts";
|
|
20
|
+
import { saasAdminLayoutTsx } from "../templates/saasAdminLayoutTsx.ts";
|
|
21
|
+
import {
|
|
22
|
+
saasAdminSessionsTsx,
|
|
23
|
+
saasAdminUsersTsx,
|
|
24
|
+
} from "../templates/saasAdminPagesTsx.ts";
|
|
25
|
+
import { saasAuthLayoutTsx } from "../templates/saasAuthLayoutTsx.ts";
|
|
26
|
+
import {
|
|
27
|
+
saasAuthLoginTsx,
|
|
28
|
+
saasAuthRegisterTsx,
|
|
29
|
+
saasAuthResetPasswordTsx,
|
|
30
|
+
saasAuthVerifyEmailTsx,
|
|
31
|
+
} from "../templates/saasAuthPagesTsx.ts";
|
|
32
|
+
import { saasRealmProviderTs } from "../templates/saasRealmProviderTs.ts";
|
|
20
33
|
import { tsconfigJson } from "../templates/tsconfigJson.ts";
|
|
21
34
|
import { viteConfigTs } from "../templates/viteConfigTs.ts";
|
|
22
|
-
import {
|
|
35
|
+
import { vitestConfigTs } from "../templates/vitestConfigTs.ts";
|
|
23
36
|
import { webAppRouterTs } from "../templates/webAppRouterTs.ts";
|
|
24
37
|
import { webHomeComponentTsx } from "../templates/webHomeComponentTsx.ts";
|
|
25
38
|
import { webIndexTs } from "../templates/webIndexTs.ts";
|
|
@@ -42,6 +55,7 @@ export class ProjectScaffolder {
|
|
|
42
55
|
protected readonly log = $logger();
|
|
43
56
|
protected readonly colors = $inject(ConsoleColorProvider);
|
|
44
57
|
protected readonly fs = $inject(FileSystemProvider);
|
|
58
|
+
protected readonly shell = $inject(ShellProvider);
|
|
45
59
|
protected readonly pm = $inject(PackageManagerUtils);
|
|
46
60
|
protected readonly utils = $inject(AlephaCliUtils);
|
|
47
61
|
|
|
@@ -71,7 +85,13 @@ export class ProjectScaffolder {
|
|
|
71
85
|
*/
|
|
72
86
|
checkWorkspace?: boolean;
|
|
73
87
|
packageJson?: boolean | DependencyModes;
|
|
74
|
-
|
|
88
|
+
/**
|
|
89
|
+
* `true` writes a tsconfig.json if one doesn't already exist (parent
|
|
90
|
+
* dirs included). `"local"` writes one when none exists *in this
|
|
91
|
+
* directory* — used by shadcn since the CLI reads the local
|
|
92
|
+
* tsconfig directly for import-alias detection.
|
|
93
|
+
*/
|
|
94
|
+
tsconfigJson?: boolean | "local";
|
|
75
95
|
biomeJson?: boolean;
|
|
76
96
|
editorconfig?: boolean;
|
|
77
97
|
agentMd?: false | AgentMdOptions;
|
|
@@ -92,7 +112,12 @@ export class ProjectScaffolder {
|
|
|
92
112
|
);
|
|
93
113
|
}
|
|
94
114
|
if (opts.tsconfigJson) {
|
|
95
|
-
tasks.push(
|
|
115
|
+
tasks.push(
|
|
116
|
+
this.ensureTsConfig(root, {
|
|
117
|
+
force,
|
|
118
|
+
localOnly: opts.tsconfigJson === "local",
|
|
119
|
+
}),
|
|
120
|
+
);
|
|
96
121
|
}
|
|
97
122
|
if (opts.biomeJson) {
|
|
98
123
|
tasks.push(this.ensureBiomeConfig(root, { force, checkWorkspace }));
|
|
@@ -113,10 +138,15 @@ export class ProjectScaffolder {
|
|
|
113
138
|
|
|
114
139
|
public async ensureTsConfig(
|
|
115
140
|
root: string,
|
|
116
|
-
opts: { force?: boolean } = {},
|
|
141
|
+
opts: { force?: boolean; localOnly?: boolean } = {},
|
|
117
142
|
): Promise<void> {
|
|
118
|
-
// Check if tsconfig.json exists in current or parent directories
|
|
119
|
-
|
|
143
|
+
// Check if tsconfig.json exists in current or parent directories.
|
|
144
|
+
// `localOnly: true` skips the parent walk — needed when a tool reads the
|
|
145
|
+
// local tsconfig directly (shadcn does this for import-alias detection).
|
|
146
|
+
const exists = opts.localOnly
|
|
147
|
+
? await this.fs.exists(this.fs.join(root, "tsconfig.json"))
|
|
148
|
+
: await this.existsInParents(root, "tsconfig.json");
|
|
149
|
+
if (!opts.force && exists) {
|
|
120
150
|
return;
|
|
121
151
|
}
|
|
122
152
|
await this.fs.writeFile(
|
|
@@ -241,7 +271,7 @@ export class ProjectScaffolder {
|
|
|
241
271
|
*/
|
|
242
272
|
public async ensureApiProject(
|
|
243
273
|
root: string,
|
|
244
|
-
opts: {
|
|
274
|
+
opts: { saas?: boolean; force?: boolean } = {},
|
|
245
275
|
): Promise<void> {
|
|
246
276
|
const appName = this.getAppName(root);
|
|
247
277
|
|
|
@@ -257,7 +287,7 @@ export class ProjectScaffolder {
|
|
|
257
287
|
await this.ensureFile(
|
|
258
288
|
root,
|
|
259
289
|
"src/api/index.ts",
|
|
260
|
-
apiIndexTs({ appName,
|
|
290
|
+
apiIndexTs({ appName, saas: opts.saas }),
|
|
261
291
|
opts.force,
|
|
262
292
|
);
|
|
263
293
|
await this.ensureFile(
|
|
@@ -273,17 +303,39 @@ export class ProjectScaffolder {
|
|
|
273
303
|
opts.force,
|
|
274
304
|
);
|
|
275
305
|
|
|
276
|
-
|
|
277
|
-
|
|
306
|
+
if (opts.saas) {
|
|
307
|
+
await this.fs.mkdir(this.fs.join(root, "src/api/providers"), {
|
|
308
|
+
recursive: true,
|
|
309
|
+
});
|
|
310
|
+
const adminEmail = await this.detectGitEmail();
|
|
278
311
|
await this.ensureFile(
|
|
279
312
|
root,
|
|
280
|
-
"src/api/
|
|
281
|
-
|
|
313
|
+
"src/api/providers/RealmProvider.ts",
|
|
314
|
+
saasRealmProviderTs({ adminEmail }),
|
|
282
315
|
opts.force,
|
|
283
316
|
);
|
|
284
317
|
}
|
|
285
318
|
}
|
|
286
319
|
|
|
320
|
+
/**
|
|
321
|
+
* Best-effort lookup for the developer's git email (used as the seeded
|
|
322
|
+
* `adminEmails` entry in the SaaS realm). Returns undefined if git isn't
|
|
323
|
+
* available or if `user.email` isn't configured — the template falls back
|
|
324
|
+
* to `admin@example.com` in that case.
|
|
325
|
+
*/
|
|
326
|
+
protected async detectGitEmail(): Promise<string | undefined> {
|
|
327
|
+
try {
|
|
328
|
+
const stdout = (await this.shell.run("git config --get user.email", {
|
|
329
|
+
capture: true,
|
|
330
|
+
})) as unknown as string;
|
|
331
|
+
const email = (stdout ?? "").trim();
|
|
332
|
+
if (!email || !email.includes("@")) return undefined;
|
|
333
|
+
return email;
|
|
334
|
+
} catch {
|
|
335
|
+
return undefined;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
287
339
|
// ===========================================
|
|
288
340
|
// Web Project Structure
|
|
289
341
|
// ===========================================
|
|
@@ -300,10 +352,9 @@ export class ProjectScaffolder {
|
|
|
300
352
|
root: string,
|
|
301
353
|
opts: {
|
|
302
354
|
api?: boolean;
|
|
303
|
-
ui?: boolean;
|
|
304
|
-
auth?: boolean;
|
|
305
|
-
admin?: boolean;
|
|
306
355
|
tailwind?: boolean;
|
|
356
|
+
shadcn?: boolean;
|
|
357
|
+
saas?: boolean;
|
|
307
358
|
force?: boolean;
|
|
308
359
|
} = {},
|
|
309
360
|
): Promise<void> {
|
|
@@ -314,6 +365,15 @@ export class ProjectScaffolder {
|
|
|
314
365
|
recursive: true,
|
|
315
366
|
});
|
|
316
367
|
|
|
368
|
+
if (opts.saas) {
|
|
369
|
+
await this.fs.mkdir(this.fs.join(root, "src/web/components/auth"), {
|
|
370
|
+
recursive: true,
|
|
371
|
+
});
|
|
372
|
+
await this.fs.mkdir(this.fs.join(root, "src/web/components/admin"), {
|
|
373
|
+
recursive: true,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
|
|
317
377
|
// public/favicon.svg
|
|
318
378
|
await this.fs.mkdir(this.fs.join(root, "public"), { recursive: true });
|
|
319
379
|
await this.ensureFile(root, "public/favicon.svg", logoSvg, opts.force);
|
|
@@ -322,7 +382,7 @@ export class ProjectScaffolder {
|
|
|
322
382
|
await this.ensureFile(
|
|
323
383
|
root,
|
|
324
384
|
"src/main.css",
|
|
325
|
-
mainCss({
|
|
385
|
+
mainCss({ tailwind: opts.tailwind }),
|
|
326
386
|
opts.force,
|
|
327
387
|
);
|
|
328
388
|
|
|
@@ -331,22 +391,32 @@ export class ProjectScaffolder {
|
|
|
331
391
|
await this.ensureFile(root, "vite.config.ts", viteConfigTs(), opts.force);
|
|
332
392
|
}
|
|
333
393
|
|
|
394
|
+
// shadcn/ui: write components.json before running `shadcn init` — the
|
|
395
|
+
// CLI respects an existing config and skips its interactive prompts,
|
|
396
|
+
// which lets us pin our aliases (`@/web/*`) and the `@alepha` registry.
|
|
397
|
+
// The CLI itself writes the cn() helper, theme tokens, and installs
|
|
398
|
+
// runtime deps (clsx, tailwind-merge, class-variance-authority,
|
|
399
|
+
// lucide-react, tw-animate-css) — see runShadcnInit below.
|
|
400
|
+
if (opts.shadcn) {
|
|
401
|
+
await this.ensureFile(
|
|
402
|
+
root,
|
|
403
|
+
"components.json",
|
|
404
|
+
componentsJsonTs(),
|
|
405
|
+
opts.force,
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
|
|
334
409
|
// Web structure
|
|
335
410
|
await this.ensureFile(
|
|
336
411
|
root,
|
|
337
412
|
"src/web/index.ts",
|
|
338
|
-
webIndexTs({ appName }),
|
|
413
|
+
webIndexTs({ appName, saas: opts.saas }),
|
|
339
414
|
opts.force,
|
|
340
415
|
);
|
|
341
416
|
await this.ensureFile(
|
|
342
417
|
root,
|
|
343
418
|
"src/web/AppRouter.ts",
|
|
344
|
-
webAppRouterTs({
|
|
345
|
-
api: opts.api,
|
|
346
|
-
ui: opts.ui,
|
|
347
|
-
auth: opts.auth,
|
|
348
|
-
admin: opts.admin,
|
|
349
|
-
}),
|
|
419
|
+
webAppRouterTs({ api: opts.api, saas: opts.saas }),
|
|
350
420
|
opts.force,
|
|
351
421
|
);
|
|
352
422
|
await this.ensureFile(
|
|
@@ -355,20 +425,68 @@ export class ProjectScaffolder {
|
|
|
355
425
|
webHomeComponentTsx({ api: opts.api }),
|
|
356
426
|
opts.force,
|
|
357
427
|
);
|
|
358
|
-
if (opts.admin) {
|
|
359
|
-
await this.ensureFile(
|
|
360
|
-
root,
|
|
361
|
-
"src/web/components/AdminDashboard.tsx",
|
|
362
|
-
webAdminDashboardTsx(),
|
|
363
|
-
opts.force,
|
|
364
|
-
);
|
|
365
|
-
}
|
|
366
428
|
await this.ensureFile(
|
|
367
429
|
root,
|
|
368
430
|
"src/main.browser.ts",
|
|
369
431
|
mainBrowserTs(),
|
|
370
432
|
opts.force,
|
|
371
433
|
);
|
|
434
|
+
|
|
435
|
+
if (opts.saas) {
|
|
436
|
+
// Auth — layout + 4 pages, each a thin wrapper around the registry
|
|
437
|
+
// component that `shadcn add @alepha/auth-*` drops at
|
|
438
|
+
// src/web/components/auth-*.tsx.
|
|
439
|
+
await this.ensureFile(
|
|
440
|
+
root,
|
|
441
|
+
"src/web/components/auth/AuthLayout.tsx",
|
|
442
|
+
saasAuthLayoutTsx(),
|
|
443
|
+
opts.force,
|
|
444
|
+
);
|
|
445
|
+
await this.ensureFile(
|
|
446
|
+
root,
|
|
447
|
+
"src/web/components/auth/Login.tsx",
|
|
448
|
+
saasAuthLoginTsx(),
|
|
449
|
+
opts.force,
|
|
450
|
+
);
|
|
451
|
+
await this.ensureFile(
|
|
452
|
+
root,
|
|
453
|
+
"src/web/components/auth/Register.tsx",
|
|
454
|
+
saasAuthRegisterTsx(),
|
|
455
|
+
opts.force,
|
|
456
|
+
);
|
|
457
|
+
await this.ensureFile(
|
|
458
|
+
root,
|
|
459
|
+
"src/web/components/auth/ResetPassword.tsx",
|
|
460
|
+
saasAuthResetPasswordTsx(),
|
|
461
|
+
opts.force,
|
|
462
|
+
);
|
|
463
|
+
await this.ensureFile(
|
|
464
|
+
root,
|
|
465
|
+
"src/web/components/auth/VerifyEmail.tsx",
|
|
466
|
+
saasAuthVerifyEmailTsx(),
|
|
467
|
+
opts.force,
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
// Admin — AppShell layout + 5 admin-* pages
|
|
471
|
+
await this.ensureFile(
|
|
472
|
+
root,
|
|
473
|
+
"src/web/components/admin/AdminLayout.tsx",
|
|
474
|
+
saasAdminLayoutTsx(),
|
|
475
|
+
opts.force,
|
|
476
|
+
);
|
|
477
|
+
await this.ensureFile(
|
|
478
|
+
root,
|
|
479
|
+
"src/web/components/admin/Users.tsx",
|
|
480
|
+
saasAdminUsersTsx(),
|
|
481
|
+
opts.force,
|
|
482
|
+
);
|
|
483
|
+
await this.ensureFile(
|
|
484
|
+
root,
|
|
485
|
+
"src/web/components/admin/Sessions.tsx",
|
|
486
|
+
saasAdminSessionsTsx(),
|
|
487
|
+
opts.force,
|
|
488
|
+
);
|
|
489
|
+
}
|
|
372
490
|
}
|
|
373
491
|
|
|
374
492
|
// ===========================================
|
|
@@ -376,11 +494,18 @@ export class ProjectScaffolder {
|
|
|
376
494
|
// ===========================================
|
|
377
495
|
|
|
378
496
|
/**
|
|
379
|
-
* Ensure test directory exists with a dummy test file
|
|
497
|
+
* Ensure test directory exists with a dummy test file + a self-contained
|
|
498
|
+
* `vitest.config.ts`. Pinning `test.root` prevents Vitest from walking up
|
|
499
|
+
* to a parent monorepo config (e.g. one that boots a Postgres container).
|
|
380
500
|
*/
|
|
381
501
|
public async ensureTestDir(root: string): Promise<void> {
|
|
382
502
|
const testDir = this.fs.join(root, "test");
|
|
383
503
|
const dummyPath = this.fs.join(testDir, "dummy.spec.ts");
|
|
504
|
+
const vitestConfigPath = this.fs.join(root, "vitest.config.ts");
|
|
505
|
+
|
|
506
|
+
if (!(await this.fs.exists(vitestConfigPath))) {
|
|
507
|
+
await this.fs.writeFile(vitestConfigPath, vitestConfigTs());
|
|
508
|
+
}
|
|
384
509
|
|
|
385
510
|
if (!(await this.fs.exists(testDir))) {
|
|
386
511
|
await this.fs.mkdir(testDir, { recursive: true });
|
|
@@ -413,9 +538,11 @@ export class ProjectScaffolder {
|
|
|
413
538
|
pm?: "yarn" | "npm" | "pnpm" | "bun";
|
|
414
539
|
api?: boolean;
|
|
415
540
|
react?: boolean;
|
|
416
|
-
ui?: boolean;
|
|
417
|
-
saas?: boolean;
|
|
418
541
|
tailwind?: boolean;
|
|
542
|
+
/** boolean toggle, or a string preset id (default `b0` when bare). */
|
|
543
|
+
shadcn?: boolean | string;
|
|
544
|
+
/** boolean toggle, or a string preset id (default `b0` when bare). */
|
|
545
|
+
saas?: boolean | string;
|
|
419
546
|
test?: boolean;
|
|
420
547
|
force?: boolean;
|
|
421
548
|
};
|
|
@@ -426,13 +553,33 @@ export class ProjectScaffolder {
|
|
|
426
553
|
await this.fs.mkdir(root, { force: true });
|
|
427
554
|
}
|
|
428
555
|
|
|
429
|
-
//
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
556
|
+
// `--shadcn` / `--saas` are union flags: bare → true, string → preset.
|
|
557
|
+
// Capture the preset string (default `b0`), then normalize both flags
|
|
558
|
+
// to plain booleans so the rest of the pipeline keeps its boolean
|
|
559
|
+
// contract with PackageManagerUtils + ensureWebProject etc.
|
|
560
|
+
const shadcnPreset =
|
|
561
|
+
(typeof flags.saas === "string" && flags.saas) ||
|
|
562
|
+
(typeof flags.shadcn === "string" && flags.shadcn) ||
|
|
563
|
+
"b0";
|
|
564
|
+
|
|
565
|
+
// Cast to a narrower view so downstream sees pure booleans.
|
|
566
|
+
const f = flags as Omit<typeof flags, "shadcn" | "saas"> & {
|
|
567
|
+
shadcn?: boolean;
|
|
568
|
+
saas?: boolean;
|
|
569
|
+
};
|
|
570
|
+
f.shadcn = !!flags.shadcn;
|
|
571
|
+
f.saas = !!flags.saas;
|
|
572
|
+
|
|
573
|
+
// Flag cascading:
|
|
574
|
+
// --saas → --shadcn + --api
|
|
575
|
+
// --shadcn → --tailwind
|
|
576
|
+
// --tailwind→ --react
|
|
577
|
+
if (f.saas) {
|
|
578
|
+
f.shadcn = true;
|
|
579
|
+
f.api = true;
|
|
433
580
|
}
|
|
434
|
-
if (
|
|
435
|
-
|
|
581
|
+
if (f.shadcn) {
|
|
582
|
+
f.tailwind = true;
|
|
436
583
|
}
|
|
437
584
|
if (flags.tailwind) {
|
|
438
585
|
flags.react = true;
|
|
@@ -440,7 +587,7 @@ export class ProjectScaffolder {
|
|
|
440
587
|
|
|
441
588
|
// When codegen flags are set, target directory must be empty (unless --force)
|
|
442
589
|
const hasCodegenFlags =
|
|
443
|
-
flags.
|
|
590
|
+
flags.api || flags.react || flags.tailwind || flags.shadcn || flags.saas;
|
|
444
591
|
if (hasCodegenFlags && !flags.force) {
|
|
445
592
|
const files = await this.fs.ls(root);
|
|
446
593
|
// Allow a directory that only has package.json (common for monorepo packages)
|
|
@@ -464,9 +611,6 @@ export class ProjectScaffolder {
|
|
|
464
611
|
|
|
465
612
|
const isExpo = await this.pm.hasExpo(root);
|
|
466
613
|
|
|
467
|
-
// Get git email for admin auto-promotion (if saas enabled)
|
|
468
|
-
const adminEmail = flags.saas ? await this.utils.getGitEmail() : undefined;
|
|
469
|
-
|
|
470
614
|
const force = !!flags.force;
|
|
471
615
|
|
|
472
616
|
await run({
|
|
@@ -474,12 +618,15 @@ export class ProjectScaffolder {
|
|
|
474
618
|
handler: async () => {
|
|
475
619
|
await this.ensureConfig(root, {
|
|
476
620
|
force,
|
|
477
|
-
packageJson: { ...
|
|
478
|
-
// Skip workspace-level configs if they exist at workspace root
|
|
479
|
-
|
|
621
|
+
packageJson: { ...f, isPackage: workspace.isPackage },
|
|
622
|
+
// Skip workspace-level configs if they exist at workspace root —
|
|
623
|
+
// unless --shadcn is set: the shadcn CLI reads the local
|
|
624
|
+
// tsconfig.json directly to detect import aliases (it doesn't
|
|
625
|
+
// follow `extends`), so we must ensure one exists in the package.
|
|
626
|
+
tsconfigJson: f.shadcn ? "local" : !workspace.config.tsconfigJson,
|
|
480
627
|
biomeJson: true,
|
|
481
628
|
editorconfig: !workspace.config.editorconfig,
|
|
482
|
-
agentMd: agentType ? { type: agentType
|
|
629
|
+
agentMd: agentType ? { type: agentType } : false,
|
|
483
630
|
});
|
|
484
631
|
|
|
485
632
|
// Create alepha.config.ts with documented options
|
|
@@ -492,19 +639,14 @@ export class ProjectScaffolder {
|
|
|
492
639
|
force,
|
|
493
640
|
});
|
|
494
641
|
if (flags.api) {
|
|
495
|
-
await this.ensureApiProject(root, {
|
|
496
|
-
auth: !!flags.saas,
|
|
497
|
-
adminEmail,
|
|
498
|
-
force,
|
|
499
|
-
});
|
|
642
|
+
await this.ensureApiProject(root, { saas: !!flags.saas, force });
|
|
500
643
|
}
|
|
501
644
|
if (flags.react && !isExpo) {
|
|
502
645
|
await this.ensureWebProject(root, {
|
|
503
646
|
api: !!flags.api,
|
|
504
|
-
ui: !!flags.ui,
|
|
505
|
-
auth: !!flags.saas,
|
|
506
|
-
admin: !!flags.saas,
|
|
507
647
|
tailwind: !!flags.tailwind,
|
|
648
|
+
shadcn: !!flags.shadcn,
|
|
649
|
+
saas: !!flags.saas,
|
|
508
650
|
force,
|
|
509
651
|
});
|
|
510
652
|
}
|
|
@@ -543,10 +685,76 @@ export class ProjectScaffolder {
|
|
|
543
685
|
await this.ensureTestDir(root);
|
|
544
686
|
}
|
|
545
687
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
688
|
+
// shadcn/ui: run `<pm> shadcn init` against the components.json we wrote
|
|
689
|
+
// earlier. shadcn detects the existing config, respects our aliases,
|
|
690
|
+
// injects theme tokens into src/main.css, writes src/web/lib/utils.ts,
|
|
691
|
+
// and installs runtime deps (clsx, tailwind-merge, etc.).
|
|
692
|
+
//
|
|
693
|
+
// Flags chosen to keep this fully non-interactive:
|
|
694
|
+
// --yes skip confirmation prompts (default in shadcn v4 but
|
|
695
|
+
// passed explicitly so older versions also behave)
|
|
696
|
+
// --no-monorepo skip the monorepo prompt — we ship a single-app
|
|
697
|
+
// layout; users opt into monorepo via `--monorepo`
|
|
698
|
+
// on the alepha side later
|
|
699
|
+
// --silent suppress shadcn's own progress output; alepha's
|
|
700
|
+
// runner already prints a status line
|
|
701
|
+
//
|
|
702
|
+
// We deliberately do NOT pass `--defaults` (would force Next.js +
|
|
703
|
+
// base-nova preset) or `--template` (only applies to scratch projects;
|
|
704
|
+
// ours already has main.server.ts / main.browser.ts).
|
|
705
|
+
// Each PM has a different way to exec a project-local binary.
|
|
706
|
+
const exec = pmExecPrefix(pmName);
|
|
707
|
+
|
|
708
|
+
if (flags.shadcn) {
|
|
709
|
+
// Fully non-interactive shadcn init. The `--preset` arg is what makes
|
|
710
|
+
// this work — without it shadcn falls back to interactive prompts even
|
|
711
|
+
// with --yes/--force. Defaults: vite template + radix base + reinstall
|
|
712
|
+
// (so the components.json we pre-wrote stays canonical).
|
|
713
|
+
await run(
|
|
714
|
+
`${exec} shadcn init --no-monorepo --base radix -t vite --yes --force --reinstall --preset ${escapeShellArg(shadcnPreset)}`,
|
|
715
|
+
{ alias: `running shadcn init (preset ${shadcnPreset})`, root },
|
|
716
|
+
);
|
|
717
|
+
// Re-pin our aliases + alepha registry — `shadcn init --force`
|
|
718
|
+
// overwrites components.json with the template defaults.
|
|
719
|
+
await this.fs.writeFile(
|
|
720
|
+
this.fs.join(root, "components.json"),
|
|
721
|
+
componentsJsonTs(),
|
|
722
|
+
);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// SaaS preset: pull in the auth + admin registry components from the
|
|
726
|
+
// public alepha registry (already wired via components.json's
|
|
727
|
+
// `registries: { "@alepha": "https://alepha.dev/r/{name}.json" }`).
|
|
728
|
+
// Each `shadcn add` writes the component into src/web/components/* and
|
|
729
|
+
// pulls its peer primitives + dependencies (sonner, etc.).
|
|
730
|
+
if (flags.saas) {
|
|
731
|
+
// Pull the public SaaS bundle in one shot — it aggregates control,
|
|
732
|
+
// auto-form, alepha-table, use-confirm, app-shell, every auth-*, and
|
|
733
|
+
// every admin-* block. Definition lives at
|
|
734
|
+
// https://alepha.dev/r/saas.json (see @alepha/ui-registry).
|
|
735
|
+
// `--yes --overwrite` is the only combo that works non-interactively
|
|
736
|
+
// when registry items would replace files we pre-wrote (auth-login etc.
|
|
737
|
+
// overlap with shadcn primitives like button/input).
|
|
738
|
+
await run(`${exec} shadcn add @alepha/saas --yes --overwrite`, {
|
|
739
|
+
alias: "adding alepha saas registry bundle",
|
|
740
|
+
root,
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// Best-effort lint: shadcn-imported registry components occasionally
|
|
745
|
+
// trip biome rules (e.g. noArrayIndexKey on a Fragment loop). The user
|
|
746
|
+
// can fix or silence these later — don't block the whole init.
|
|
747
|
+
try {
|
|
748
|
+
await run(`${pmName} run lint`, {
|
|
749
|
+
alias: "running linter",
|
|
750
|
+
root,
|
|
751
|
+
});
|
|
752
|
+
} catch (err) {
|
|
753
|
+
this.log.warn(
|
|
754
|
+
"Linter reported issues during init — continuing. Run `lint` again later to inspect.",
|
|
755
|
+
{ error: err instanceof Error ? err.message : String(err) },
|
|
756
|
+
);
|
|
757
|
+
}
|
|
550
758
|
|
|
551
759
|
// Initialize git repository if not in a workspace package
|
|
552
760
|
if (!workspace.isPackage) {
|
|
@@ -584,14 +792,6 @@ export class ProjectScaffolder {
|
|
|
584
792
|
` ${c.set("GREY_DARK", "$")} ${c.set("CYAN", `${pmRun} dev`)}`,
|
|
585
793
|
);
|
|
586
794
|
|
|
587
|
-
if (adminEmail) {
|
|
588
|
-
this.log.info("");
|
|
589
|
-
this.log.info(` Admin email: ${c.set("GREEN", adminEmail)}`);
|
|
590
|
-
this.log.info(
|
|
591
|
-
` ${c.set("GREY_DARK", "(from git config, change in src/api/AppSecurity.ts)")}`,
|
|
592
|
-
);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
795
|
this.log.info("");
|
|
596
796
|
}
|
|
597
797
|
|
|
@@ -635,3 +835,33 @@ export class ProjectScaffolder {
|
|
|
635
835
|
}
|
|
636
836
|
}
|
|
637
837
|
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Map a package manager name to the command that runs a project-local binary.
|
|
841
|
+
*
|
|
842
|
+
* - npm: `npx`
|
|
843
|
+
* - yarn: `yarn` (yarn auto-resolves binary names; `yarn shadcn ...` works)
|
|
844
|
+
* - pnpm: `pnpm exec`
|
|
845
|
+
* - bun: `bunx`
|
|
846
|
+
*
|
|
847
|
+
* Used to invoke `shadcn init` / `shadcn add` regardless of the user's PM —
|
|
848
|
+
* `npm shadcn ...` is invalid (it tries to run a script named `shadcn`).
|
|
849
|
+
*/
|
|
850
|
+
/** Quote a value so it survives shell parsing. */
|
|
851
|
+
const escapeShellArg = (value: string): string => {
|
|
852
|
+
if (/^[A-Za-z0-9_./@:-]+$/.test(value)) return value;
|
|
853
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
854
|
+
};
|
|
855
|
+
|
|
856
|
+
const pmExecPrefix = (pmName: string): string => {
|
|
857
|
+
switch (pmName) {
|
|
858
|
+
case "npm":
|
|
859
|
+
return "npx";
|
|
860
|
+
case "pnpm":
|
|
861
|
+
return "pnpm exec";
|
|
862
|
+
case "bun":
|
|
863
|
+
return "bunx";
|
|
864
|
+
default:
|
|
865
|
+
return "yarn";
|
|
866
|
+
}
|
|
867
|
+
};
|
|
@@ -8,7 +8,7 @@ import { BuildTask, type BuildTaskContext } from "./BuildTask.ts";
|
|
|
8
8
|
*
|
|
9
9
|
* Creates:
|
|
10
10
|
* - Dockerfile with configurable base image
|
|
11
|
-
* - Copies
|
|
11
|
+
* - Copies migrations directory if it exists
|
|
12
12
|
* - Builds Docker image when `--image` flag is provided
|
|
13
13
|
*/
|
|
14
14
|
export class BuildDockerTask extends BuildTask {
|
|
@@ -32,7 +32,7 @@ export class BuildDockerTask extends BuildTask {
|
|
|
32
32
|
await ctx.run({
|
|
33
33
|
name: "generate deploy config (docker)",
|
|
34
34
|
handler: async () => {
|
|
35
|
-
await this.
|
|
35
|
+
await this.copyMigrations(ctx.root, distDir);
|
|
36
36
|
await this.writeDockerfile(
|
|
37
37
|
ctx.root,
|
|
38
38
|
distDir,
|
|
@@ -47,14 +47,13 @@ export class BuildDockerTask extends BuildTask {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
protected async
|
|
51
|
-
root
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
await this.fs.cp(drizzleDir, this.fs.join(root, distDir, "drizzle"));
|
|
50
|
+
protected async copyMigrations(root: string, distDir: string): Promise<void> {
|
|
51
|
+
const migrationsDir = this.fs.join(root, "migrations");
|
|
52
|
+
if (await this.fs.exists(migrationsDir)) {
|
|
53
|
+
await this.fs.cp(
|
|
54
|
+
migrationsDir,
|
|
55
|
+
this.fs.join(root, distDir, "migrations"),
|
|
56
|
+
);
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
|
|
@@ -135,6 +135,14 @@ export class BuildServerTask extends BuildTask {
|
|
|
135
135
|
chunkFileNames: "[hash].js",
|
|
136
136
|
assetFileNames: "[hash][extname]",
|
|
137
137
|
format: "esm",
|
|
138
|
+
codeSplitting: {
|
|
139
|
+
groups: [
|
|
140
|
+
{
|
|
141
|
+
name: "react",
|
|
142
|
+
test: /node_modules\/react(\/|-dom\/)/,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
},
|
|
138
146
|
// Rolldown/Oxc minifier: preserve class and function names
|
|
139
147
|
minify: {
|
|
140
148
|
mangle: { keepNames: true },
|
|
@@ -2,18 +2,11 @@ export type AgentMdType = "claude" | "agents";
|
|
|
2
2
|
|
|
3
3
|
export interface AgentMdOptions {
|
|
4
4
|
type: AgentMdType;
|
|
5
|
-
ui?: boolean;
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
export const agentMd = (options: AgentMdOptions): string => {
|
|
9
8
|
const header = options.type === "claude" ? `# CLAUDE.md` : `# AGENTS.md`;
|
|
10
9
|
|
|
11
|
-
const docs = [`- Framework source: \`node_modules/alepha/src/\``];
|
|
12
|
-
if (options.ui) {
|
|
13
|
-
docs.push(`- UI components: \`node_modules/@alepha/ui/src/\``);
|
|
14
|
-
}
|
|
15
|
-
docs.push(`- Docs: https://alepha.dev/llms.txt`);
|
|
16
|
-
|
|
17
10
|
return `${header}
|
|
18
11
|
|
|
19
12
|
This is an **Alepha** project.
|
|
@@ -36,6 +29,7 @@ alepha build # Build
|
|
|
36
29
|
|
|
37
30
|
## Documentation
|
|
38
31
|
|
|
39
|
-
|
|
32
|
+
- Framework source: \`node_modules/alepha/src/\`
|
|
33
|
+
- Docs: https://alepha.dev/llms.txt
|
|
40
34
|
`.trim();
|
|
41
35
|
};
|