alepha 0.13.2 → 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/dist/api-files/index.browser.js +80 -0
- package/dist/api-files/index.browser.js.map +1 -0
- package/dist/api-jobs/index.browser.js +56 -0
- package/dist/api-jobs/index.browser.js.map +1 -0
- 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 +124 -69
- package/dist/api-notifications/index.js +107 -55
- 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-users/index.d.ts +16 -3
- package/dist/api-users/index.js +75 -28
- 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 +117 -95
- package/dist/api-verifications/index.js +1 -1
- package/dist/api-verifications/index.js.map +1 -1
- package/dist/batch/index.js +0 -5
- package/dist/batch/index.js.map +1 -1
- package/dist/bucket/index.js +7 -5
- package/dist/bucket/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 +26 -45
- package/dist/cli/index.js +40 -58
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +1 -0
- package/dist/command/index.js +9 -0
- package/dist/command/index.js.map +1 -1
- package/dist/email/index.js +5 -0
- package/dist/email/index.js.map +1 -1
- package/dist/orm/index.js +3 -3
- package/dist/orm/index.js.map +1 -1
- package/dist/redis/index.d.ts +10 -10
- package/dist/security/index.d.ts +28 -28
- package/dist/security/index.js +3 -3
- package/dist/security/index.js.map +1 -1
- package/dist/server/index.d.ts +9 -9
- package/dist/server-auth/index.d.ts +152 -152
- package/dist/server-cookies/index.js +2 -2
- package/dist/server-cookies/index.js.map +1 -1
- package/dist/server-links/index.d.ts +33 -33
- package/dist/server-static/index.js +18 -2
- package/dist/server-static/index.js.map +1 -1
- package/package.json +16 -6
- package/src/api-files/index.browser.ts +17 -0
- package/src/api-jobs/index.browser.ts +15 -0
- package/src/api-notifications/controllers/NotificationController.ts +26 -1
- package/src/api-notifications/index.browser.ts +17 -0
- package/src/api-notifications/index.ts +1 -0
- package/src/api-notifications/schemas/notificationQuerySchema.ts +13 -0
- package/src/api-notifications/services/NotificationService.ts +45 -2
- package/src/api-parameters/index.browser.ts +12 -0
- package/src/api-users/atoms/realmAuthSettingsAtom.ts +3 -1
- package/src/api-users/controllers/UserController.ts +21 -1
- package/src/api-users/primitives/$userRealm.ts +33 -10
- package/src/api-users/providers/UserRealmProvider.ts +1 -0
- 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/providers/BatchProvider.ts +0 -7
- package/src/bucket/index.ts +7 -5
- package/src/cli/apps/AlephaCli.ts +27 -1
- package/src/cli/apps/AlephaPackageBuilderCli.ts +3 -0
- package/src/cli/commands/CoreCommands.ts +6 -2
- package/src/cli/commands/ViteCommands.ts +2 -1
- package/src/cli/services/ProjectUtils.ts +40 -75
- package/src/command/helpers/Asker.ts +10 -0
- package/src/email/index.ts +13 -5
- package/src/orm/providers/drivers/NodeSqliteProvider.ts +3 -3
- package/src/server-cookies/providers/ServerCookiesProvider.ts +2 -1
- package/src/server-static/providers/ServerStaticProvider.ts +18 -3
- package/dist/cli/dist-Dl9Vl7Ur.js.map +0 -1
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
|
|
3
|
+
import { FileSystemProvider } from "alepha/file";
|
|
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>;
|
|
@@ -20,7 +20,7 @@ declare class AlephaPackageBuilderCli {
|
|
|
20
20
|
src: string;
|
|
21
21
|
dist: string;
|
|
22
22
|
fs: FileSystemProvider;
|
|
23
|
-
make:
|
|
23
|
+
make: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
24
24
|
}
|
|
25
25
|
declare function analyzeModules(srcDir: string, packageName: string): Promise<Module[]>;
|
|
26
26
|
//#endregion
|
|
@@ -124,16 +124,6 @@ declare class ProjectUtils {
|
|
|
124
124
|
indexHtml?: boolean;
|
|
125
125
|
biomeJson?: boolean;
|
|
126
126
|
}): Promise<void>;
|
|
127
|
-
/**
|
|
128
|
-
* Ensure package.json exists and is configured as ES module.
|
|
129
|
-
*
|
|
130
|
-
* Similar to ensurePackageJson but only validates/sets the "type": "module" field.
|
|
131
|
-
* Throws an error if no package.json exists.
|
|
132
|
-
*
|
|
133
|
-
* @param root - The root directory of the project
|
|
134
|
-
* @throws {AlephaError} If no package.json is found
|
|
135
|
-
*/
|
|
136
|
-
ensurePackageJsonModule(root: string): Promise<void>;
|
|
137
127
|
/**
|
|
138
128
|
* Ensure tsconfig.json exists in the project.
|
|
139
129
|
*
|
|
@@ -147,7 +137,8 @@ declare class ProjectUtils {
|
|
|
147
137
|
*
|
|
148
138
|
* Creates a standard Alepha vite.config.ts if none exists.
|
|
149
139
|
*/
|
|
150
|
-
ensureViteConfig(root: string): Promise<void>;
|
|
140
|
+
ensureViteConfig(root: string, serverEntry?: string): Promise<void>;
|
|
141
|
+
protected checkFileExists(root: string, name: string, checkParentDirectories?: boolean): Promise<boolean>;
|
|
151
142
|
protected ensureFileExists(root: string, name: string, content: string, checkParentDirectories?: boolean): Promise<void>;
|
|
152
143
|
/**
|
|
153
144
|
* Get the path to Biome configuration file.
|
|
@@ -155,16 +146,6 @@ declare class ProjectUtils {
|
|
|
155
146
|
* Looks for an existing biome.json in the project root, or creates one if it doesn't exist.
|
|
156
147
|
*/
|
|
157
148
|
ensureBiomeConfig(root: string): Promise<void>;
|
|
158
|
-
/**
|
|
159
|
-
* Get the path to Vite configuration file.
|
|
160
|
-
*
|
|
161
|
-
* Looks for an existing vite.config.ts in the project root, or creates one if it doesn't exist.
|
|
162
|
-
*
|
|
163
|
-
* @param root - The root directory of the project (defaults to process.cwd())
|
|
164
|
-
* @param serverEntry - Optional path to the server entry file to include in the config
|
|
165
|
-
* @returns Absolute path to the vite.config.ts file
|
|
166
|
-
*/
|
|
167
|
-
getViteConfigPath(root: string, serverEntry?: string): Promise<string>;
|
|
168
149
|
/**
|
|
169
150
|
* Load Alepha instance from a server entry file.
|
|
170
151
|
*
|
|
@@ -234,7 +215,7 @@ declare class ProjectUtils {
|
|
|
234
215
|
}
|
|
235
216
|
interface DependencyModes {
|
|
236
217
|
react?: boolean;
|
|
237
|
-
|
|
218
|
+
ui?: boolean;
|
|
238
219
|
}
|
|
239
220
|
//#endregion
|
|
240
221
|
//#region src/cli/commands/BiomeCommands.d.ts
|
|
@@ -242,8 +223,8 @@ declare class BiomeCommands {
|
|
|
242
223
|
protected readonly log: alepha_logger4.Logger;
|
|
243
224
|
protected readonly runner: ProcessRunner;
|
|
244
225
|
protected readonly utils: ProjectUtils;
|
|
245
|
-
readonly format:
|
|
246
|
-
readonly lint:
|
|
226
|
+
readonly format: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
227
|
+
readonly lint: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
247
228
|
}
|
|
248
229
|
//#endregion
|
|
249
230
|
//#region src/cli/commands/CoreCommands.d.ts
|
|
@@ -254,22 +235,22 @@ declare class CoreCommands {
|
|
|
254
235
|
/**
|
|
255
236
|
* Called when no command is provided
|
|
256
237
|
*/
|
|
257
|
-
readonly root:
|
|
238
|
+
readonly root: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
258
239
|
version: alepha0.TOptional<alepha0.TBoolean>;
|
|
259
240
|
}>, alepha0.TSchema>;
|
|
260
241
|
/**
|
|
261
242
|
* Clean the project, removing the "dist" directory
|
|
262
243
|
*/
|
|
263
|
-
readonly clean:
|
|
244
|
+
readonly clean: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
264
245
|
/**
|
|
265
246
|
* Ensure the project has the necessary Alepha configuration files.
|
|
266
247
|
* Add the correct dependencies to package.json and install them.
|
|
267
248
|
*/
|
|
268
|
-
readonly init:
|
|
249
|
+
readonly init: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
269
250
|
yarn: alepha0.TOptional<alepha0.TBoolean>;
|
|
270
251
|
pnpm: alepha0.TOptional<alepha0.TBoolean>;
|
|
271
252
|
react: alepha0.TOptional<alepha0.TBoolean>;
|
|
272
|
-
|
|
253
|
+
ui: alepha0.TOptional<alepha0.TBoolean>;
|
|
273
254
|
}>, alepha0.TSchema>;
|
|
274
255
|
}
|
|
275
256
|
//#endregion
|
|
@@ -281,7 +262,7 @@ declare class DrizzleCommands {
|
|
|
281
262
|
/**
|
|
282
263
|
* Check if database migrations are up to date.
|
|
283
264
|
*/
|
|
284
|
-
check:
|
|
265
|
+
check: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
285
266
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
286
267
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
287
268
|
/**
|
|
@@ -293,7 +274,7 @@ declare class DrizzleCommands {
|
|
|
293
274
|
* - Writes these definitions to a temporary schema file. (node_modules/.db/entities.ts)
|
|
294
275
|
* - Invokes Drizzle Kit's CLI to generate migration files based on the current schema.
|
|
295
276
|
*/
|
|
296
|
-
generate:
|
|
277
|
+
generate: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
297
278
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
298
279
|
custom: alepha0.TOptional<alepha0.TString>;
|
|
299
280
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
@@ -305,7 +286,7 @@ declare class DrizzleCommands {
|
|
|
305
286
|
* - Creates temporary entity definitions and Drizzle config.
|
|
306
287
|
* - Invokes Drizzle Kit's push command to apply schema changes directly.
|
|
307
288
|
*/
|
|
308
|
-
push:
|
|
289
|
+
push: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
309
290
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
310
291
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
311
292
|
/**
|
|
@@ -316,7 +297,7 @@ declare class DrizzleCommands {
|
|
|
316
297
|
* - Creates temporary entity definitions and Drizzle config.
|
|
317
298
|
* - Invokes Drizzle Kit's migrate command to apply pending migrations.
|
|
318
299
|
*/
|
|
319
|
-
migrate:
|
|
300
|
+
migrate: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
320
301
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
321
302
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
322
303
|
/**
|
|
@@ -327,7 +308,7 @@ declare class DrizzleCommands {
|
|
|
327
308
|
* - Creates temporary entity definitions and Drizzle config.
|
|
328
309
|
* - Invokes Drizzle Kit's studio command to launch the web-based database browser.
|
|
329
310
|
*/
|
|
330
|
-
studio:
|
|
311
|
+
studio: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
331
312
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
332
313
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
333
314
|
/**
|
|
@@ -335,7 +316,7 @@ declare class DrizzleCommands {
|
|
|
335
316
|
*
|
|
336
317
|
* @experimental
|
|
337
318
|
*/
|
|
338
|
-
drop:
|
|
319
|
+
drop: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
339
320
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
340
321
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
341
322
|
/**
|
|
@@ -343,7 +324,7 @@ declare class DrizzleCommands {
|
|
|
343
324
|
*
|
|
344
325
|
* @experimental
|
|
345
326
|
*/
|
|
346
|
-
seed:
|
|
327
|
+
seed: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
347
328
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
348
329
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
349
330
|
/**
|
|
@@ -351,7 +332,7 @@ declare class DrizzleCommands {
|
|
|
351
332
|
*
|
|
352
333
|
* @experimental
|
|
353
334
|
*/
|
|
354
|
-
status:
|
|
335
|
+
status: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
355
336
|
provider: alepha0.TOptional<alepha0.TString>;
|
|
356
337
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
357
338
|
}
|
|
@@ -373,11 +354,11 @@ declare class VerifyCommands {
|
|
|
373
354
|
* - Build the project
|
|
374
355
|
* - Clean the project again
|
|
375
356
|
*/
|
|
376
|
-
readonly verify:
|
|
357
|
+
readonly verify: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
377
358
|
/**
|
|
378
359
|
* Run TypeScript type checking across the codebase with no emit.
|
|
379
360
|
*/
|
|
380
|
-
readonly typecheck:
|
|
361
|
+
readonly typecheck: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
381
362
|
}
|
|
382
363
|
//#endregion
|
|
383
364
|
//#region src/cli/commands/ViteCommands.d.ts
|
|
@@ -388,7 +369,7 @@ declare class ViteCommands {
|
|
|
388
369
|
protected readonly env: {
|
|
389
370
|
VITEST_ARGS: string;
|
|
390
371
|
};
|
|
391
|
-
readonly run:
|
|
372
|
+
readonly run: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
392
373
|
watch: alepha0.TOptional<alepha0.TBoolean>;
|
|
393
374
|
}>, alepha0.TString>;
|
|
394
375
|
/**
|
|
@@ -397,8 +378,8 @@ declare class ViteCommands {
|
|
|
397
378
|
* - If an index.html file is found in the project root, it will run Vite in dev mode.
|
|
398
379
|
* - Otherwise, it will look for a server entry file and run it with tsx in watch mode.
|
|
399
380
|
*/
|
|
400
|
-
readonly dev:
|
|
401
|
-
readonly build:
|
|
381
|
+
readonly dev: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TOptional<alepha0.TString>>;
|
|
382
|
+
readonly build: alepha_command0.CommandPrimitive<alepha0.TObject<{
|
|
402
383
|
stats: alepha0.TOptional<alepha0.TBoolean>;
|
|
403
384
|
vercel: alepha0.TOptional<alepha0.TBoolean>;
|
|
404
385
|
cloudflare: alepha0.TOptional<alepha0.TBoolean>;
|
|
@@ -406,7 +387,7 @@ declare class ViteCommands {
|
|
|
406
387
|
sitemap: alepha0.TOptional<alepha0.TString>;
|
|
407
388
|
prerender: alepha0.TOptional<alepha0.TBoolean>;
|
|
408
389
|
}>, alepha0.TOptional<alepha0.TString>>;
|
|
409
|
-
readonly test:
|
|
390
|
+
readonly test: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
|
|
410
391
|
}
|
|
411
392
|
//#endregion
|
|
412
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.
|
|
@@ -509,9 +473,9 @@ ${models.map((it) => `export const ${it} = models["${it}"];`).join("\n")}
|
|
|
509
473
|
}
|
|
510
474
|
}
|
|
511
475
|
async getPackageManager(root) {
|
|
512
|
-
if (await this.
|
|
513
|
-
|
|
514
|
-
|
|
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";
|
|
515
479
|
}
|
|
516
480
|
async ensureIndexHtml(root) {
|
|
517
481
|
if (await this.fs.exists(join(root, "index.html"))) return;
|
|
@@ -603,9 +567,10 @@ var CoreCommands = class {
|
|
|
603
567
|
yarn: t.optional(t.boolean({ description: "Use Yarn package manager" })),
|
|
604
568
|
pnpm: t.optional(t.boolean({ description: "Use pnpm package manager" })),
|
|
605
569
|
react: t.optional(t.boolean({ description: "Include Alepha React dependencies" })),
|
|
606
|
-
|
|
570
|
+
ui: t.optional(t.boolean({ description: "Include Alepha UI dependencies" }))
|
|
607
571
|
}),
|
|
608
572
|
handler: async ({ run, flags, root }) => {
|
|
573
|
+
if (flags.ui) flags.react = true;
|
|
609
574
|
await run({
|
|
610
575
|
name: "Ensuring configuration files",
|
|
611
576
|
handler: async () => {
|
|
@@ -995,6 +960,7 @@ var ViteCommands = class {
|
|
|
995
960
|
await run.rm("dist", { alias: "clean dist" });
|
|
996
961
|
const viteAlephaBuildOptions = (await import(join(root, "vite.config.ts")))?.default?.plugins.find((it) => !!it[OPTIONS])?.[OPTIONS] ?? {};
|
|
997
962
|
const stats = flags.stats ?? viteAlephaBuildOptions.stats ?? false;
|
|
963
|
+
const hasServer = viteAlephaBuildOptions.serverEntry !== false;
|
|
998
964
|
let hasClient = false;
|
|
999
965
|
try {
|
|
1000
966
|
await access(join(root, "index.html"));
|
|
@@ -1023,7 +989,7 @@ var ViteCommands = class {
|
|
|
1023
989
|
clientDir: clientBuilt ? clientDir : void 0,
|
|
1024
990
|
stats
|
|
1025
991
|
});
|
|
1026
|
-
if (clientBuilt) await unlink(`${distDir}/${clientDir}/index.html`);
|
|
992
|
+
if (clientBuilt && hasServer) await unlink(`${distDir}/${clientDir}/index.html`);
|
|
1027
993
|
}
|
|
1028
994
|
});
|
|
1029
995
|
await run({
|
|
@@ -1090,7 +1056,7 @@ var ViteCommands = class {
|
|
|
1090
1056
|
viteConfigTs: true
|
|
1091
1057
|
});
|
|
1092
1058
|
try {
|
|
1093
|
-
await import("./dist-
|
|
1059
|
+
await import("./dist-lGnqsKpu.js");
|
|
1094
1060
|
} catch {
|
|
1095
1061
|
this.log.error("Vitest is not installed. Please install it with `npm install -D vitest` or `yarn add -D vitest`.");
|
|
1096
1062
|
process.exit(1);
|
|
@@ -1102,9 +1068,24 @@ var ViteCommands = class {
|
|
|
1102
1068
|
|
|
1103
1069
|
//#endregion
|
|
1104
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
|
+
};
|
|
1105
1085
|
const AlephaCli = $module({
|
|
1106
1086
|
name: "alepha.cli",
|
|
1107
1087
|
services: [
|
|
1088
|
+
AlephaCliExtension,
|
|
1108
1089
|
ProcessRunner,
|
|
1109
1090
|
CoreCommands,
|
|
1110
1091
|
DrizzleCommands,
|
|
@@ -1139,6 +1120,7 @@ var AlephaPackageBuilderCli = class {
|
|
|
1139
1120
|
else if (item.browser) pkgData.exports[path]["react-native"] = `./src/${item.name}/index.browser.ts`;
|
|
1140
1121
|
if (item.browser) pkgData.exports[path].browser = `./src/${item.name}/index.browser.ts`;
|
|
1141
1122
|
pkgData.exports[path].import = `./src/${item.name}/index.ts`;
|
|
1123
|
+
pkgData.exports[path].default = `./src/${item.name}/index.ts`;
|
|
1142
1124
|
}
|
|
1143
1125
|
if (packageName === "alepha") {
|
|
1144
1126
|
pkgData.exports["./tsconfig.base"] = "./tsconfig.base.json";
|