alepha 0.20.1 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +371 -573
- 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/notifications/index.d.ts +78 -17
- 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/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 +34 -31
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +13 -7
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.js +2 -1
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/cli/core/index.d.ts +8 -34
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +43 -232
- package/dist/cli/core/index.js.map +1 -1
- package/dist/cli/platform/index.d.ts +36 -11
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +93 -27
- package/dist/cli/platform/index.js.map +1 -1
- package/dist/command/index.d.ts +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 +6 -0
- 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/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/router/index.browser.js +0 -10
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +35 -12
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +0 -10
- package/dist/react/router/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 +206 -0
- package/dist/react/ui/index.js.map +1 -0
- 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/system/index.d.ts.map +1 -1
- package/dist/system/index.js +1 -0
- package/dist/system/index.js.map +1 -1
- package/dist/topic/core/index.js +1 -1
- package/dist/topic/core/index.js.map +1 -1
- package/package.json +6 -23
- package/src/api/files/jobs/FileJobs.ts +2 -1
- package/src/api/jobs/__tests__/$job.spec.ts +316 -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/verifications/jobs/VerificationJobs.ts +2 -1
- package/src/cli/core/__tests__/init.spec.ts +1 -1
- package/src/cli/core/commands/init.ts +0 -12
- package/src/cli/core/services/PackageManagerUtils.ts +2 -9
- package/src/cli/core/services/ProjectScaffolder.ts +17 -65
- package/src/cli/core/templates/agentMd.ts +2 -8
- package/src/cli/core/templates/apiIndexTs.ts +4 -18
- package/src/cli/core/templates/mainCss.ts +1 -36
- package/src/cli/core/templates/vitestConfigTs.ts +17 -0
- package/src/cli/core/templates/webAppRouterTs.ts +2 -85
- package/src/cli/platform/__tests__/CloudflareAdapter.spec.ts +22 -71
- 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/core/Alepha.ts +9 -0
- 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/router/primitives/$page.ts +35 -12
- 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/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/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/dist/cli/core/index.js
CHANGED
|
@@ -598,7 +598,7 @@ var AlephaCliUtils = class {
|
|
|
598
598
|
};
|
|
599
599
|
//#endregion
|
|
600
600
|
//#region ../../package.json
|
|
601
|
-
var version$1 = "0.20.
|
|
601
|
+
var version$1 = "0.20.2";
|
|
602
602
|
//#endregion
|
|
603
603
|
//#region ../../src/cli/core/alephaPackageJson.ts
|
|
604
604
|
const alephaPackageJson = {
|
|
@@ -703,16 +703,6 @@ const alephaPackageJson = {
|
|
|
703
703
|
"import": "./src/api/files/index.ts",
|
|
704
704
|
"default": "./src/api/files/index.ts"
|
|
705
705
|
},
|
|
706
|
-
"./api/invitations": {
|
|
707
|
-
"types": "./src/api/invitations/index.ts",
|
|
708
|
-
"import": "./src/api/invitations/index.ts",
|
|
709
|
-
"default": "./src/api/invitations/index.ts"
|
|
710
|
-
},
|
|
711
|
-
"./api/issues": {
|
|
712
|
-
"types": "./src/api/issues/index.ts",
|
|
713
|
-
"import": "./src/api/issues/index.ts",
|
|
714
|
-
"default": "./src/api/issues/index.ts"
|
|
715
|
-
},
|
|
716
706
|
"./api/jobs": {
|
|
717
707
|
"types": "./src/api/jobs/index.ts",
|
|
718
708
|
"react-native": "./src/api/jobs/index.browser.ts",
|
|
@@ -751,11 +741,6 @@ const alephaPackageJson = {
|
|
|
751
741
|
"import": "./src/api/payments/index.ts",
|
|
752
742
|
"default": "./src/api/payments/index.ts"
|
|
753
743
|
},
|
|
754
|
-
"./api/subscriptions": {
|
|
755
|
-
"types": "./src/api/subscriptions/index.ts",
|
|
756
|
-
"import": "./src/api/subscriptions/index.ts",
|
|
757
|
-
"default": "./src/api/subscriptions/index.ts"
|
|
758
|
-
},
|
|
759
744
|
"./api/users": {
|
|
760
745
|
"types": "./src/api/users/index.ts",
|
|
761
746
|
"react-native": "./src/api/users/index.browser.ts",
|
|
@@ -770,13 +755,6 @@ const alephaPackageJson = {
|
|
|
770
755
|
"import": "./src/api/verifications/index.ts",
|
|
771
756
|
"default": "./src/api/verifications/index.ts"
|
|
772
757
|
},
|
|
773
|
-
"./api/workflows": {
|
|
774
|
-
"types": "./src/api/workflows/index.ts",
|
|
775
|
-
"react-native": "./src/api/workflows/index.browser.ts",
|
|
776
|
-
"browser": "./src/api/workflows/index.browser.ts",
|
|
777
|
-
"import": "./src/api/workflows/index.ts",
|
|
778
|
-
"default": "./src/api/workflows/index.ts"
|
|
779
|
-
},
|
|
780
758
|
"./batch": {
|
|
781
759
|
"types": "./src/batch/index.ts",
|
|
782
760
|
"import": "./src/batch/index.ts",
|
|
@@ -971,6 +949,11 @@ const alephaPackageJson = {
|
|
|
971
949
|
"import": "./src/react/testing/index.ts",
|
|
972
950
|
"default": "./src/react/testing/index.ts"
|
|
973
951
|
},
|
|
952
|
+
"./react/ui": {
|
|
953
|
+
"types": "./src/react/ui/index.ts",
|
|
954
|
+
"import": "./src/react/ui/index.ts",
|
|
955
|
+
"default": "./src/react/ui/index.ts"
|
|
956
|
+
},
|
|
974
957
|
"./react/websocket": {
|
|
975
958
|
"types": "./src/react/websocket/index.ts",
|
|
976
959
|
"import": "./src/react/websocket/index.ts",
|
|
@@ -1359,7 +1342,7 @@ var PackageManagerUtils = class {
|
|
|
1359
1342
|
const alephaDeps = alephaPackageJson.devDependencies;
|
|
1360
1343
|
const dependencies = { alepha: `^${version}` };
|
|
1361
1344
|
const devDependencies = { vite: alephaDeps.vite };
|
|
1362
|
-
if (!
|
|
1345
|
+
if (!modes.react) devDependencies["drizzle-kit"] = alephaDeps["drizzle-kit"];
|
|
1363
1346
|
if (!modes.isPackage) {
|
|
1364
1347
|
devDependencies["@biomejs/biome"] = alephaDeps["@biomejs/biome"];
|
|
1365
1348
|
if (modes.test) devDependencies.vitest = alephaDeps.vitest;
|
|
@@ -1372,10 +1355,6 @@ var PackageManagerUtils = class {
|
|
|
1372
1355
|
verify: "alepha verify"
|
|
1373
1356
|
};
|
|
1374
1357
|
if (modes.test) scripts.test = "vitest run";
|
|
1375
|
-
if (modes.ui) {
|
|
1376
|
-
dependencies["@alepha/ui"] = `^${version}`;
|
|
1377
|
-
modes.react = true;
|
|
1378
|
-
}
|
|
1379
1358
|
if (modes.tailwind) {
|
|
1380
1359
|
devDependencies.tailwindcss = "^4.2.0";
|
|
1381
1360
|
devDependencies["@tailwindcss/vite"] = "^4.2.0";
|
|
@@ -1402,11 +1381,7 @@ var PackageManagerUtils = class {
|
|
|
1402
1381
|
//#endregion
|
|
1403
1382
|
//#region ../../src/cli/core/templates/agentMd.ts
|
|
1404
1383
|
const agentMd = (options) => {
|
|
1405
|
-
|
|
1406
|
-
const docs = [`- Framework source: \`node_modules/alepha/src/\``];
|
|
1407
|
-
if (options.ui) docs.push(`- UI components: \`node_modules/@alepha/ui/src/\``);
|
|
1408
|
-
docs.push(`- Docs: https://alepha.dev/llms.txt`);
|
|
1409
|
-
return `${header}
|
|
1384
|
+
return `${options.type === "claude" ? `# CLAUDE.md` : `# AGENTS.md`}
|
|
1410
1385
|
|
|
1411
1386
|
This is an **Alepha** project.
|
|
1412
1387
|
|
|
@@ -1428,7 +1403,8 @@ alepha build # Build
|
|
|
1428
1403
|
|
|
1429
1404
|
## Documentation
|
|
1430
1405
|
|
|
1431
|
-
|
|
1406
|
+
- Framework source: \`node_modules/alepha/src/\`
|
|
1407
|
+
- Docs: https://alepha.dev/llms.txt
|
|
1432
1408
|
`.trim();
|
|
1433
1409
|
};
|
|
1434
1410
|
//#endregion
|
|
@@ -1460,49 +1436,6 @@ export default defineConfig({
|
|
|
1460
1436
|
`;
|
|
1461
1437
|
};
|
|
1462
1438
|
//#endregion
|
|
1463
|
-
//#region ../../src/cli/core/templates/apiAppSecurityTs.ts
|
|
1464
|
-
const apiAppSecurityTs = (opts = {}) => {
|
|
1465
|
-
return `
|
|
1466
|
-
import { $realm } from "alepha/api/users";
|
|
1467
|
-
|
|
1468
|
-
export class AppSecurity {
|
|
1469
|
-
users = $realm({
|
|
1470
|
-
settings: {
|
|
1471
|
-
// Auto-promote these users to admin on login
|
|
1472
|
-
adminEmails: ${opts.adminEmail ? `["${opts.adminEmail}"]` : "[]"},
|
|
1473
|
-
adminUsernames: [],
|
|
1474
|
-
|
|
1475
|
-
// Registration & login options
|
|
1476
|
-
registrationAllowed: true,
|
|
1477
|
-
email: "required",
|
|
1478
|
-
username: "none",
|
|
1479
|
-
phoneNumber: "none",
|
|
1480
|
-
|
|
1481
|
-
// Verification (requires notifications feature)
|
|
1482
|
-
verifyEmailRequired: false,
|
|
1483
|
-
verifyPhoneRequired: false,
|
|
1484
|
-
resetPasswordAllowed: false,
|
|
1485
|
-
},
|
|
1486
|
-
features: {
|
|
1487
|
-
// Enable additional features
|
|
1488
|
-
notifications: false,
|
|
1489
|
-
audits: false,
|
|
1490
|
-
apiKeys: false,
|
|
1491
|
-
sessionPurge: false,
|
|
1492
|
-
avatars: false,
|
|
1493
|
-
parameters: false,
|
|
1494
|
-
},
|
|
1495
|
-
identities: {
|
|
1496
|
-
// Enable authentication providers
|
|
1497
|
-
credentials: true,
|
|
1498
|
-
// google: true,
|
|
1499
|
-
// github: true,
|
|
1500
|
-
},
|
|
1501
|
-
});
|
|
1502
|
-
}
|
|
1503
|
-
`.trim();
|
|
1504
|
-
};
|
|
1505
|
-
//#endregion
|
|
1506
1439
|
//#region ../../src/cli/core/templates/apiHelloControllerTs.ts
|
|
1507
1440
|
const apiHelloControllerTs = (options = {}) => {
|
|
1508
1441
|
return `import { $action } from "alepha/server";
|
|
@@ -1539,21 +1472,14 @@ export type HelloResponse = Static<typeof helloResponseSchema>;
|
|
|
1539
1472
|
//#endregion
|
|
1540
1473
|
//#region ../../src/cli/core/templates/apiIndexTs.ts
|
|
1541
1474
|
const apiIndexTs = (options = {}) => {
|
|
1542
|
-
const { appName = "app"
|
|
1543
|
-
const imports = ["import { $module } from \"alepha\";"];
|
|
1544
|
-
const services = [];
|
|
1545
|
-
if (auth) {
|
|
1546
|
-
imports.push("import { AppSecurity } from \"./AppSecurity.ts\";");
|
|
1547
|
-
services.push("AppSecurity");
|
|
1548
|
-
}
|
|
1549
|
-
imports.push("import { HelloController } from \"./controllers/HelloController.ts\";");
|
|
1550
|
-
services.push("HelloController");
|
|
1475
|
+
const { appName = "app" } = options;
|
|
1551
1476
|
return `
|
|
1552
|
-
$
|
|
1477
|
+
import { $module } from "alepha";
|
|
1478
|
+
import { HelloController } from "./controllers/HelloController.ts";
|
|
1553
1479
|
|
|
1554
1480
|
export const ApiModule = $module({
|
|
1555
1481
|
name: "${appName}.api",
|
|
1556
|
-
services: [
|
|
1482
|
+
services: [HelloController],
|
|
1557
1483
|
});
|
|
1558
1484
|
`.trim();
|
|
1559
1485
|
};
|
|
@@ -1725,37 +1651,6 @@ run(alepha);
|
|
|
1725
1651
|
//#endregion
|
|
1726
1652
|
//#region ../../src/cli/core/templates/mainCss.ts
|
|
1727
1653
|
const mainCss = (opts = {}) => {
|
|
1728
|
-
if (opts.ui) return `/**
|
|
1729
|
-
* Alepha UI - Based on Mantine component library
|
|
1730
|
-
* Mantine Docs: https://mantine.dev
|
|
1731
|
-
* Mantine LLM context: https://mantine.dev/llms.txt
|
|
1732
|
-
*
|
|
1733
|
-
* Switch theme index: alepha.set(alephaThemeAtom, { index: 1 })
|
|
1734
|
-
*
|
|
1735
|
-
* Custom themes (in src/web/index.ts):
|
|
1736
|
-
*
|
|
1737
|
-
* import { alephaThemeListAtom } from "@alepha/ui";
|
|
1738
|
-
*
|
|
1739
|
-
* export const WebModule = $module({
|
|
1740
|
-
* name: "app.web",
|
|
1741
|
-
* services: [AppRouter],
|
|
1742
|
-
* register(alepha) {
|
|
1743
|
-
* alepha.register(AppRouter);
|
|
1744
|
-
* alepha.set(alephaThemeListAtom, [{
|
|
1745
|
-
* name: "My Theme",
|
|
1746
|
-
* description: "Custom theme",
|
|
1747
|
-
* primaryColor: "blue",
|
|
1748
|
-
* defaultColorScheme: "dark",
|
|
1749
|
-
* // ...MantineThemeOverride options
|
|
1750
|
-
* }]);
|
|
1751
|
-
* },
|
|
1752
|
-
* });
|
|
1753
|
-
*
|
|
1754
|
-
* Alternatives (remove the import below):
|
|
1755
|
-
* - Tailwind CSS: https://tailwindcss.com/docs/installation/using-vite
|
|
1756
|
-
* - Raw CSS: Write your own styles
|
|
1757
|
-
*/
|
|
1758
|
-
@import "@alepha/ui/styles";`;
|
|
1759
1654
|
if (opts.tailwind) return `@import "tailwindcss";
|
|
1760
1655
|
|
|
1761
1656
|
/* Add your styles here */
|
|
@@ -1764,7 +1659,6 @@ const mainCss = (opts = {}) => {
|
|
|
1764
1659
|
* Global styles for your application.
|
|
1765
1660
|
*
|
|
1766
1661
|
* Options:
|
|
1767
|
-
* - @alepha/ui: Use \`alepha init --ui\` to add Mantine-based components
|
|
1768
1662
|
* - Tailwind CSS: Use \`alepha init --tailwind\` to add Tailwind CSS
|
|
1769
1663
|
* - Raw CSS: Write your own styles below
|
|
1770
1664
|
*/
|
|
@@ -1819,89 +1713,38 @@ export default defineConfig({
|
|
|
1819
1713
|
`;
|
|
1820
1714
|
};
|
|
1821
1715
|
//#endregion
|
|
1822
|
-
//#region ../../src/cli/core/templates/
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
</Text>
|
|
1832
|
-
<Text c="dimmed">Welcome to the admin panel.</Text>
|
|
1833
|
-
</Flex>
|
|
1834
|
-
);
|
|
1835
|
-
};
|
|
1716
|
+
//#region ../../src/cli/core/templates/vitestConfigTs.ts
|
|
1717
|
+
/**
|
|
1718
|
+
* Minimal Vitest config for a freshly scaffolded Alepha project.
|
|
1719
|
+
*
|
|
1720
|
+
* Defines `test.root` explicitly so Vitest doesn't walk up the directory
|
|
1721
|
+
* tree and inherit a parent monorepo config (which can pull in unrelated
|
|
1722
|
+
* setup files, database connections, etc.).
|
|
1723
|
+
*/
|
|
1724
|
+
const vitestConfigTs = () => `import { defineConfig } from "vitest/config";
|
|
1836
1725
|
|
|
1837
|
-
export default
|
|
1726
|
+
export default defineConfig({
|
|
1727
|
+
test: {
|
|
1728
|
+
root: ".",
|
|
1729
|
+
globals: true,
|
|
1730
|
+
},
|
|
1731
|
+
});
|
|
1838
1732
|
`;
|
|
1839
|
-
};
|
|
1840
1733
|
//#endregion
|
|
1841
1734
|
//#region ../../src/cli/core/templates/webAppRouterTs.ts
|
|
1842
1735
|
const webAppRouterTs = (options) => {
|
|
1843
|
-
const imports = [];
|
|
1736
|
+
const imports = ["import { $page } from \"alepha/react/router\";"];
|
|
1844
1737
|
const classMembers = [];
|
|
1845
|
-
if (options.ui) imports.push("import { $ui } from \"@alepha/ui\";");
|
|
1846
|
-
if (options.auth) imports.push("import { $uiAuth } from \"@alepha/ui/auth\";");
|
|
1847
|
-
if (options.admin) {
|
|
1848
|
-
imports.push("import { $uiAdmin } from \"@alepha/ui/admin\";");
|
|
1849
|
-
imports.push("import { AdminUserRouter } from \"@alepha/ui/admin-users\";");
|
|
1850
|
-
imports.push("import { AdminSessionRouter } from \"@alepha/ui/admin-sessions\";");
|
|
1851
|
-
imports.push("import { $inject } from \"alepha\";");
|
|
1852
|
-
imports.push("import { IconLayoutDashboard, IconUsers } from \"@tabler/icons-react\";");
|
|
1853
|
-
}
|
|
1854
|
-
imports.push("import { $page } from \"alepha/react/router\";");
|
|
1855
1738
|
if (options.api) {
|
|
1856
1739
|
imports.push("import { $client } from \"alepha/server/links\";");
|
|
1857
1740
|
imports.push("import type { HelloController } from \"../api/controllers/HelloController.ts\";");
|
|
1858
1741
|
classMembers.push(" api = $client<HelloController>();");
|
|
1859
|
-
|
|
1860
|
-
if (options.ui) {
|
|
1861
|
-
classMembers.push(" ui = $ui();");
|
|
1862
|
-
if (options.auth) classMembers.push(" uiAuth = $uiAuth();");
|
|
1863
|
-
if (options.admin) classMembers.push(` // ── Admin Dashboard ─────────────────────────────
|
|
1864
|
-
// Defined first so it can be referenced by the admin panel below.
|
|
1865
|
-
// \`$uiAdmin\` auto-parents listed pages under the admin layout.
|
|
1866
|
-
adminDashboard = $page({
|
|
1867
|
-
path: "/",
|
|
1868
|
-
label: "Dashboard",
|
|
1869
|
-
icon: IconLayoutDashboard,
|
|
1870
|
-
lazy: () => import("./components/AdminDashboard.tsx"),
|
|
1871
|
-
});
|
|
1872
|
-
|
|
1873
|
-
// ── Admin Domain Routers ──────────────────────────
|
|
1874
|
-
protected users = $inject(AdminUserRouter);
|
|
1875
|
-
protected sessions = $inject(AdminSessionRouter);
|
|
1876
|
-
|
|
1877
|
-
// ── Admin Panel ─────────────────────────────────
|
|
1878
|
-
admin = $uiAdmin({
|
|
1879
|
-
pages: [
|
|
1880
|
-
this.adminDashboard,
|
|
1881
|
-
this.users.adminUsers,
|
|
1882
|
-
this.users.adminUserLayout,
|
|
1883
|
-
this.sessions.adminSessions,
|
|
1884
|
-
],
|
|
1885
|
-
sidebarItems: [
|
|
1886
|
-
this.adminDashboard,
|
|
1887
|
-
{
|
|
1888
|
-
label: "Identity",
|
|
1889
|
-
icon: IconUsers,
|
|
1890
|
-
children: [this.users.adminUsers, this.sessions.adminSessions],
|
|
1891
|
-
},
|
|
1892
|
-
],
|
|
1893
|
-
});`);
|
|
1894
|
-
classMembers.push(` layout = $page({
|
|
1895
|
-
parent: this.ui.root,
|
|
1896
|
-
children: () => [this.home],
|
|
1897
|
-
});`);
|
|
1898
|
-
}
|
|
1899
|
-
if (options.api) classMembers.push(` home = $page({
|
|
1742
|
+
classMembers.push(` home = $page({
|
|
1900
1743
|
path: "/",
|
|
1901
1744
|
lazy: () => import("./components/Home.tsx"),
|
|
1902
1745
|
loader: () => this.api.hello(),
|
|
1903
1746
|
});`);
|
|
1904
|
-
else classMembers.push(` home = $page({
|
|
1747
|
+
} else classMembers.push(` home = $page({
|
|
1905
1748
|
path: "/",
|
|
1906
1749
|
lazy: () => import("./components/Home.tsx"),
|
|
1907
1750
|
});`);
|
|
@@ -2061,13 +1904,9 @@ var ProjectScaffolder = class {
|
|
|
2061
1904
|
const appName = this.getAppName(root);
|
|
2062
1905
|
await this.fs.mkdir(this.fs.join(root, "src/api/controllers"), { recursive: true });
|
|
2063
1906
|
await this.fs.mkdir(this.fs.join(root, "src/api/schemas"), { recursive: true });
|
|
2064
|
-
await this.ensureFile(root, "src/api/index.ts", apiIndexTs({
|
|
2065
|
-
appName,
|
|
2066
|
-
auth: opts.auth
|
|
2067
|
-
}), opts.force);
|
|
1907
|
+
await this.ensureFile(root, "src/api/index.ts", apiIndexTs({ appName }), opts.force);
|
|
2068
1908
|
await this.ensureFile(root, "src/api/controllers/HelloController.ts", apiHelloControllerTs({ appName }), opts.force);
|
|
2069
1909
|
await this.ensureFile(root, "src/api/schemas/helloResponseSchema.ts", apiHelloResponseSchemaTs(), opts.force);
|
|
2070
|
-
if (opts.auth) await this.ensureFile(root, "src/api/AppSecurity.ts", apiAppSecurityTs({ adminEmail: opts.adminEmail }), opts.force);
|
|
2071
1910
|
}
|
|
2072
1911
|
/**
|
|
2073
1912
|
* Ensure web/React project structure exists.
|
|
@@ -2082,28 +1921,23 @@ var ProjectScaffolder = class {
|
|
|
2082
1921
|
await this.fs.mkdir(this.fs.join(root, "src/web/components"), { recursive: true });
|
|
2083
1922
|
await this.fs.mkdir(this.fs.join(root, "public"), { recursive: true });
|
|
2084
1923
|
await this.ensureFile(root, "public/favicon.svg", logoSvg, opts.force);
|
|
2085
|
-
await this.ensureFile(root, "src/main.css", mainCss({
|
|
2086
|
-
ui: opts.ui,
|
|
2087
|
-
tailwind: opts.tailwind
|
|
2088
|
-
}), opts.force);
|
|
1924
|
+
await this.ensureFile(root, "src/main.css", mainCss({ tailwind: opts.tailwind }), opts.force);
|
|
2089
1925
|
if (opts.tailwind) await this.ensureFile(root, "vite.config.ts", viteConfigTs(), opts.force);
|
|
2090
1926
|
await this.ensureFile(root, "src/web/index.ts", webIndexTs({ appName }), opts.force);
|
|
2091
|
-
await this.ensureFile(root, "src/web/AppRouter.ts", webAppRouterTs({
|
|
2092
|
-
api: opts.api,
|
|
2093
|
-
ui: opts.ui,
|
|
2094
|
-
auth: opts.auth,
|
|
2095
|
-
admin: opts.admin
|
|
2096
|
-
}), opts.force);
|
|
1927
|
+
await this.ensureFile(root, "src/web/AppRouter.ts", webAppRouterTs({ api: opts.api }), opts.force);
|
|
2097
1928
|
await this.ensureFile(root, "src/web/components/Home.tsx", webHomeComponentTsx({ api: opts.api }), opts.force);
|
|
2098
|
-
if (opts.admin) await this.ensureFile(root, "src/web/components/AdminDashboard.tsx", webAdminDashboardTsx(), opts.force);
|
|
2099
1929
|
await this.ensureFile(root, "src/main.browser.ts", mainBrowserTs(), opts.force);
|
|
2100
1930
|
}
|
|
2101
1931
|
/**
|
|
2102
|
-
* Ensure test directory exists with a dummy test file
|
|
1932
|
+
* Ensure test directory exists with a dummy test file + a self-contained
|
|
1933
|
+
* `vitest.config.ts`. Pinning `test.root` prevents Vitest from walking up
|
|
1934
|
+
* to a parent monorepo config (e.g. one that boots a Postgres container).
|
|
2103
1935
|
*/
|
|
2104
1936
|
async ensureTestDir(root) {
|
|
2105
1937
|
const testDir = this.fs.join(root, "test");
|
|
2106
1938
|
const dummyPath = this.fs.join(testDir, "dummy.spec.ts");
|
|
1939
|
+
const vitestConfigPath = this.fs.join(root, "vitest.config.ts");
|
|
1940
|
+
if (!await this.fs.exists(vitestConfigPath)) await this.fs.writeFile(vitestConfigPath, vitestConfigTs());
|
|
2107
1941
|
if (!await this.fs.exists(testDir)) {
|
|
2108
1942
|
await this.fs.mkdir(testDir, { recursive: true });
|
|
2109
1943
|
await this.fs.writeFile(dummyPath, dummySpecTs());
|
|
@@ -2119,20 +1953,14 @@ var ProjectScaffolder = class {
|
|
|
2119
1953
|
root = this.fs.join(root, args);
|
|
2120
1954
|
await this.fs.mkdir(root, { force: true });
|
|
2121
1955
|
}
|
|
2122
|
-
if (flags.saas) {
|
|
2123
|
-
flags.api = true;
|
|
2124
|
-
flags.ui = true;
|
|
2125
|
-
}
|
|
2126
|
-
if (flags.ui) flags.react = true;
|
|
2127
1956
|
if (flags.tailwind) flags.react = true;
|
|
2128
|
-
if ((flags.
|
|
1957
|
+
if ((flags.api || flags.react || flags.tailwind) && !flags.force) {
|
|
2129
1958
|
if ((await this.fs.ls(root)).filter((f) => f !== "package.json").length > 0) throw new AlephaError(`Target directory is not empty (${root}). Use --force to overwrite existing files.`);
|
|
2130
1959
|
}
|
|
2131
1960
|
const workspace = await this.pm.getWorkspaceContext(root);
|
|
2132
1961
|
let agentType = false;
|
|
2133
1962
|
if (!workspace.isPackage) agentType = await this.utils.isInstalledAsync("claude") ? "claude" : "agents";
|
|
2134
1963
|
const isExpo = await this.pm.hasExpo(root);
|
|
2135
|
-
const adminEmail = flags.saas ? await this.utils.getGitEmail() : void 0;
|
|
2136
1964
|
const force = !!flags.force;
|
|
2137
1965
|
await run({
|
|
2138
1966
|
name: "ensuring configuration files",
|
|
@@ -2146,10 +1974,7 @@ var ProjectScaffolder = class {
|
|
|
2146
1974
|
tsconfigJson: !workspace.config.tsconfigJson,
|
|
2147
1975
|
biomeJson: true,
|
|
2148
1976
|
editorconfig: !workspace.config.editorconfig,
|
|
2149
|
-
agentMd: agentType ? {
|
|
2150
|
-
type: agentType,
|
|
2151
|
-
ui: !!flags.ui
|
|
2152
|
-
} : false
|
|
1977
|
+
agentMd: agentType ? { type: agentType } : false
|
|
2153
1978
|
});
|
|
2154
1979
|
await this.ensureAlephaConfig(root, { force });
|
|
2155
1980
|
await this.ensureMainServerTs(root, {
|
|
@@ -2157,16 +1982,9 @@ var ProjectScaffolder = class {
|
|
|
2157
1982
|
react: !!flags.react && !isExpo,
|
|
2158
1983
|
force
|
|
2159
1984
|
});
|
|
2160
|
-
if (flags.api) await this.ensureApiProject(root, {
|
|
2161
|
-
auth: !!flags.saas,
|
|
2162
|
-
adminEmail,
|
|
2163
|
-
force
|
|
2164
|
-
});
|
|
1985
|
+
if (flags.api) await this.ensureApiProject(root, { force });
|
|
2165
1986
|
if (flags.react && !isExpo) await this.ensureWebProject(root, {
|
|
2166
1987
|
api: !!flags.api,
|
|
2167
|
-
ui: !!flags.ui,
|
|
2168
|
-
auth: !!flags.saas,
|
|
2169
|
-
admin: !!flags.saas,
|
|
2170
1988
|
tailwind: !!flags.tailwind,
|
|
2171
1989
|
force
|
|
2172
1990
|
});
|
|
@@ -2205,11 +2023,6 @@ var ProjectScaffolder = class {
|
|
|
2205
2023
|
this.log.info("");
|
|
2206
2024
|
this.log.info(` ${c.set("GREY_DARK", "$")} cd ${c.set("CYAN", projectName)}`);
|
|
2207
2025
|
this.log.info(` ${c.set("GREY_DARK", "$")} ${c.set("CYAN", `${pmRun} dev`)}`);
|
|
2208
|
-
if (adminEmail) {
|
|
2209
|
-
this.log.info("");
|
|
2210
|
-
this.log.info(` Admin email: ${c.set("GREEN", adminEmail)}`);
|
|
2211
|
-
this.log.info(` ${c.set("GREY_DARK", "(from git config, change in src/api/AppSecurity.ts)")}`);
|
|
2212
|
-
}
|
|
2213
2026
|
this.log.info("");
|
|
2214
2027
|
}
|
|
2215
2028
|
/**
|
|
@@ -4774,8 +4587,6 @@ var InitCommand = class {
|
|
|
4774
4587
|
aliases: ["r"],
|
|
4775
4588
|
description: "Include React dependencies and web module (src/web/)"
|
|
4776
4589
|
})),
|
|
4777
|
-
ui: t.optional(t.boolean({ description: "Include @alepha/ui (components, auth portal, admin portal)" })),
|
|
4778
|
-
saas: t.optional(t.boolean({ description: "Include authentication, admin portal, API, UI, and React. Everything you need for a SaaS app." })),
|
|
4779
4590
|
tailwind: t.optional(t.boolean({ description: "Include Tailwind CSS with Vite plugin. Implies --react" })),
|
|
4780
4591
|
test: t.optional(t.boolean({ description: "Include Vitest and create test directory" })),
|
|
4781
4592
|
force: t.optional(t.boolean({
|