alepha 0.13.1 → 0.13.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 +1 -1
- package/dist/api-files/index.browser.js +80 -0
- package/dist/api-files/index.browser.js.map +1 -0
- package/dist/api-files/index.d.ts +28 -91
- package/dist/api-files/index.js +10 -755
- package/dist/api-files/index.js.map +1 -1
- package/dist/api-jobs/index.browser.js +56 -0
- package/dist/api-jobs/index.browser.js.map +1 -0
- package/dist/api-jobs/index.d.ts +46 -46
- package/dist/api-jobs/index.js +13 -13
- package/dist/api-jobs/index.js.map +1 -1
- package/dist/api-notifications/index.browser.js +382 -0
- package/dist/api-notifications/index.browser.js.map +1 -0
- package/dist/api-notifications/index.d.ts +231 -193
- package/dist/api-notifications/index.js +108 -78
- package/dist/api-notifications/index.js.map +1 -1
- package/dist/api-parameters/index.browser.js +29 -0
- package/dist/api-parameters/index.browser.js.map +1 -0
- package/dist/api-parameters/index.d.ts +21 -22
- package/dist/api-parameters/index.js +22 -22
- package/dist/api-parameters/index.js.map +1 -1
- package/dist/api-users/index.d.ts +237 -2001
- package/dist/api-users/index.js +969 -4795
- package/dist/api-users/index.js.map +1 -1
- package/dist/api-verifications/index.browser.js +52 -0
- package/dist/api-verifications/index.browser.js.map +1 -0
- package/dist/api-verifications/index.d.ts +119 -97
- package/dist/api-verifications/index.js +1 -1
- package/dist/api-verifications/index.js.map +1 -1
- package/dist/batch/index.d.ts +13 -13
- package/dist/batch/index.js +8 -13
- package/dist/batch/index.js.map +1 -1
- package/dist/bucket/index.d.ts +14 -14
- package/dist/bucket/index.js +19 -17
- package/dist/bucket/index.js.map +1 -1
- package/dist/cache/index.d.ts +11 -11
- package/dist/cache/index.js +9 -9
- package/dist/cache/index.js.map +1 -1
- package/dist/cli/{dist-Dl9Vl7Ur.js → dist-lGnqsKpu.js} +11 -15
- package/dist/cli/dist-lGnqsKpu.js.map +1 -0
- package/dist/cli/index.d.ts +32 -49
- package/dist/cli/index.js +90 -71
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +20 -19
- package/dist/command/index.js +34 -25
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +218 -218
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +232 -232
- package/dist/core/index.js +218 -218
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +2113 -0
- package/dist/core/index.native.js.map +1 -0
- package/dist/datetime/index.d.ts +9 -9
- package/dist/datetime/index.js +7 -7
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/index.d.ts +16 -16
- package/dist/email/index.js +14 -9
- package/dist/email/index.js.map +1 -1
- package/dist/file/index.js +1 -1
- package/dist/file/index.js.map +1 -1
- package/dist/lock/index.d.ts +9 -9
- package/dist/lock/index.js +8 -8
- package/dist/lock/index.js.map +1 -1
- package/dist/lock-redis/index.js +3 -66
- package/dist/lock-redis/index.js.map +1 -1
- package/dist/logger/index.d.ts +5 -5
- package/dist/logger/index.js +8 -8
- package/dist/logger/index.js.map +1 -1
- package/dist/orm/index.browser.js +114 -114
- package/dist/orm/index.browser.js.map +1 -1
- package/dist/orm/index.d.ts +218 -218
- package/dist/orm/index.js +49 -49
- package/dist/orm/index.js.map +1 -1
- package/dist/queue/index.d.ts +29 -29
- package/dist/queue/index.js +20 -20
- package/dist/queue/index.js.map +1 -1
- package/dist/queue-redis/index.d.ts +2 -2
- package/dist/redis/index.d.ts +4 -4
- package/dist/retry/index.d.ts +19 -19
- package/dist/retry/index.js +7 -7
- package/dist/retry/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +16 -16
- package/dist/scheduler/index.js +9 -9
- package/dist/scheduler/index.js.map +1 -1
- package/dist/security/index.d.ts +53 -53
- package/dist/security/index.js +35 -35
- package/dist/security/index.js.map +1 -1
- package/dist/server/index.browser.js +1 -1
- package/dist/server/index.browser.js.map +1 -1
- package/dist/server/index.d.ts +92 -92
- package/dist/server/index.js +16 -16
- package/dist/server/index.js.map +1 -1
- package/dist/server-auth/index.browser.js +4 -982
- package/dist/server-auth/index.browser.js.map +1 -1
- package/dist/server-auth/index.d.ts +204 -785
- package/dist/server-auth/index.js +47 -1239
- package/dist/server-auth/index.js.map +1 -1
- package/dist/server-cache/index.d.ts +10 -10
- package/dist/server-cache/index.js +2 -2
- package/dist/server-cache/index.js.map +1 -1
- package/dist/server-compress/index.d.ts +4 -4
- package/dist/server-compress/index.js +1 -1
- package/dist/server-compress/index.js.map +1 -1
- package/dist/server-cookies/index.browser.js +8 -8
- package/dist/server-cookies/index.browser.js.map +1 -1
- package/dist/server-cookies/index.d.ts +17 -17
- package/dist/server-cookies/index.js +11 -11
- package/dist/server-cookies/index.js.map +1 -1
- package/dist/server-cors/index.d.ts +17 -17
- package/dist/server-cors/index.js +9 -9
- package/dist/server-cors/index.js.map +1 -1
- package/dist/server-health/index.d.ts +19 -19
- package/dist/server-helmet/index.d.ts +1 -1
- package/dist/server-links/index.browser.js +12 -12
- package/dist/server-links/index.browser.js.map +1 -1
- package/dist/server-links/index.d.ts +59 -251
- package/dist/server-links/index.js +23 -502
- package/dist/server-links/index.js.map +1 -1
- package/dist/server-metrics/index.d.ts +4 -4
- package/dist/server-multipart/index.d.ts +2 -2
- package/dist/server-proxy/index.d.ts +12 -12
- package/dist/server-proxy/index.js +10 -10
- package/dist/server-proxy/index.js.map +1 -1
- package/dist/server-rate-limit/index.d.ts +22 -22
- package/dist/server-rate-limit/index.js +12 -12
- package/dist/server-rate-limit/index.js.map +1 -1
- package/dist/server-security/index.d.ts +22 -22
- package/dist/server-security/index.js +15 -15
- package/dist/server-security/index.js.map +1 -1
- package/dist/server-static/index.d.ts +14 -14
- package/dist/server-static/index.js +26 -10
- package/dist/server-static/index.js.map +1 -1
- package/dist/server-swagger/index.d.ts +25 -184
- package/dist/server-swagger/index.js +21 -724
- package/dist/server-swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +14 -14
- package/dist/sms/index.js +9 -9
- package/dist/sms/index.js.map +1 -1
- package/dist/thread/index.d.ts +11 -11
- package/dist/thread/index.js +17 -17
- package/dist/thread/index.js.map +1 -1
- package/dist/topic/index.d.ts +26 -26
- package/dist/topic/index.js +16 -16
- package/dist/topic/index.js.map +1 -1
- package/dist/topic-redis/index.d.ts +1 -1
- package/dist/vite/index.d.ts +3 -3
- package/dist/vite/index.js +8 -8
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.browser.js +11 -11
- package/dist/websocket/index.browser.js.map +1 -1
- package/dist/websocket/index.d.ts +58 -58
- package/dist/websocket/index.js +13 -13
- package/dist/websocket/index.js.map +1 -1
- package/package.json +128 -57
- package/src/api-files/index.browser.ts +17 -0
- package/src/api-files/services/FileService.ts +5 -7
- package/src/api-jobs/index.browser.ts +15 -0
- package/src/api-jobs/index.ts +1 -1
- package/src/api-jobs/{descriptors → primitives}/$job.ts +8 -8
- package/src/api-jobs/providers/JobProvider.ts +9 -9
- package/src/api-jobs/services/JobService.ts +5 -5
- package/src/api-notifications/controllers/NotificationController.ts +26 -1
- package/src/api-notifications/index.browser.ts +17 -0
- package/src/api-notifications/index.ts +6 -15
- package/src/api-notifications/{descriptors → primitives}/$notification.ts +10 -10
- package/src/api-notifications/schemas/notificationQuerySchema.ts +13 -0
- package/src/api-notifications/services/NotificationSenderService.ts +3 -3
- package/src/api-notifications/services/NotificationService.ts +45 -2
- package/src/api-parameters/index.browser.ts +12 -0
- package/src/api-parameters/index.ts +1 -1
- package/src/api-parameters/{descriptors → primitives}/$config.ts +7 -12
- package/src/api-users/atoms/realmAuthSettingsAtom.ts +3 -1
- package/src/api-users/controllers/UserController.ts +21 -1
- package/src/api-users/index.ts +1 -1
- package/src/api-users/{descriptors → primitives}/$userRealm.ts +40 -17
- package/src/api-users/providers/UserRealmProvider.ts +2 -1
- package/src/api-users/services/SessionService.ts +2 -0
- package/src/api-users/services/UserService.ts +56 -16
- package/src/api-verifications/index.browser.ts +15 -0
- package/src/api-verifications/index.ts +1 -0
- package/src/batch/index.ts +3 -3
- package/src/batch/{descriptors → primitives}/$batch.ts +13 -16
- package/src/batch/providers/BatchProvider.ts +0 -7
- package/src/bucket/index.ts +15 -13
- package/src/bucket/{descriptors → primitives}/$bucket.ts +8 -8
- package/src/bucket/providers/LocalFileStorageProvider.ts +3 -3
- package/src/cache/index.ts +4 -4
- package/src/cache/{descriptors → primitives}/$cache.ts +15 -15
- package/src/cli/apps/AlephaCli.ts +27 -1
- package/src/cli/apps/AlephaPackageBuilderCli.ts +27 -2
- package/src/cli/commands/CoreCommands.ts +6 -2
- package/src/cli/commands/DrizzleCommands.ts +6 -6
- package/src/cli/commands/VerifyCommands.ts +1 -1
- package/src/cli/commands/ViteCommands.ts +8 -2
- package/src/cli/services/ProjectUtils.ts +74 -78
- package/src/command/helpers/Asker.ts +10 -0
- package/src/command/index.ts +5 -5
- package/src/command/{descriptors → primitives}/$command.ts +9 -12
- package/src/command/providers/CliProvider.ts +10 -10
- package/src/core/Alepha.ts +30 -33
- package/src/core/constants/KIND.ts +1 -1
- package/src/core/constants/OPTIONS.ts +1 -1
- package/src/core/helpers/{descriptor.ts → primitive.ts} +18 -18
- package/src/core/helpers/ref.ts +1 -1
- package/src/core/index.shared.ts +8 -8
- package/src/core/{descriptors → primitives}/$context.ts +5 -5
- package/src/core/{descriptors → primitives}/$hook.ts +4 -4
- package/src/core/{descriptors → primitives}/$inject.ts +2 -2
- package/src/core/{descriptors → primitives}/$module.ts +9 -9
- package/src/core/{descriptors → primitives}/$use.ts +2 -2
- package/src/core/providers/CodecManager.ts +1 -1
- package/src/core/providers/JsonSchemaCodec.ts +1 -1
- package/src/core/providers/StateManager.ts +2 -2
- package/src/datetime/index.ts +3 -3
- package/src/datetime/{descriptors → primitives}/$interval.ts +6 -6
- package/src/email/index.ts +17 -9
- package/src/email/{descriptors → primitives}/$email.ts +8 -8
- package/src/file/index.ts +1 -1
- package/src/lock/index.ts +3 -3
- package/src/lock/{descriptors → primitives}/$lock.ts +10 -10
- package/src/logger/index.ts +8 -8
- package/src/logger/{descriptors → primitives}/$logger.ts +2 -2
- package/src/logger/services/Logger.ts +1 -1
- package/src/orm/constants/PG_SYMBOLS.ts +2 -2
- package/src/orm/index.browser.ts +2 -2
- package/src/orm/index.ts +8 -8
- package/src/orm/{descriptors → primitives}/$entity.ts +11 -11
- package/src/orm/{descriptors → primitives}/$repository.ts +2 -2
- package/src/orm/{descriptors → primitives}/$sequence.ts +8 -8
- package/src/orm/{descriptors → primitives}/$transaction.ts +4 -4
- package/src/orm/providers/PostgresTypeProvider.ts +3 -3
- package/src/orm/providers/RepositoryProvider.ts +4 -4
- package/src/orm/providers/drivers/DatabaseProvider.ts +7 -7
- package/src/orm/providers/drivers/NodeSqliteProvider.ts +3 -3
- package/src/orm/services/ModelBuilder.ts +9 -9
- package/src/orm/services/PgRelationManager.ts +2 -2
- package/src/orm/services/PostgresModelBuilder.ts +5 -5
- package/src/orm/services/Repository.ts +7 -7
- package/src/orm/services/SqliteModelBuilder.ts +5 -5
- package/src/queue/index.ts +7 -7
- package/src/queue/{descriptors → primitives}/$consumer.ts +15 -15
- package/src/queue/{descriptors → primitives}/$queue.ts +12 -12
- package/src/queue/providers/WorkerProvider.ts +7 -7
- package/src/retry/index.ts +3 -3
- package/src/retry/{descriptors → primitives}/$retry.ts +14 -14
- package/src/scheduler/index.ts +3 -3
- package/src/scheduler/{descriptors → primitives}/$scheduler.ts +9 -9
- package/src/scheduler/providers/CronProvider.ts +1 -1
- package/src/security/index.ts +9 -9
- package/src/security/{descriptors → primitives}/$permission.ts +7 -7
- package/src/security/{descriptors → primitives}/$realm.ts +6 -12
- package/src/security/{descriptors → primitives}/$role.ts +12 -12
- package/src/security/{descriptors → primitives}/$serviceAccount.ts +8 -8
- package/src/server/index.browser.ts +1 -1
- package/src/server/index.ts +14 -14
- package/src/server/{descriptors → primitives}/$action.ts +13 -13
- package/src/server/{descriptors → primitives}/$route.ts +9 -9
- package/src/server/providers/NodeHttpServerProvider.ts +1 -1
- package/src/server/services/HttpClient.ts +1 -1
- package/src/server-auth/index.browser.ts +1 -1
- package/src/server-auth/index.ts +6 -6
- package/src/server-auth/{descriptors → primitives}/$auth.ts +10 -10
- package/src/server-auth/{descriptors → primitives}/$authCredentials.ts +4 -4
- package/src/server-auth/{descriptors → primitives}/$authGithub.ts +4 -4
- package/src/server-auth/{descriptors → primitives}/$authGoogle.ts +4 -4
- package/src/server-auth/providers/ServerAuthProvider.ts +4 -4
- package/src/server-cache/providers/ServerCacheProvider.ts +7 -7
- package/src/server-compress/providers/ServerCompressProvider.ts +3 -3
- package/src/server-cookies/index.browser.ts +2 -2
- package/src/server-cookies/index.ts +5 -5
- package/src/server-cookies/{descriptors → primitives}/$cookie.browser.ts +12 -12
- package/src/server-cookies/{descriptors → primitives}/$cookie.ts +13 -13
- package/src/server-cookies/providers/ServerCookiesProvider.ts +6 -5
- package/src/server-cookies/services/CookieParser.ts +1 -1
- package/src/server-cors/index.ts +3 -3
- package/src/server-cors/{descriptors → primitives}/$cors.ts +11 -13
- package/src/server-cors/providers/ServerCorsProvider.ts +5 -5
- package/src/server-links/index.browser.ts +5 -5
- package/src/server-links/index.ts +9 -9
- package/src/server-links/{descriptors → primitives}/$remote.ts +11 -11
- package/src/server-links/providers/LinkProvider.ts +7 -7
- package/src/server-links/providers/{RemoteDescriptorProvider.ts → RemotePrimitiveProvider.ts} +6 -6
- package/src/server-links/providers/ServerLinksProvider.ts +3 -3
- package/src/server-proxy/index.ts +3 -3
- package/src/server-proxy/{descriptors → primitives}/$proxy.ts +8 -8
- package/src/server-proxy/providers/ServerProxyProvider.ts +4 -4
- package/src/server-rate-limit/index.ts +6 -6
- package/src/server-rate-limit/{descriptors → primitives}/$rateLimit.ts +13 -13
- package/src/server-rate-limit/providers/ServerRateLimitProvider.ts +5 -5
- package/src/server-security/index.ts +3 -3
- package/src/server-security/{descriptors → primitives}/$basicAuth.ts +13 -13
- package/src/server-security/providers/ServerBasicAuthProvider.ts +5 -5
- package/src/server-security/providers/ServerSecurityProvider.ts +4 -4
- package/src/server-static/index.ts +3 -3
- package/src/server-static/{descriptors → primitives}/$serve.ts +8 -10
- package/src/server-static/providers/ServerStaticProvider.ts +24 -9
- package/src/server-swagger/index.ts +5 -5
- package/src/server-swagger/{descriptors → primitives}/$swagger.ts +9 -9
- package/src/server-swagger/providers/ServerSwaggerProvider.ts +11 -10
- package/src/sms/index.ts +4 -4
- package/src/sms/{descriptors → primitives}/$sms.ts +8 -8
- package/src/thread/index.ts +3 -3
- package/src/thread/{descriptors → primitives}/$thread.ts +13 -13
- package/src/thread/providers/ThreadProvider.ts +7 -9
- package/src/topic/index.ts +5 -5
- package/src/topic/{descriptors → primitives}/$subscriber.ts +14 -14
- package/src/topic/{descriptors → primitives}/$topic.ts +10 -10
- package/src/topic/providers/TopicProvider.ts +4 -4
- package/src/vite/tasks/copyAssets.ts +1 -1
- package/src/vite/tasks/generateSitemap.ts +3 -3
- package/src/vite/tasks/prerenderPages.ts +2 -2
- package/src/vite/tasks/runAlepha.ts +2 -2
- package/src/websocket/index.browser.ts +3 -3
- package/src/websocket/index.shared.ts +2 -2
- package/src/websocket/index.ts +4 -4
- package/src/websocket/interfaces/WebSocketInterfaces.ts +3 -3
- package/src/websocket/{descriptors → primitives}/$channel.ts +10 -10
- package/src/websocket/{descriptors → primitives}/$websocket.ts +8 -8
- package/src/websocket/providers/NodeWebSocketServerProvider.ts +7 -7
- package/src/websocket/providers/WebSocketServerProvider.ts +3 -3
- package/src/websocket/services/WebSocketClient.ts +5 -5
- package/dist/cli/dist-Dl9Vl7Ur.js.map +0 -1
- package/src/api-notifications/providers/MemorySmsProvider.ts +0 -20
- package/src/api-notifications/providers/SmsProvider.ts +0 -8
- /package/src/core/{descriptors → primitives}/$atom.ts +0 -0
- /package/src/core/{descriptors → primitives}/$env.ts +0 -0
- /package/src/server-auth/{descriptors → primitives}/$authApple.ts +0 -0
- /package/src/server-links/{descriptors → primitives}/$client.ts +0 -0
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as alepha0 from "alepha";
|
|
2
2
|
import { Alepha } from "alepha";
|
|
3
|
+
import { FileSystemProvider } from "alepha/file";
|
|
3
4
|
import * as alepha_command0 from "alepha/command";
|
|
4
5
|
import { CliProvider } from "alepha/command";
|
|
5
6
|
import * as alepha_logger4 from "alepha/logger";
|
|
6
|
-
import { FileSystemProvider } from "alepha/file";
|
|
7
7
|
|
|
8
8
|
//#region src/cli/apps/AlephaCli.d.ts
|
|
9
9
|
declare const AlephaCli: alepha0.Service<alepha0.Module>;
|
|
@@ -12,6 +12,7 @@ declare const AlephaCli: alepha0.Service<alepha0.Module>;
|
|
|
12
12
|
interface Module {
|
|
13
13
|
name: string;
|
|
14
14
|
dependencies: string[];
|
|
15
|
+
native?: boolean;
|
|
15
16
|
browser?: boolean;
|
|
16
17
|
node?: boolean;
|
|
17
18
|
}
|
|
@@ -19,7 +20,7 @@ declare class AlephaPackageBuilderCli {
|
|
|
19
20
|
src: string;
|
|
20
21
|
dist: string;
|
|
21
22
|
fs: FileSystemProvider;
|
|
22
|
-
make: alepha_command0.
|
|
23
|
+
make: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
23
24
|
}
|
|
24
25
|
declare function analyzeModules(srcDir: string, packageName: string): Promise<Module[]>;
|
|
25
26
|
//#endregion
|
|
@@ -123,16 +124,6 @@ declare class ProjectUtils {
|
|
|
123
124
|
indexHtml?: boolean;
|
|
124
125
|
biomeJson?: boolean;
|
|
125
126
|
}): Promise<void>;
|
|
126
|
-
/**
|
|
127
|
-
* Ensure package.json exists and is configured as ES module.
|
|
128
|
-
*
|
|
129
|
-
* Similar to ensurePackageJson but only validates/sets the "type": "module" field.
|
|
130
|
-
* Throws an error if no package.json exists.
|
|
131
|
-
*
|
|
132
|
-
* @param root - The root directory of the project
|
|
133
|
-
* @throws {AlephaError} If no package.json is found
|
|
134
|
-
*/
|
|
135
|
-
ensurePackageJsonModule(root: string): Promise<void>;
|
|
136
127
|
/**
|
|
137
128
|
* Ensure tsconfig.json exists in the project.
|
|
138
129
|
*
|
|
@@ -146,7 +137,8 @@ declare class ProjectUtils {
|
|
|
146
137
|
*
|
|
147
138
|
* Creates a standard Alepha vite.config.ts if none exists.
|
|
148
139
|
*/
|
|
149
|
-
ensureViteConfig(root: string): Promise<void>;
|
|
140
|
+
ensureViteConfig(root: string, serverEntry?: string): Promise<void>;
|
|
141
|
+
protected checkFileExists(root: string, name: string, checkParentDirectories?: boolean): Promise<boolean>;
|
|
150
142
|
protected ensureFileExists(root: string, name: string, content: string, checkParentDirectories?: boolean): Promise<void>;
|
|
151
143
|
/**
|
|
152
144
|
* Get the path to Biome configuration file.
|
|
@@ -154,16 +146,6 @@ declare class ProjectUtils {
|
|
|
154
146
|
* Looks for an existing biome.json in the project root, or creates one if it doesn't exist.
|
|
155
147
|
*/
|
|
156
148
|
ensureBiomeConfig(root: string): Promise<void>;
|
|
157
|
-
/**
|
|
158
|
-
* Get the path to Vite configuration file.
|
|
159
|
-
*
|
|
160
|
-
* Looks for an existing vite.config.ts in the project root, or creates one if it doesn't exist.
|
|
161
|
-
*
|
|
162
|
-
* @param root - The root directory of the project (defaults to process.cwd())
|
|
163
|
-
* @param serverEntry - Optional path to the server entry file to include in the config
|
|
164
|
-
* @returns Absolute path to the vite.config.ts file
|
|
165
|
-
*/
|
|
166
|
-
getViteConfigPath(root: string, serverEntry?: string): Promise<string>;
|
|
167
149
|
/**
|
|
168
150
|
* Load Alepha instance from a server entry file.
|
|
169
151
|
*
|
|
@@ -209,6 +191,7 @@ declare class ProjectUtils {
|
|
|
209
191
|
entry: string;
|
|
210
192
|
rootDir: string;
|
|
211
193
|
}): Promise<string>;
|
|
194
|
+
loadEnvFile(root: string): Promise<void>;
|
|
212
195
|
/**
|
|
213
196
|
* Run a drizzle-kit command for all database providers in an Alepha instance.
|
|
214
197
|
*
|
|
@@ -227,12 +210,12 @@ declare class ProjectUtils {
|
|
|
227
210
|
}): Promise<void>;
|
|
228
211
|
getPackageManager(root: string): Promise<"yarn" | "pnpm" | "npm">;
|
|
229
212
|
ensureIndexHtml(root: string): Promise<void>;
|
|
230
|
-
|
|
213
|
+
exists(root: string, dirName: string): Promise<boolean>;
|
|
231
214
|
readPackageJson(root: string): Promise<Record<string, any>>;
|
|
232
215
|
}
|
|
233
216
|
interface DependencyModes {
|
|
234
217
|
react?: boolean;
|
|
235
|
-
|
|
218
|
+
ui?: boolean;
|
|
236
219
|
}
|
|
237
220
|
//#endregion
|
|
238
221
|
//#region src/cli/commands/BiomeCommands.d.ts
|
|
@@ -240,8 +223,8 @@ declare class BiomeCommands {
|
|
|
240
223
|
protected readonly log: alepha_logger4.Logger;
|
|
241
224
|
protected readonly runner: ProcessRunner;
|
|
242
225
|
protected readonly utils: ProjectUtils;
|
|
243
|
-
readonly format: alepha_command0.
|
|
244
|
-
readonly lint: alepha_command0.
|
|
226
|
+
readonly format: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
227
|
+
readonly lint: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
245
228
|
}
|
|
246
229
|
//#endregion
|
|
247
230
|
//#region src/cli/commands/CoreCommands.d.ts
|
|
@@ -252,22 +235,22 @@ declare class CoreCommands {
|
|
|
252
235
|
/**
|
|
253
236
|
* Called when no command is provided
|
|
254
237
|
*/
|
|
255
|
-
readonly root: alepha_command0.
|
|
238
|
+
readonly root: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
256
239
|
version: alepha0.TOptional<alepha0.TBoolean>;
|
|
257
240
|
}>, alepha0.TSchema>;
|
|
258
241
|
/**
|
|
259
242
|
* Clean the project, removing the "dist" directory
|
|
260
243
|
*/
|
|
261
|
-
readonly clean: alepha_command0.
|
|
244
|
+
readonly clean: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
262
245
|
/**
|
|
263
246
|
* Ensure the project has the necessary Alepha configuration files.
|
|
264
247
|
* Add the correct dependencies to package.json and install them.
|
|
265
248
|
*/
|
|
266
|
-
readonly init: alepha_command0.
|
|
249
|
+
readonly init: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
267
250
|
yarn: alepha0.TOptional<alepha0.TBoolean>;
|
|
268
251
|
pnpm: alepha0.TOptional<alepha0.TBoolean>;
|
|
269
252
|
react: alepha0.TOptional<alepha0.TBoolean>;
|
|
270
|
-
|
|
253
|
+
ui: alepha0.TOptional<alepha0.TBoolean>;
|
|
271
254
|
}>, alepha0.TSchema>;
|
|
272
255
|
}
|
|
273
256
|
//#endregion
|
|
@@ -279,19 +262,19 @@ declare class DrizzleCommands {
|
|
|
279
262
|
/**
|
|
280
263
|
* Check if database migrations are up to date.
|
|
281
264
|
*/
|
|
282
|
-
check: alepha_command0.
|
|
265
|
+
check: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
283
266
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
284
267
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
285
268
|
/**
|
|
286
269
|
* Generate database migration files
|
|
287
270
|
*
|
|
288
271
|
* - Loads the Alepha instance from the specified entry file.
|
|
289
|
-
* - Retrieves all repository
|
|
272
|
+
* - Retrieves all repository primitives to gather database models.
|
|
290
273
|
* - Creates temporary entity definitions based on the current database schema.
|
|
291
274
|
* - Writes these definitions to a temporary schema file. (node_modules/.db/entities.ts)
|
|
292
275
|
* - Invokes Drizzle Kit's CLI to generate migration files based on the current schema.
|
|
293
276
|
*/
|
|
294
|
-
generate: alepha_command0.
|
|
277
|
+
generate: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
295
278
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
296
279
|
custom: alepha0.TOptional<alepha0.TString>;
|
|
297
280
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
@@ -299,33 +282,33 @@ declare class DrizzleCommands {
|
|
|
299
282
|
* Push database schema changes directly to the database
|
|
300
283
|
*
|
|
301
284
|
* - Loads the Alepha instance from the specified entry file.
|
|
302
|
-
* - Retrieves all repository
|
|
285
|
+
* - Retrieves all repository primitives to gather database models.
|
|
303
286
|
* - Creates temporary entity definitions and Drizzle config.
|
|
304
287
|
* - Invokes Drizzle Kit's push command to apply schema changes directly.
|
|
305
288
|
*/
|
|
306
|
-
push: alepha_command0.
|
|
289
|
+
push: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
307
290
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
308
291
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
309
292
|
/**
|
|
310
293
|
* Apply pending database migrations
|
|
311
294
|
*
|
|
312
295
|
* - Loads the Alepha instance from the specified entry file.
|
|
313
|
-
* - Retrieves all repository
|
|
296
|
+
* - Retrieves all repository primitives to gather database models.
|
|
314
297
|
* - Creates temporary entity definitions and Drizzle config.
|
|
315
298
|
* - Invokes Drizzle Kit's migrate command to apply pending migrations.
|
|
316
299
|
*/
|
|
317
|
-
migrate: alepha_command0.
|
|
300
|
+
migrate: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
318
301
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
319
302
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
320
303
|
/**
|
|
321
304
|
* Launch Drizzle Studio database browser
|
|
322
305
|
*
|
|
323
306
|
* - Loads the Alepha instance from the specified entry file.
|
|
324
|
-
* - Retrieves all repository
|
|
307
|
+
* - Retrieves all repository primitives to gather database models.
|
|
325
308
|
* - Creates temporary entity definitions and Drizzle config.
|
|
326
309
|
* - Invokes Drizzle Kit's studio command to launch the web-based database browser.
|
|
327
310
|
*/
|
|
328
|
-
studio: alepha_command0.
|
|
311
|
+
studio: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
329
312
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
330
313
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
331
314
|
/**
|
|
@@ -333,7 +316,7 @@ declare class DrizzleCommands {
|
|
|
333
316
|
*
|
|
334
317
|
* @experimental
|
|
335
318
|
*/
|
|
336
|
-
drop: alepha_command0.
|
|
319
|
+
drop: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
337
320
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
338
321
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
339
322
|
/**
|
|
@@ -341,7 +324,7 @@ declare class DrizzleCommands {
|
|
|
341
324
|
*
|
|
342
325
|
* @experimental
|
|
343
326
|
*/
|
|
344
|
-
seed: alepha_command0.
|
|
327
|
+
seed: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
345
328
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
346
329
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
347
330
|
/**
|
|
@@ -349,7 +332,7 @@ declare class DrizzleCommands {
|
|
|
349
332
|
*
|
|
350
333
|
* @experimental
|
|
351
334
|
*/
|
|
352
|
-
status: alepha_command0.
|
|
335
|
+
status: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
353
336
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
354
337
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
355
338
|
}
|
|
@@ -371,11 +354,11 @@ declare class VerifyCommands {
|
|
|
371
354
|
* - Build the project
|
|
372
355
|
* - Clean the project again
|
|
373
356
|
*/
|
|
374
|
-
readonly verify: alepha_command0.
|
|
357
|
+
readonly verify: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
375
358
|
/**
|
|
376
359
|
* Run TypeScript type checking across the codebase with no emit.
|
|
377
360
|
*/
|
|
378
|
-
readonly typecheck: alepha_command0.
|
|
361
|
+
readonly typecheck: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
379
362
|
}
|
|
380
363
|
//#endregion
|
|
381
364
|
//#region src/cli/commands/ViteCommands.d.ts
|
|
@@ -386,7 +369,7 @@ declare class ViteCommands {
|
|
|
386
369
|
protected readonly env: {
|
|
387
370
|
VITEST_ARGS: string;
|
|
388
371
|
};
|
|
389
|
-
readonly run: alepha_command0.
|
|
372
|
+
readonly run: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
390
373
|
watch: alepha0.TOptional<alepha0.TBoolean>;
|
|
391
374
|
}>, alepha0.TString>;
|
|
392
375
|
/**
|
|
@@ -395,8 +378,8 @@ declare class ViteCommands {
|
|
|
395
378
|
* - If an index.html file is found in the project root, it will run Vite in dev mode.
|
|
396
379
|
* - Otherwise, it will look for a server entry file and run it with tsx in watch mode.
|
|
397
380
|
*/
|
|
398
|
-
readonly dev: alepha_command0.
|
|
399
|
-
readonly build: alepha_command0.
|
|
381
|
+
readonly dev: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TOptional<alepha0.TString>>;
|
|
382
|
+
readonly build: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
400
383
|
stats: alepha0.TOptional<alepha0.TBoolean>;
|
|
401
384
|
vercel: alepha0.TOptional<alepha0.TBoolean>;
|
|
402
385
|
cloudflare: alepha0.TOptional<alepha0.TBoolean>;
|
|
@@ -404,7 +387,7 @@ declare class ViteCommands {
|
|
|
404
387
|
sitemap: alepha0.TOptional<alepha0.TString>;
|
|
405
388
|
prerender: alepha0.TOptional<alepha0.TBoolean>;
|
|
406
389
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
407
|
-
readonly test: alepha_command0.
|
|
390
|
+
readonly test: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
408
391
|
}
|
|
409
392
|
//#endregion
|
|
410
393
|
//#region src/cli/version.d.ts
|
package/dist/cli/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { $env, $hook, $inject, $module, Alepha, AlephaError, OPTIONS, t } from "alepha";
|
|
3
|
+
import { FileSystemProvider } from "alepha/file";
|
|
2
4
|
import { $command, CliProvider } from "alepha/command";
|
|
3
5
|
import { $logger } from "alepha/logger";
|
|
4
6
|
import { spawn } from "node:child_process";
|
|
5
7
|
import { access, mkdir, readFile, readdir, unlink, writeFile } from "node:fs/promises";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { FileSystemProvider } from "alepha/file";
|
|
8
8
|
import { boot, buildClient, buildServer, copyAssets, generateCloudflare, generateDocker, generateSitemap, generateVercel, prerenderPages } from "alepha/vite";
|
|
9
9
|
import { tsImport } from "tsx/esm/api";
|
|
10
10
|
import { readFileSync } from "node:fs";
|
|
@@ -219,13 +219,16 @@ var ProjectUtils = class {
|
|
|
219
219
|
generatePackageJsonContent(modes) {
|
|
220
220
|
const dependencies = { alepha: `^${version}` };
|
|
221
221
|
const devDependencies = {};
|
|
222
|
+
if (modes.ui) {
|
|
223
|
+
dependencies["@alepha/ui"] = `^${version}`;
|
|
224
|
+
modes.react = true;
|
|
225
|
+
}
|
|
222
226
|
if (modes.react) {
|
|
223
227
|
dependencies["@alepha/react"] = `^${version}`;
|
|
224
228
|
dependencies.react = "^19.2.0";
|
|
225
229
|
dependencies["react-dom"] = "^19.2.0";
|
|
226
230
|
devDependencies["@types/react"] = "^19.2.0";
|
|
227
231
|
}
|
|
228
|
-
if (modes.admin) dependencies["@alepha/ui"] = `^${version}`;
|
|
229
232
|
return {
|
|
230
233
|
type: "module",
|
|
231
234
|
dependencies,
|
|
@@ -278,29 +281,6 @@ var ProjectUtils = class {
|
|
|
278
281
|
await Promise.all(tasks);
|
|
279
282
|
}
|
|
280
283
|
/**
|
|
281
|
-
* Ensure package.json exists and is configured as ES module.
|
|
282
|
-
*
|
|
283
|
-
* Similar to ensurePackageJson but only validates/sets the "type": "module" field.
|
|
284
|
-
* Throws an error if no package.json exists.
|
|
285
|
-
*
|
|
286
|
-
* @param root - The root directory of the project
|
|
287
|
-
* @throws {AlephaError} If no package.json is found
|
|
288
|
-
*/
|
|
289
|
-
async ensurePackageJsonModule(root) {
|
|
290
|
-
const packageJsonPath = join(root, "package.json");
|
|
291
|
-
try {
|
|
292
|
-
await access(packageJsonPath);
|
|
293
|
-
} catch (error) {
|
|
294
|
-
throw new AlephaError("No package.json found in project root. Run 'npx alepha init' to create one.");
|
|
295
|
-
}
|
|
296
|
-
const content = await readFile(packageJsonPath, "utf8");
|
|
297
|
-
const packageJson$1 = JSON.parse(content);
|
|
298
|
-
if (!packageJson$1.type || packageJson$1.type !== "module") {
|
|
299
|
-
packageJson$1.type = "module";
|
|
300
|
-
await writeFile(packageJsonPath, JSON.stringify(packageJson$1, null, 2));
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
284
|
* Ensure tsconfig.json exists in the project.
|
|
305
285
|
*
|
|
306
286
|
* Creates a standard Alepha tsconfig.json if none exists.
|
|
@@ -315,17 +295,16 @@ var ProjectUtils = class {
|
|
|
315
295
|
*
|
|
316
296
|
* Creates a standard Alepha vite.config.ts if none exists.
|
|
317
297
|
*/
|
|
318
|
-
async ensureViteConfig(root) {
|
|
319
|
-
await this.ensureFileExists(root, "vite.config.ts", viteConfigTs(), false);
|
|
298
|
+
async ensureViteConfig(root, serverEntry) {
|
|
299
|
+
await this.ensureFileExists(root, "vite.config.ts", viteConfigTs(serverEntry), false);
|
|
320
300
|
}
|
|
321
|
-
async
|
|
301
|
+
async checkFileExists(root, name, checkParentDirectories = false) {
|
|
322
302
|
const configPath = join(root, name);
|
|
323
303
|
if (!checkParentDirectories) try {
|
|
324
304
|
await access(configPath);
|
|
325
|
-
return;
|
|
305
|
+
return true;
|
|
326
306
|
} catch {
|
|
327
|
-
|
|
328
|
-
return;
|
|
307
|
+
return false;
|
|
329
308
|
}
|
|
330
309
|
let found = false;
|
|
331
310
|
let currentDir = root;
|
|
@@ -343,7 +322,10 @@ var ProjectUtils = class {
|
|
|
343
322
|
}
|
|
344
323
|
level += 1;
|
|
345
324
|
}
|
|
346
|
-
|
|
325
|
+
return found;
|
|
326
|
+
}
|
|
327
|
+
async ensureFileExists(root, name, content, checkParentDirectories = false) {
|
|
328
|
+
if (!await this.checkFileExists(root, name, checkParentDirectories)) await writeFile(join(root, name), content);
|
|
347
329
|
}
|
|
348
330
|
/**
|
|
349
331
|
* Get the path to Biome configuration file.
|
|
@@ -354,24 +336,6 @@ var ProjectUtils = class {
|
|
|
354
336
|
await this.ensureFileExists(root, "biome.json", biomeJson, true);
|
|
355
337
|
}
|
|
356
338
|
/**
|
|
357
|
-
* Get the path to Vite configuration file.
|
|
358
|
-
*
|
|
359
|
-
* Looks for an existing vite.config.ts in the project root, or creates one if it doesn't exist.
|
|
360
|
-
*
|
|
361
|
-
* @param root - The root directory of the project (defaults to process.cwd())
|
|
362
|
-
* @param serverEntry - Optional path to the server entry file to include in the config
|
|
363
|
-
* @returns Absolute path to the vite.config.ts file
|
|
364
|
-
*/
|
|
365
|
-
async getViteConfigPath(root, serverEntry) {
|
|
366
|
-
try {
|
|
367
|
-
const viteConfigPath = join(root, "vite.config.ts");
|
|
368
|
-
await access(viteConfigPath);
|
|
369
|
-
return viteConfigPath;
|
|
370
|
-
} catch {
|
|
371
|
-
return this.runner.writeConfigFile("vite.config.ts", viteConfigTs(serverEntry));
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
339
|
* Load Alepha instance from a server entry file.
|
|
376
340
|
*
|
|
377
341
|
* Dynamically imports the server entry file and extracts the Alepha instance.
|
|
@@ -441,10 +405,32 @@ ${models.map((it) => `export const ${it} = models["${it}"];`).join("\n")}
|
|
|
441
405
|
dialect: options.dialect,
|
|
442
406
|
dbCredentials: { url: options.providerUrl }
|
|
443
407
|
};
|
|
408
|
+
if (options.dialect === "sqlite") {
|
|
409
|
+
let url = options.providerUrl;
|
|
410
|
+
url = url.replace("sqlite://", "").replace("file://", "");
|
|
411
|
+
url = join(options.rootDir, url);
|
|
412
|
+
config.dbCredentials = { url };
|
|
413
|
+
}
|
|
444
414
|
if (options.providerName === "pglite") config.driver = "pglite";
|
|
445
415
|
const drizzleConfigJs = `export default ${JSON.stringify(config, null, 2)}`;
|
|
446
416
|
return await this.runner.writeConfigFile("drizzle.config.js", drizzleConfigJs, options.rootDir);
|
|
447
417
|
}
|
|
418
|
+
async loadEnvFile(root) {
|
|
419
|
+
const envPath = join(root, ".env");
|
|
420
|
+
try {
|
|
421
|
+
const lines = (await readFile(envPath, "utf8")).split("\n");
|
|
422
|
+
for (const line of lines) {
|
|
423
|
+
const [key, ...rest] = line.split("=");
|
|
424
|
+
if (key) {
|
|
425
|
+
const value = rest.join("=");
|
|
426
|
+
process.env[key.trim()] = value.trim();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
this.log.debug(`Loaded environment variables from ${envPath}`);
|
|
430
|
+
} catch {
|
|
431
|
+
this.log.debug(`No .env file found at ${envPath}, skipping load.`);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
448
434
|
/**
|
|
449
435
|
* Run a drizzle-kit command for all database providers in an Alepha instance.
|
|
450
436
|
*
|
|
@@ -455,13 +441,14 @@ ${models.map((it) => `export const ${it} = models["${it}"];`).join("\n")}
|
|
|
455
441
|
*/
|
|
456
442
|
async runDrizzleKitCommand(options) {
|
|
457
443
|
const rootDir = options.root;
|
|
444
|
+
await this.loadEnvFile(rootDir);
|
|
458
445
|
this.log.debug(`Using project root: ${rootDir}`);
|
|
459
446
|
const { alepha, entry } = await this.loadAlephaFromServerEntryFile(rootDir, options.args);
|
|
460
447
|
const drizzleKitProvider = alepha.inject("DrizzleKitProvider");
|
|
461
448
|
const repositoryProvider = alepha.inject("RepositoryProvider");
|
|
462
449
|
const accepted = /* @__PURE__ */ new Set([]);
|
|
463
|
-
for (const
|
|
464
|
-
const provider =
|
|
450
|
+
for (const primitive of repositoryProvider.getRepositories()) {
|
|
451
|
+
const provider = primitive.provider;
|
|
465
452
|
const providerName = provider.name;
|
|
466
453
|
const dialect = provider.dialect;
|
|
467
454
|
if (accepted.has(providerName)) continue;
|
|
@@ -486,9 +473,9 @@ ${models.map((it) => `export const ${it} = models["${it}"];`).join("\n")}
|
|
|
486
473
|
}
|
|
487
474
|
}
|
|
488
475
|
async getPackageManager(root) {
|
|
489
|
-
if (await this.
|
|
490
|
-
|
|
491
|
-
|
|
476
|
+
if (await this.checkFileExists(root, "yarn.lock", true)) return "yarn";
|
|
477
|
+
if (await this.checkFileExists(root, "pnpm-lock.yaml", true)) return "pnpm";
|
|
478
|
+
return "npm";
|
|
492
479
|
}
|
|
493
480
|
async ensureIndexHtml(root) {
|
|
494
481
|
if (await this.fs.exists(join(root, "index.html"))) return;
|
|
@@ -503,7 +490,7 @@ ${models.map((it) => `export const ${it} = models["${it}"];`).join("\n")}
|
|
|
503
490
|
if (!await this.fs.exists(join(root, serverEntry))) await this.fs.writeFile(join(root, serverEntry), mainBrowserTs());
|
|
504
491
|
if (!await this.fs.exists(join(root, appRouter))) await this.fs.writeFile(join(root, appRouter), appRouterTs());
|
|
505
492
|
}
|
|
506
|
-
async
|
|
493
|
+
async exists(root, dirName) {
|
|
507
494
|
return this.fs.exists(join(root, dirName));
|
|
508
495
|
}
|
|
509
496
|
async readPackageJson(root) {
|
|
@@ -580,9 +567,10 @@ var CoreCommands = class {
|
|
|
580
567
|
yarn: t.optional(t.boolean({ description: "Use Yarn package manager" })),
|
|
581
568
|
pnpm: t.optional(t.boolean({ description: "Use pnpm package manager" })),
|
|
582
569
|
react: t.optional(t.boolean({ description: "Include Alepha React dependencies" })),
|
|
583
|
-
|
|
570
|
+
ui: t.optional(t.boolean({ description: "Include Alepha UI dependencies" }))
|
|
584
571
|
}),
|
|
585
572
|
handler: async ({ run, flags, root }) => {
|
|
573
|
+
if (flags.ui) flags.react = true;
|
|
586
574
|
await run({
|
|
587
575
|
name: "Ensuring configuration files",
|
|
588
576
|
handler: async () => {
|
|
@@ -630,8 +618,8 @@ var DrizzleCommands = class {
|
|
|
630
618
|
const repositoryProvider = alepha.inject("RepositoryProvider");
|
|
631
619
|
const drizzleKitProvider = alepha.inject("DrizzleKitProvider");
|
|
632
620
|
const accepted = /* @__PURE__ */ new Set([]);
|
|
633
|
-
for (const
|
|
634
|
-
const provider =
|
|
621
|
+
for (const primitive of repositoryProvider.getRepositories()) {
|
|
622
|
+
const provider = primitive.provider;
|
|
635
623
|
const providerName = provider.name;
|
|
636
624
|
if (accepted.has(providerName)) continue;
|
|
637
625
|
accepted.add(providerName);
|
|
@@ -677,7 +665,7 @@ var DrizzleCommands = class {
|
|
|
677
665
|
* Generate database migration files
|
|
678
666
|
*
|
|
679
667
|
* - Loads the Alepha instance from the specified entry file.
|
|
680
|
-
* - Retrieves all repository
|
|
668
|
+
* - Retrieves all repository primitives to gather database models.
|
|
681
669
|
* - Creates temporary entity definitions based on the current database schema.
|
|
682
670
|
* - Writes these definitions to a temporary schema file. (node_modules/.db/entities.ts)
|
|
683
671
|
* - Invokes Drizzle Kit's CLI to generate migration files based on the current schema.
|
|
@@ -707,7 +695,7 @@ var DrizzleCommands = class {
|
|
|
707
695
|
* Push database schema changes directly to the database
|
|
708
696
|
*
|
|
709
697
|
* - Loads the Alepha instance from the specified entry file.
|
|
710
|
-
* - Retrieves all repository
|
|
698
|
+
* - Retrieves all repository primitives to gather database models.
|
|
711
699
|
* - Creates temporary entity definitions and Drizzle config.
|
|
712
700
|
* - Invokes Drizzle Kit's push command to apply schema changes directly.
|
|
713
701
|
*/
|
|
@@ -734,7 +722,7 @@ var DrizzleCommands = class {
|
|
|
734
722
|
* Apply pending database migrations
|
|
735
723
|
*
|
|
736
724
|
* - Loads the Alepha instance from the specified entry file.
|
|
737
|
-
* - Retrieves all repository
|
|
725
|
+
* - Retrieves all repository primitives to gather database models.
|
|
738
726
|
* - Creates temporary entity definitions and Drizzle config.
|
|
739
727
|
* - Invokes Drizzle Kit's migrate command to apply pending migrations.
|
|
740
728
|
*/
|
|
@@ -761,7 +749,7 @@ var DrizzleCommands = class {
|
|
|
761
749
|
* Launch Drizzle Studio database browser
|
|
762
750
|
*
|
|
763
751
|
* - Loads the Alepha instance from the specified entry file.
|
|
764
|
-
* - Retrieves all repository
|
|
752
|
+
* - Retrieves all repository primitives to gather database models.
|
|
765
753
|
* - Creates temporary entity definitions and Drizzle config.
|
|
766
754
|
* - Invokes Drizzle Kit's studio command to launch the web-based database browser.
|
|
767
755
|
*/
|
|
@@ -870,7 +858,7 @@ var VerifyCommands = class {
|
|
|
870
858
|
await run("alepha lint");
|
|
871
859
|
await run("alepha typecheck");
|
|
872
860
|
if ((await this.utils.readPackageJson(root)).devDependencies?.vitest) await run("alepha test");
|
|
873
|
-
if (await this.utils.
|
|
861
|
+
if (await this.utils.exists(root, "migrations")) await run("alepha db:check-migrations");
|
|
874
862
|
await run("alepha build");
|
|
875
863
|
await run("alepha clean");
|
|
876
864
|
}
|
|
@@ -935,7 +923,10 @@ var ViteCommands = class {
|
|
|
935
923
|
await access(join(root, "index.html"));
|
|
936
924
|
} catch {
|
|
937
925
|
this.log.trace("No index.html found, running entry file with tsx");
|
|
938
|
-
|
|
926
|
+
let cmd = "tsx --watch";
|
|
927
|
+
if (await this.utils.exists(root, ".env")) cmd += ` --env-file=./.env`;
|
|
928
|
+
cmd += ` ${entry}`;
|
|
929
|
+
await this.runner.exec(cmd);
|
|
939
930
|
return;
|
|
940
931
|
}
|
|
941
932
|
await this.runner.exec(`vite`);
|
|
@@ -969,6 +960,7 @@ var ViteCommands = class {
|
|
|
969
960
|
await run.rm("dist", { alias: "clean dist" });
|
|
970
961
|
const viteAlephaBuildOptions = (await import(join(root, "vite.config.ts")))?.default?.plugins.find((it) => !!it[OPTIONS])?.[OPTIONS] ?? {};
|
|
971
962
|
const stats = flags.stats ?? viteAlephaBuildOptions.stats ?? false;
|
|
963
|
+
const hasServer = viteAlephaBuildOptions.serverEntry !== false;
|
|
972
964
|
let hasClient = false;
|
|
973
965
|
try {
|
|
974
966
|
await access(join(root, "index.html"));
|
|
@@ -997,7 +989,7 @@ var ViteCommands = class {
|
|
|
997
989
|
clientDir: clientBuilt ? clientDir : void 0,
|
|
998
990
|
stats
|
|
999
991
|
});
|
|
1000
|
-
if (clientBuilt) await unlink(`${distDir}/${clientDir}/index.html`);
|
|
992
|
+
if (clientBuilt && hasServer) await unlink(`${distDir}/${clientDir}/index.html`);
|
|
1001
993
|
}
|
|
1002
994
|
});
|
|
1003
995
|
await run({
|
|
@@ -1064,7 +1056,7 @@ var ViteCommands = class {
|
|
|
1064
1056
|
viteConfigTs: true
|
|
1065
1057
|
});
|
|
1066
1058
|
try {
|
|
1067
|
-
await import("./dist-
|
|
1059
|
+
await import("./dist-lGnqsKpu.js");
|
|
1068
1060
|
} catch {
|
|
1069
1061
|
this.log.error("Vitest is not installed. Please install it with `npm install -D vitest` or `yarn add -D vitest`.");
|
|
1070
1062
|
process.exit(1);
|
|
@@ -1076,9 +1068,24 @@ var ViteCommands = class {
|
|
|
1076
1068
|
|
|
1077
1069
|
//#endregion
|
|
1078
1070
|
//#region src/cli/apps/AlephaCli.ts
|
|
1071
|
+
var AlephaCliExtension = class {
|
|
1072
|
+
alepha = $inject(Alepha);
|
|
1073
|
+
fs = $inject(FileSystemProvider);
|
|
1074
|
+
onConfigure = $hook({
|
|
1075
|
+
on: "configure",
|
|
1076
|
+
handler: async () => {
|
|
1077
|
+
const extensionPath = join(process.cwd(), "alepha.config.ts");
|
|
1078
|
+
if (!await this.fs.exists(extensionPath)) return;
|
|
1079
|
+
const { default: Extension } = await import(extensionPath);
|
|
1080
|
+
if (typeof Extension !== "function") return;
|
|
1081
|
+
this.alepha.with(Extension);
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
};
|
|
1079
1085
|
const AlephaCli = $module({
|
|
1080
1086
|
name: "alepha.cli",
|
|
1081
1087
|
services: [
|
|
1088
|
+
AlephaCliExtension,
|
|
1082
1089
|
ProcessRunner,
|
|
1083
1090
|
CoreCommands,
|
|
1084
1091
|
DrizzleCommands,
|
|
@@ -1109,9 +1116,11 @@ var AlephaPackageBuilderCli = class {
|
|
|
1109
1116
|
const path = item.name === "core" ? "." : `./${item.name.replace("-", "/")}`;
|
|
1110
1117
|
pkgData.exports[path] = {};
|
|
1111
1118
|
pkgData.exports[path].types = `./src/${item.name}/index.ts`;
|
|
1119
|
+
if (item.native) pkgData.exports[path]["react-native"] = `./src/${item.name}/index.native.ts`;
|
|
1120
|
+
else if (item.browser) pkgData.exports[path]["react-native"] = `./src/${item.name}/index.browser.ts`;
|
|
1112
1121
|
if (item.browser) pkgData.exports[path].browser = `./src/${item.name}/index.browser.ts`;
|
|
1113
1122
|
pkgData.exports[path].import = `./src/${item.name}/index.ts`;
|
|
1114
|
-
pkgData.exports[path].
|
|
1123
|
+
pkgData.exports[path].default = `./src/${item.name}/index.ts`;
|
|
1115
1124
|
}
|
|
1116
1125
|
if (packageName === "alepha") {
|
|
1117
1126
|
pkgData.exports["./tsconfig.base"] = "./tsconfig.base.json";
|
|
@@ -1125,7 +1134,7 @@ var AlephaPackageBuilderCli = class {
|
|
|
1125
1134
|
const external = [
|
|
1126
1135
|
"alepha",
|
|
1127
1136
|
packageName,
|
|
1128
|
-
...modules.map((item) => `${packageName}/${item.name}`)
|
|
1137
|
+
...modules.map((item) => `${packageName}/${item.name.replace("-", "/")}`)
|
|
1129
1138
|
];
|
|
1130
1139
|
await run.rm(this.dist);
|
|
1131
1140
|
const build = async (item) => {
|
|
@@ -1141,6 +1150,14 @@ var AlephaPackageBuilderCli = class {
|
|
|
1141
1150
|
platform: "node",
|
|
1142
1151
|
external
|
|
1143
1152
|
});
|
|
1153
|
+
if (item.native) entries.push({
|
|
1154
|
+
entry: join(src, "index.native.ts"),
|
|
1155
|
+
outDir: dest,
|
|
1156
|
+
platform: "neutral",
|
|
1157
|
+
sourcemap: true,
|
|
1158
|
+
dts: false,
|
|
1159
|
+
external
|
|
1160
|
+
});
|
|
1144
1161
|
if (item.browser) entries.push({
|
|
1145
1162
|
entry: join(src, "index.browser.ts"),
|
|
1146
1163
|
outDir: dest,
|
|
@@ -1235,6 +1252,7 @@ async function analyzeModules(srcDir, packageName) {
|
|
|
1235
1252
|
const modulePath = join(srcDir, moduleName);
|
|
1236
1253
|
const dependencies = /* @__PURE__ */ new Set();
|
|
1237
1254
|
const hasBrowser = await fileExists(join(modulePath, "index.browser.ts"));
|
|
1255
|
+
const hasNative = await fileExists(join(modulePath, "index.native.ts"));
|
|
1238
1256
|
const hasNode = await fileExists(join(modulePath, "index.node.ts"));
|
|
1239
1257
|
const files = await getAllFiles(modulePath);
|
|
1240
1258
|
for (const file of files) {
|
|
@@ -1249,6 +1267,7 @@ async function analyzeModules(srcDir, packageName) {
|
|
|
1249
1267
|
name: moduleName,
|
|
1250
1268
|
dependencies: Array.from(dependencies)
|
|
1251
1269
|
};
|
|
1270
|
+
if (hasNative) module.native = true;
|
|
1252
1271
|
if (hasBrowser) module.browser = true;
|
|
1253
1272
|
if (hasNode) module.node = true;
|
|
1254
1273
|
modules.push(module);
|