@holo-js/cli 0.1.9 → 0.2.0
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/bin/holo.mjs +165 -81
- package/dist/broadcast-WI6PJS5P.mjs +203 -0
- package/dist/broadcast-YWS4N5QU.mjs +203 -0
- package/dist/{cache-ETOIQ5IG.mjs → cache-KWNQECAA.mjs} +6 -6
- package/dist/cache-QARFSW4F.mjs +66 -0
- package/dist/{cache-migrations-2GGI4TJK.mjs → cache-migrations-3OXR4FN5.mjs} +50 -30
- package/dist/cache-migrations-MDFMDVTK.mjs +173 -0
- package/dist/{chunk-IMOGEKB4.mjs → chunk-2DKQKZML.mjs} +188 -106
- package/dist/{chunk-7JR73TOH.mjs → chunk-2RGJTPYF.mjs} +36 -25
- package/dist/{chunk-ASTSSSL2.mjs → chunk-EWYXSN2C.mjs} +75 -122
- package/dist/{chunk-F4MT6GBK.mjs → chunk-FGQ2I2YH.mjs} +1 -1
- package/dist/chunk-I7QBCEV7.mjs +33 -0
- package/dist/{chunk-R6BWRY3E.mjs → chunk-ILU426CF.mjs} +3 -1
- package/dist/{chunk-HB4Q7VYK.mjs → chunk-IUDD5FYL.mjs} +28 -273
- package/dist/{chunk-WRZFATUT.mjs → chunk-KWRIBHC3.mjs} +229 -142
- package/dist/{chunk-57SJ566R.mjs → chunk-LBJAJLKU.mjs} +1 -1
- package/dist/{chunk-BAFQ2GOA.mjs → chunk-LXGQCG56.mjs} +1 -1
- package/dist/{chunk-SRPGIWCF.mjs → chunk-ONKESAQA.mjs} +2 -2
- package/dist/chunk-QA7TP5EO.mjs +448 -0
- package/dist/chunk-UPZH6KCF.mjs +3306 -0
- package/dist/{chunk-5EU32E7X.mjs → chunk-VRGB6DIS.mjs} +116 -12
- package/dist/{config-ARLE6PKR.mjs → config-TWEO2R4N.mjs} +3 -3
- package/dist/{dev-6RG5SSZ7.mjs → dev-2OULECTU.mjs} +7 -7
- package/dist/dev-PJMEGTAC.mjs +42 -0
- package/dist/{discovery-FCVGQQVD.mjs → discovery-7FXND7Y6.mjs} +3 -3
- package/dist/{generators-UI2LJK3O.mjs → generators-4BP7B47W.mjs} +11 -34
- package/dist/generators-Z4XLSMC7.mjs +520 -0
- package/dist/index.mjs +167 -83
- package/dist/{media-migrations-JQSDCC7S.mjs → media-migrations-BFEL7NFG.mjs} +9 -20
- package/dist/media-migrations-VR7DLLR6.mjs +106 -0
- package/dist/{queue-BY3PLH4I.mjs → queue-SVOJPTRO.mjs} +10 -10
- package/dist/queue-YCBQTCYI.mjs +625 -0
- package/dist/{queue-migrations-YZUKEZK7.mjs → queue-migrations-HPXOO3NA.mjs} +13 -12
- package/dist/queue-migrations-X4P7FZKJ.mjs +167 -0
- package/dist/{runtime-BI343WHS.mjs → runtime-CPKR663Y.mjs} +9 -9
- package/dist/runtime-GIE56H47.mjs +57 -0
- package/dist/{runtime-ZKD6URAV.mjs → runtime-GSXF4NB3.mjs} +1 -1
- package/dist/runtime-worker.d.ts +2 -0
- package/dist/runtime-worker.mjs +242 -0
- package/dist/{scaffold-UBOS2NZR.mjs → scaffold-3QPGYQEQ.mjs} +9 -5
- package/dist/scaffold-RGAAHC6I.mjs +139 -0
- package/dist/{security-TYPVOYGF.mjs → security-7H5TNHZY.mjs} +6 -6
- package/dist/security-BZGD6ONY.mjs +71 -0
- package/package.json +9 -7
- package/dist/broadcast-VR46UZEL.mjs +0 -84
- package/dist/chunk-ZXDU7RHU.mjs +0 -9
package/dist/index.mjs
CHANGED
|
@@ -3,35 +3,38 @@ import {
|
|
|
3
3
|
SUPPORTED_INSTALL_TARGETS,
|
|
4
4
|
SUPPORTED_QUEUE_INSTALL_DRIVERS,
|
|
5
5
|
collectMultiStringFlag,
|
|
6
|
-
confirm,
|
|
7
6
|
ensureRequiredArg,
|
|
8
7
|
isInteractive,
|
|
9
8
|
normalizeChoice,
|
|
10
9
|
normalizeOptionalPackages,
|
|
11
10
|
parseNumberFlag,
|
|
12
11
|
parseTokens,
|
|
12
|
+
promptChoice,
|
|
13
|
+
promptMultiChoice,
|
|
13
14
|
resolveBooleanFlag,
|
|
14
15
|
resolveNewProjectInput,
|
|
15
16
|
resolveStringFlag,
|
|
16
17
|
splitCsv
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-VRGB6DIS.mjs";
|
|
18
19
|
import {
|
|
19
20
|
hasProjectDependency
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
writeLine
|
|
23
|
-
} from "./chunk-ZXDU7RHU.mjs";
|
|
21
|
+
} from "./chunk-FGQ2I2YH.mjs";
|
|
24
22
|
import {
|
|
25
23
|
fileExists
|
|
26
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-LBJAJLKU.mjs";
|
|
25
|
+
import {
|
|
26
|
+
runWithSpinner,
|
|
27
|
+
supportsSpinner,
|
|
28
|
+
writeLine
|
|
29
|
+
} from "./chunk-I7QBCEV7.mjs";
|
|
27
30
|
import "./chunk-D7O4SU6N.mjs";
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-2RGJTPYF.mjs";
|
|
32
|
+
import "./chunk-KWRIBHC3.mjs";
|
|
33
|
+
import "./chunk-ONKESAQA.mjs";
|
|
34
|
+
import "./chunk-2DKQKZML.mjs";
|
|
32
35
|
import {
|
|
33
36
|
SUPPORTED_AUTH_SOCIAL_PROVIDERS
|
|
34
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-ILU426CF.mjs";
|
|
35
38
|
|
|
36
39
|
// src/types.ts
|
|
37
40
|
function defineCommand(command) {
|
|
@@ -109,6 +112,10 @@ async function generateProjectAppKey(projectRoot) {
|
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
// src/cli.ts
|
|
115
|
+
var AUTH_INSTALL_FEATURES = ["social", "workos", "clerk"];
|
|
116
|
+
var AUTH_SOCIAL_PROVIDER_MODES = ["default", "specific"];
|
|
117
|
+
var EVENTS_QUEUE_ACTIONS = ["skip", "enable"];
|
|
118
|
+
var MODEL_GENERATOR_OPTIONS = ["migration", "observer", "seeder", "factory"];
|
|
112
119
|
var runtimeModulePromise;
|
|
113
120
|
var queueModulePromise;
|
|
114
121
|
var cacheModulePromise;
|
|
@@ -124,59 +131,59 @@ var projectDiscoveryModulePromise;
|
|
|
124
131
|
var projectRuntimeModulePromise;
|
|
125
132
|
var projectScaffoldModulePromise;
|
|
126
133
|
function loadRuntimeModule() {
|
|
127
|
-
runtimeModulePromise ??= import("./runtime-
|
|
134
|
+
runtimeModulePromise ??= import("./runtime-GIE56H47.mjs");
|
|
128
135
|
return runtimeModulePromise;
|
|
129
136
|
}
|
|
130
137
|
function loadQueueModule() {
|
|
131
|
-
queueModulePromise ??= import("./queue-
|
|
138
|
+
queueModulePromise ??= import("./queue-YCBQTCYI.mjs");
|
|
132
139
|
return queueModulePromise;
|
|
133
140
|
}
|
|
134
141
|
function loadCacheModule() {
|
|
135
|
-
cacheModulePromise ??= import("./cache-
|
|
142
|
+
cacheModulePromise ??= import("./cache-KWNQECAA.mjs");
|
|
136
143
|
return cacheModulePromise;
|
|
137
144
|
}
|
|
138
145
|
function loadQueueMigrationsModule() {
|
|
139
|
-
queueMigrationsModulePromise ??= import("./queue-migrations-
|
|
146
|
+
queueMigrationsModulePromise ??= import("./queue-migrations-X4P7FZKJ.mjs");
|
|
140
147
|
return queueMigrationsModulePromise;
|
|
141
148
|
}
|
|
142
149
|
function loadCacheMigrationsModule() {
|
|
143
|
-
cacheMigrationsModulePromise ??= import("./cache-migrations-
|
|
150
|
+
cacheMigrationsModulePromise ??= import("./cache-migrations-MDFMDVTK.mjs");
|
|
144
151
|
return cacheMigrationsModulePromise;
|
|
145
152
|
}
|
|
146
153
|
function loadMediaMigrationsModule() {
|
|
147
|
-
mediaMigrationsModulePromise ??= import("./media-migrations-
|
|
154
|
+
mediaMigrationsModulePromise ??= import("./media-migrations-BFEL7NFG.mjs");
|
|
148
155
|
return mediaMigrationsModulePromise;
|
|
149
156
|
}
|
|
150
157
|
function loadGeneratorsModule() {
|
|
151
|
-
generatorsModulePromise ??= import("./generators-
|
|
158
|
+
generatorsModulePromise ??= import("./generators-Z4XLSMC7.mjs");
|
|
152
159
|
return generatorsModulePromise;
|
|
153
160
|
}
|
|
154
161
|
function loadBroadcastModule() {
|
|
155
|
-
broadcastModulePromise ??= import("./broadcast-
|
|
162
|
+
broadcastModulePromise ??= import("./broadcast-WI6PJS5P.mjs");
|
|
156
163
|
return broadcastModulePromise;
|
|
157
164
|
}
|
|
158
165
|
function loadSecurityModule() {
|
|
159
|
-
securityModulePromise ??= import("./security-
|
|
166
|
+
securityModulePromise ??= import("./security-BZGD6ONY.mjs");
|
|
160
167
|
return securityModulePromise;
|
|
161
168
|
}
|
|
162
169
|
function loadDevModule() {
|
|
163
|
-
devModulePromise ??= import("./dev-
|
|
170
|
+
devModulePromise ??= import("./dev-PJMEGTAC.mjs");
|
|
164
171
|
return devModulePromise;
|
|
165
172
|
}
|
|
166
173
|
function loadProjectConfigModule() {
|
|
167
|
-
projectConfigModulePromise ??= import("./config-
|
|
174
|
+
projectConfigModulePromise ??= import("./config-TWEO2R4N.mjs");
|
|
168
175
|
return projectConfigModulePromise;
|
|
169
176
|
}
|
|
170
177
|
function loadProjectDiscoveryModule() {
|
|
171
|
-
projectDiscoveryModulePromise ??= import("./discovery-
|
|
178
|
+
projectDiscoveryModulePromise ??= import("./discovery-7FXND7Y6.mjs");
|
|
172
179
|
return projectDiscoveryModulePromise;
|
|
173
180
|
}
|
|
174
181
|
function loadProjectRuntimeModule() {
|
|
175
|
-
projectRuntimeModulePromise ??= import("./runtime-
|
|
182
|
+
projectRuntimeModulePromise ??= import("./runtime-GSXF4NB3.mjs");
|
|
176
183
|
return projectRuntimeModulePromise;
|
|
177
184
|
}
|
|
178
185
|
function loadProjectScaffoldModule() {
|
|
179
|
-
projectScaffoldModulePromise ??= import("./scaffold-
|
|
186
|
+
projectScaffoldModulePromise ??= import("./scaffold-RGAAHC6I.mjs");
|
|
180
187
|
return projectScaffoldModulePromise;
|
|
181
188
|
}
|
|
182
189
|
async function resolveRuntimeExecutor(runtimeExecutor) {
|
|
@@ -188,12 +195,15 @@ var projectExecutorLoaders = {
|
|
|
188
195
|
runProjectLifecycleScript: async () => (await loadDevModule()).runProjectLifecycleScript,
|
|
189
196
|
runProjectDependencyInstall: async () => (await loadDevModule()).runProjectDependencyInstall
|
|
190
197
|
};
|
|
191
|
-
async function
|
|
192
|
-
const existing =
|
|
198
|
+
async function resolveExecutor(executors, loaders, key) {
|
|
199
|
+
const existing = executors[key];
|
|
193
200
|
if (existing) {
|
|
194
201
|
return existing;
|
|
195
202
|
}
|
|
196
|
-
return
|
|
203
|
+
return await loaders[key]();
|
|
204
|
+
}
|
|
205
|
+
async function resolveProjectExecutor(projectExecutors, key) {
|
|
206
|
+
return await resolveExecutor(projectExecutors, projectExecutorLoaders, key);
|
|
197
207
|
}
|
|
198
208
|
var queueExecutorLoaders = {
|
|
199
209
|
runQueueFailedTableCommand: async () => (await loadQueueMigrationsModule()).runQueueFailedTableCommand,
|
|
@@ -219,32 +229,16 @@ var broadcastExecutorLoaders = {
|
|
|
219
229
|
runBroadcastWorkCommand: async () => (await loadBroadcastModule()).runBroadcastWorkCommand
|
|
220
230
|
};
|
|
221
231
|
async function resolveQueueExecutor(queueExecutors, key) {
|
|
222
|
-
|
|
223
|
-
if (existing) {
|
|
224
|
-
return existing;
|
|
225
|
-
}
|
|
226
|
-
return queueExecutorLoaders[key]();
|
|
232
|
+
return await resolveExecutor(queueExecutors, queueExecutorLoaders, key);
|
|
227
233
|
}
|
|
228
234
|
async function resolveCacheExecutor(cacheExecutors, key) {
|
|
229
|
-
|
|
230
|
-
if (existing) {
|
|
231
|
-
return existing;
|
|
232
|
-
}
|
|
233
|
-
return cacheExecutorLoaders[key]();
|
|
235
|
+
return await resolveExecutor(cacheExecutors, cacheExecutorLoaders, key);
|
|
234
236
|
}
|
|
235
237
|
async function resolveMediaExecutor(mediaExecutors, key) {
|
|
236
|
-
|
|
237
|
-
if (existing) {
|
|
238
|
-
return existing;
|
|
239
|
-
}
|
|
240
|
-
return mediaExecutorLoaders[key]();
|
|
238
|
+
return await resolveExecutor(mediaExecutors, mediaExecutorLoaders, key);
|
|
241
239
|
}
|
|
242
240
|
async function resolveBroadcastExecutor(broadcastExecutors, key) {
|
|
243
|
-
|
|
244
|
-
if (existing) {
|
|
245
|
-
return existing;
|
|
246
|
-
}
|
|
247
|
-
return broadcastExecutorLoaders[key]();
|
|
241
|
+
return await resolveExecutor(broadcastExecutors, broadcastExecutorLoaders, key);
|
|
248
242
|
}
|
|
249
243
|
async function resolveGeneratorCommand(key) {
|
|
250
244
|
return (await loadGeneratorsModule())[key];
|
|
@@ -299,10 +293,12 @@ async function runProjectDependencyInstallAfterPackageJsonUpdate(context, projec
|
|
|
299
293
|
const runProjectPrepare = await resolveProjectExecutor(projectExecutors, "runProjectPrepare");
|
|
300
294
|
await runProjectPrepare(context.projectRoot, context);
|
|
301
295
|
}
|
|
302
|
-
async function runProjectDependencyInstallForProject(context, projectExecutors, projectRoot) {
|
|
296
|
+
async function runProjectDependencyInstallForProject(context, projectExecutors, projectRoot, options = {}) {
|
|
303
297
|
const runProjectDependencyInstall = await resolveProjectExecutor(projectExecutors, "runProjectDependencyInstall");
|
|
304
298
|
await runProjectDependencyInstall(context, projectRoot);
|
|
305
|
-
|
|
299
|
+
if (options.writeStatus ?? true) {
|
|
300
|
+
writeLine(context.stdout, " - installed dependencies");
|
|
301
|
+
}
|
|
306
302
|
}
|
|
307
303
|
function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, projectExecutors = {}, broadcastExecutors = {}, securityExecutors = {}, cacheExecutors = {}, mediaExecutors = {}) {
|
|
308
304
|
return [
|
|
@@ -321,7 +317,7 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
|
|
|
321
317
|
{
|
|
322
318
|
name: "new",
|
|
323
319
|
description: "Scaffold a new Holo project",
|
|
324
|
-
usage: "holo new <name> [--framework <nuxt|next|sveltekit>] [--database <sqlite|mysql|postgres>] [--package-manager <bun|npm|pnpm|yarn>] [--package <storage|events|queue|validation|forms|auth|authorization|notifications|mail|broadcast|security|cache>] [--storage-default-disk <local|public>]",
|
|
320
|
+
usage: "holo new <name> [--framework <nuxt|next|sveltekit>] [--database <sqlite|mysql|postgres>] [--package-manager <bun|npm|pnpm|yarn>] [--package <storage|events|queue|validation|forms|auth|authorization|notifications|mail|broadcast|realtime|security|cache>] [--storage-default-disk <local|public>]",
|
|
325
321
|
source: "internal",
|
|
326
322
|
async prepare(input) {
|
|
327
323
|
const resolved = await resolveNewProjectInput(context, input);
|
|
@@ -347,16 +343,28 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
|
|
|
347
343
|
);
|
|
348
344
|
const targetDir = resolve2(commandContext.cwd, projectName);
|
|
349
345
|
const { scaffoldProject } = await loadProjectScaffoldModule();
|
|
350
|
-
await
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
346
|
+
await runWithSpinner(
|
|
347
|
+
context,
|
|
348
|
+
"Creating project files...",
|
|
349
|
+
() => scaffoldProject(targetDir, {
|
|
350
|
+
projectName,
|
|
351
|
+
framework,
|
|
352
|
+
databaseDriver,
|
|
353
|
+
packageManager,
|
|
354
|
+
storageDefaultDisk,
|
|
355
|
+
optionalPackages
|
|
356
|
+
}),
|
|
357
|
+
"Project files created."
|
|
358
|
+
);
|
|
358
359
|
writeLine(context.stdout, `Created Holo project: ${targetDir}`);
|
|
359
|
-
await
|
|
360
|
+
await runWithSpinner(
|
|
361
|
+
context,
|
|
362
|
+
"Installing dependencies...",
|
|
363
|
+
() => runProjectDependencyInstallForProject(context, projectExecutors, targetDir, {
|
|
364
|
+
writeStatus: !supportsSpinner(context)
|
|
365
|
+
}),
|
|
366
|
+
"Dependencies installed."
|
|
367
|
+
);
|
|
360
368
|
writeLine(context.stdout);
|
|
361
369
|
writeLine(context.stdout, "Next steps");
|
|
362
370
|
writeLine(context.stdout, ` cd ${projectName}`);
|
|
@@ -382,11 +390,13 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
|
|
|
382
390
|
{
|
|
383
391
|
name: "install",
|
|
384
392
|
description: "Install first-party Holo support into an existing project.",
|
|
385
|
-
usage: "holo install <queue|events|auth|authorization|notifications|mail|broadcast|security|cache|media> [--driver <queue: sync|file|redis|database; cache: file|redis|database>] [--social] [--provider <google|github|discord|facebook|apple|linkedin>] [--workos] [--clerk]",
|
|
393
|
+
usage: "holo install <queue|events|auth|authorization|notifications|mail|broadcast|realtime|security|cache|media> [--driver <queue: sync|file|redis|database; cache: file|redis|database>] [--social] [--provider <google|github|discord|facebook|apple|linkedin>] [--workos] [--clerk]",
|
|
386
394
|
source: "internal",
|
|
387
395
|
async prepare(input) {
|
|
396
|
+
const interactive = isInteractive(context, input.flags);
|
|
397
|
+
const requestedTarget = input.args[0]?.trim();
|
|
388
398
|
const target = normalizeChoice(
|
|
389
|
-
await ensureRequiredArg(context, input, 0, "Install target"),
|
|
399
|
+
requestedTarget || (interactive ? await promptChoice(context, "Install target", SUPPORTED_INSTALL_TARGETS, "queue") : await ensureRequiredArg(context, input, 0, "Install target")),
|
|
390
400
|
SUPPORTED_INSTALL_TARGETS,
|
|
391
401
|
"install target"
|
|
392
402
|
);
|
|
@@ -409,17 +419,65 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
|
|
|
409
419
|
if (target === "broadcast" && requestedDriver) {
|
|
410
420
|
throw new Error("The broadcast installer does not support --driver.");
|
|
411
421
|
}
|
|
422
|
+
if (target === "realtime" && requestedDriver) {
|
|
423
|
+
throw new Error("The realtime installer does not support --driver.");
|
|
424
|
+
}
|
|
412
425
|
if (target === "security" && requestedDriver) {
|
|
413
426
|
throw new Error("The security installer does not support --driver.");
|
|
414
427
|
}
|
|
415
428
|
if (target === "media" && requestedDriver) {
|
|
416
429
|
throw new Error("The media installer does not support --driver.");
|
|
417
430
|
}
|
|
418
|
-
const driver = target === "queue" ? requestedDriver ? normalizeChoice(requestedDriver, SUPPORTED_QUEUE_INSTALL_DRIVERS, "queue driver") : "sync" : target === "cache" ? requestedDriver ? normalizeChoice(requestedDriver, SUPPORTED_CACHE_INSTALL_DRIVERS, "cache driver") : "file" : void 0;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
431
|
+
const driver = target === "queue" ? requestedDriver ? normalizeChoice(requestedDriver, SUPPORTED_QUEUE_INSTALL_DRIVERS, "queue driver") : interactive ? await promptChoice(context, "Queue driver", SUPPORTED_QUEUE_INSTALL_DRIVERS, "sync") : "sync" : target === "cache" ? requestedDriver ? normalizeChoice(requestedDriver, SUPPORTED_CACHE_INSTALL_DRIVERS, "cache driver") : interactive ? await promptChoice(context, "Cache driver", SUPPORTED_CACHE_INSTALL_DRIVERS, "file") : "file" : void 0;
|
|
432
|
+
let socialProviders = target === "auth" ? (collectMultiStringFlag(input.flags, "provider") ?? []).flatMap((entry) => splitCsv(entry) ?? []).map((provider) => normalizeChoice(provider, SUPPORTED_AUTH_SOCIAL_PROVIDERS, "auth social provider")) : [];
|
|
433
|
+
let social = target === "auth" ? resolveBooleanFlag(input.flags, "social") === true || socialProviders.length > 0 : false;
|
|
434
|
+
let workos = target === "auth" ? resolveBooleanFlag(input.flags, "workos") === true : false;
|
|
435
|
+
let clerk = target === "auth" ? resolveBooleanFlag(input.flags, "clerk") === true : false;
|
|
436
|
+
const authFlagsProvided = "social" in input.flags || "provider" in input.flags || "workos" in input.flags || "clerk" in input.flags;
|
|
437
|
+
if (target === "auth" && interactive && !authFlagsProvided) {
|
|
438
|
+
const features = await promptMultiChoice(
|
|
439
|
+
context,
|
|
440
|
+
"Auth providers",
|
|
441
|
+
AUTH_INSTALL_FEATURES,
|
|
442
|
+
{
|
|
443
|
+
labels: {
|
|
444
|
+
social: "Social OAuth",
|
|
445
|
+
workos: "WorkOS",
|
|
446
|
+
clerk: "Clerk"
|
|
447
|
+
},
|
|
448
|
+
hints: {
|
|
449
|
+
social: "Google, GitHub, Discord, Facebook, Apple, or LinkedIn"
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
);
|
|
453
|
+
social = features.includes("social");
|
|
454
|
+
workos = features.includes("workos");
|
|
455
|
+
clerk = features.includes("clerk");
|
|
456
|
+
if (social) {
|
|
457
|
+
const providerMode = await promptChoice(
|
|
458
|
+
context,
|
|
459
|
+
"Social provider setup",
|
|
460
|
+
AUTH_SOCIAL_PROVIDER_MODES,
|
|
461
|
+
"default",
|
|
462
|
+
{
|
|
463
|
+
labels: {
|
|
464
|
+
default: "Default social setup",
|
|
465
|
+
specific: "Choose specific providers"
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
);
|
|
469
|
+
if (providerMode === "specific") {
|
|
470
|
+
socialProviders = [
|
|
471
|
+
...await promptMultiChoice(
|
|
472
|
+
context,
|
|
473
|
+
"Social providers",
|
|
474
|
+
SUPPORTED_AUTH_SOCIAL_PROVIDERS,
|
|
475
|
+
{ required: true }
|
|
476
|
+
)
|
|
477
|
+
];
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
423
481
|
return {
|
|
424
482
|
args: [target],
|
|
425
483
|
flags: {
|
|
@@ -443,12 +501,19 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
|
|
|
443
501
|
const eventsResult = await installEventsIntoProject(context.projectRoot);
|
|
444
502
|
let queueResult;
|
|
445
503
|
if (!queueConfigured && isInteractive(context, commandContext.flags)) {
|
|
446
|
-
const
|
|
504
|
+
const queueAction = await promptChoice(
|
|
447
505
|
context,
|
|
448
|
-
"
|
|
449
|
-
|
|
506
|
+
"Queued listeners",
|
|
507
|
+
EVENTS_QUEUE_ACTIONS,
|
|
508
|
+
"skip",
|
|
509
|
+
{
|
|
510
|
+
labels: {
|
|
511
|
+
skip: "Skip queued listeners",
|
|
512
|
+
enable: "Enable queued listeners"
|
|
513
|
+
}
|
|
514
|
+
}
|
|
450
515
|
);
|
|
451
|
-
if (
|
|
516
|
+
if (queueAction === "enable") {
|
|
452
517
|
queueResult = await installQueueIntoProject2(context.projectRoot, { driver: "sync" });
|
|
453
518
|
}
|
|
454
519
|
}
|
|
@@ -549,6 +614,17 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
|
|
|
549
614
|
await runProjectDependencyInstallAfterPackageJsonUpdate(context, projectExecutors, result2.updatedPackageJson);
|
|
550
615
|
return;
|
|
551
616
|
}
|
|
617
|
+
if (target === "realtime") {
|
|
618
|
+
const { installRealtimeIntoProject } = await loadProjectScaffoldModule();
|
|
619
|
+
const result2 = await installRealtimeIntoProject(context.projectRoot);
|
|
620
|
+
const changed2 = result2.updatedPackageJson || result2.createdRealtimeDirectory || result2.createdFrameworkSetup;
|
|
621
|
+
writeLine(context.stdout, changed2 ? "Installed realtime support." : "Realtime support is already installed.");
|
|
622
|
+
if (result2.updatedPackageJson) writeLine(context.stdout, " - updated package.json");
|
|
623
|
+
if (result2.createdRealtimeDirectory) writeLine(context.stdout, " - created server/realtime");
|
|
624
|
+
if (result2.createdFrameworkSetup) writeLine(context.stdout, " - created realtime framework setup");
|
|
625
|
+
await runProjectDependencyInstallAfterPackageJsonUpdate(context, projectExecutors, result2.updatedPackageJson);
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
552
628
|
if (target === "security") {
|
|
553
629
|
const { installSecurityIntoProject } = await loadProjectScaffoldModule();
|
|
554
630
|
const result2 = await installSecurityIntoProject(context.projectRoot);
|
|
@@ -1045,17 +1121,25 @@ function createInternalCommands(context, runtimeExecutor, queueExecutors = {}, p
|
|
|
1045
1121
|
};
|
|
1046
1122
|
if (isInteractive(context, input.flags)) {
|
|
1047
1123
|
const noneSelected = [flags.migration, flags.observer, flags.seeder, flags.factory].every((value) => value !== true);
|
|
1048
|
-
if (noneSelected
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1124
|
+
if (noneSelected) {
|
|
1125
|
+
const selectedArtifacts = await promptMultiChoice(
|
|
1126
|
+
context,
|
|
1127
|
+
"Model artifacts",
|
|
1128
|
+
MODEL_GENERATOR_OPTIONS,
|
|
1129
|
+
{
|
|
1130
|
+
initialValues: ["migration"],
|
|
1131
|
+
labels: {
|
|
1132
|
+
migration: "Migration",
|
|
1133
|
+
observer: "Observer",
|
|
1134
|
+
seeder: "Seeder",
|
|
1135
|
+
factory: "Factory"
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
);
|
|
1139
|
+
flags.migration = selectedArtifacts.includes("migration");
|
|
1140
|
+
flags.observer = selectedArtifacts.includes("observer");
|
|
1141
|
+
flags.seeder = selectedArtifacts.includes("seeder");
|
|
1142
|
+
flags.factory = selectedArtifacts.includes("factory");
|
|
1059
1143
|
}
|
|
1060
1144
|
}
|
|
1061
1145
|
return {
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getRegistryMigrationSlug,
|
|
3
2
|
hasRegisteredCreateTableMigration,
|
|
4
3
|
hasRegisteredMigrationSlug,
|
|
5
4
|
nextMigrationTemplate
|
|
6
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LXGQCG56.mjs";
|
|
6
|
+
import "./chunk-LBJAJLKU.mjs";
|
|
7
7
|
import {
|
|
8
8
|
writeLine
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-57SJ566R.mjs";
|
|
9
|
+
} from "./chunk-I7QBCEV7.mjs";
|
|
11
10
|
import "./chunk-D7O4SU6N.mjs";
|
|
12
11
|
import {
|
|
13
12
|
prepareProjectDiscovery
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-2RGJTPYF.mjs";
|
|
14
|
+
import "./chunk-KWRIBHC3.mjs";
|
|
16
15
|
import {
|
|
17
16
|
ensureProjectConfig
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ONKESAQA.mjs";
|
|
19
18
|
import {
|
|
20
19
|
loadGeneratedProjectRegistry
|
|
21
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-2DKQKZML.mjs";
|
|
22
21
|
import {
|
|
23
22
|
makeProjectRelativePath,
|
|
24
23
|
resolveDefaultArtifactPath,
|
|
25
24
|
writeTextFile
|
|
26
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ILU426CF.mjs";
|
|
27
26
|
|
|
28
27
|
// src/media-migrations.ts
|
|
29
28
|
import { readdir } from "fs/promises";
|
|
@@ -94,23 +93,13 @@ async function createMediaTableMigration(projectRoot, options = {}) {
|
|
|
94
93
|
}
|
|
95
94
|
async function runMediaTableCommand(io, projectRoot) {
|
|
96
95
|
const migrationFilePath = await createMediaTableMigration(projectRoot);
|
|
97
|
-
const { runProjectPrepare } = await import("./dev-
|
|
98
|
-
if (!migrationFilePath) {
|
|
99
|
-
throw new Error(`A migration for table "${DEFAULT_MEDIA_TABLE}" already exists.`);
|
|
100
|
-
}
|
|
96
|
+
const { runProjectPrepare } = await import("./dev-PJMEGTAC.mjs");
|
|
101
97
|
await runProjectPrepare(projectRoot);
|
|
102
98
|
writeLine(io.stdout, `Created migration: ${makeProjectRelativePath(projectRoot, migrationFilePath)}`);
|
|
103
99
|
}
|
|
104
|
-
var mediaMigrationInternals = {
|
|
105
|
-
getRegistryMigrationSlug,
|
|
106
|
-
hasRegisteredMigrationSlug,
|
|
107
|
-
hasRegisteredCreateTableMigration,
|
|
108
|
-
nextMigrationTemplate
|
|
109
|
-
};
|
|
110
100
|
export {
|
|
111
101
|
DEFAULT_MEDIA_TABLE,
|
|
112
102
|
createMediaTableMigration,
|
|
113
|
-
mediaMigrationInternals,
|
|
114
103
|
normalizeMediaMigrationName,
|
|
115
104
|
renderMediaTableMigration,
|
|
116
105
|
runMediaTableCommand
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
hasRegisteredCreateTableMigration,
|
|
3
|
+
hasRegisteredMigrationSlug,
|
|
4
|
+
nextMigrationTemplate
|
|
5
|
+
} from "./chunk-LXGQCG56.mjs";
|
|
6
|
+
import {
|
|
7
|
+
writeLine
|
|
8
|
+
} from "./chunk-I7QBCEV7.mjs";
|
|
9
|
+
import "./chunk-LBJAJLKU.mjs";
|
|
10
|
+
import "./chunk-D7O4SU6N.mjs";
|
|
11
|
+
import {
|
|
12
|
+
prepareProjectDiscovery
|
|
13
|
+
} from "./chunk-2RGJTPYF.mjs";
|
|
14
|
+
import "./chunk-UPZH6KCF.mjs";
|
|
15
|
+
import {
|
|
16
|
+
ensureProjectConfig
|
|
17
|
+
} from "./chunk-ONKESAQA.mjs";
|
|
18
|
+
import {
|
|
19
|
+
loadGeneratedProjectRegistry
|
|
20
|
+
} from "./chunk-2DKQKZML.mjs";
|
|
21
|
+
import {
|
|
22
|
+
makeProjectRelativePath,
|
|
23
|
+
resolveDefaultArtifactPath,
|
|
24
|
+
writeTextFile
|
|
25
|
+
} from "./chunk-ILU426CF.mjs";
|
|
26
|
+
|
|
27
|
+
// src/media-migrations.ts
|
|
28
|
+
import { readdir } from "fs/promises";
|
|
29
|
+
import { resolve } from "path";
|
|
30
|
+
import { normalizeMigrationSlug } from "@holo-js/db";
|
|
31
|
+
var DEFAULT_MEDIA_TABLE = "media";
|
|
32
|
+
function normalizeMediaMigrationName(tableName = DEFAULT_MEDIA_TABLE) {
|
|
33
|
+
return normalizeMigrationSlug(`create_${tableName.replaceAll(".", "_")}_table`);
|
|
34
|
+
}
|
|
35
|
+
function renderMediaTableMigration(tableName = DEFAULT_MEDIA_TABLE) {
|
|
36
|
+
const tableNameLiteral = JSON.stringify(tableName);
|
|
37
|
+
return [
|
|
38
|
+
"import { defineMigration, type MigrationContext } from '@holo-js/db'",
|
|
39
|
+
"",
|
|
40
|
+
"export default defineMigration({",
|
|
41
|
+
" async up({ schema }: MigrationContext) {",
|
|
42
|
+
` await schema.createTable(${tableNameLiteral}, (table) => {`,
|
|
43
|
+
" table.id()",
|
|
44
|
+
" table.uuid('uuid').unique()",
|
|
45
|
+
" table.string('model_type')",
|
|
46
|
+
" table.string('model_id')",
|
|
47
|
+
" table.string('collection_name').default('default')",
|
|
48
|
+
" table.string('name')",
|
|
49
|
+
" table.string('file_name')",
|
|
50
|
+
" table.string('disk')",
|
|
51
|
+
" table.string('conversions_disk').nullable()",
|
|
52
|
+
" table.string('mime_type').nullable()",
|
|
53
|
+
" table.string('extension').nullable()",
|
|
54
|
+
" table.bigInteger('size')",
|
|
55
|
+
" table.string('path')",
|
|
56
|
+
" table.json('generated_conversions')",
|
|
57
|
+
" table.integer('order_column').default(1)",
|
|
58
|
+
" table.timestamps()",
|
|
59
|
+
" table.index(['model_type', 'model_id'])",
|
|
60
|
+
" table.index(['model_type', 'model_id', 'collection_name'])",
|
|
61
|
+
" })",
|
|
62
|
+
" },",
|
|
63
|
+
" async down({ schema }: MigrationContext) {",
|
|
64
|
+
` await schema.dropTable(${tableNameLiteral})`,
|
|
65
|
+
" },",
|
|
66
|
+
"})",
|
|
67
|
+
""
|
|
68
|
+
].join("\n");
|
|
69
|
+
}
|
|
70
|
+
async function hasMigrationFile(migrationsDir, migrationName) {
|
|
71
|
+
const entries = await readdir(migrationsDir).catch(() => []);
|
|
72
|
+
return entries.some((entry) => entry.endsWith(`_${migrationName}.ts`) || entry.endsWith(`_${migrationName}.mts`) || entry.endsWith(`_${migrationName}.js`) || entry.endsWith(`_${migrationName}.mjs`) || entry.endsWith(`_${migrationName}.cts`) || entry.endsWith(`_${migrationName}.cjs`));
|
|
73
|
+
}
|
|
74
|
+
async function createMediaTableMigration(projectRoot, options = {}) {
|
|
75
|
+
const project = await ensureProjectConfig(projectRoot);
|
|
76
|
+
const registry = await loadGeneratedProjectRegistry(projectRoot) ?? await prepareProjectDiscovery(projectRoot, project.config);
|
|
77
|
+
const tableName = DEFAULT_MEDIA_TABLE;
|
|
78
|
+
const migrationName = normalizeMediaMigrationName(tableName);
|
|
79
|
+
const migrationsDir = resolve(projectRoot, project.config.paths.migrations);
|
|
80
|
+
if (hasRegisteredMigrationSlug(registry, migrationName) || hasRegisteredCreateTableMigration(registry, tableName) || await hasMigrationFile(migrationsDir, migrationName)) {
|
|
81
|
+
if (options.skipIfExists === true) {
|
|
82
|
+
return void 0;
|
|
83
|
+
}
|
|
84
|
+
throw new Error(`A migration for table "${tableName}" already exists.`);
|
|
85
|
+
}
|
|
86
|
+
const migrationTemplate = await nextMigrationTemplate(
|
|
87
|
+
migrationName,
|
|
88
|
+
migrationsDir
|
|
89
|
+
);
|
|
90
|
+
const migrationFilePath = resolveDefaultArtifactPath(projectRoot, project.config.paths.migrations, migrationTemplate.fileName);
|
|
91
|
+
await writeTextFile(migrationFilePath, renderMediaTableMigration(tableName));
|
|
92
|
+
return migrationFilePath;
|
|
93
|
+
}
|
|
94
|
+
async function runMediaTableCommand(io, projectRoot) {
|
|
95
|
+
const migrationFilePath = await createMediaTableMigration(projectRoot);
|
|
96
|
+
const { runProjectPrepare } = await import("./dev-2OULECTU.mjs");
|
|
97
|
+
await runProjectPrepare(projectRoot);
|
|
98
|
+
writeLine(io.stdout, `Created migration: ${makeProjectRelativePath(projectRoot, migrationFilePath)}`);
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
DEFAULT_MEDIA_TABLE,
|
|
102
|
+
createMediaTableMigration,
|
|
103
|
+
normalizeMediaMigrationName,
|
|
104
|
+
renderMediaTableMigration,
|
|
105
|
+
runMediaTableCommand
|
|
106
|
+
};
|
|
@@ -4,32 +4,32 @@ import {
|
|
|
4
4
|
normalizeWatchedFilePath,
|
|
5
5
|
runProjectPrepare,
|
|
6
6
|
toPosixSlashes
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-EWYXSN2C.mjs";
|
|
8
|
+
import "./chunk-FGQ2I2YH.mjs";
|
|
9
9
|
import {
|
|
10
10
|
writeLine
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-I7QBCEV7.mjs";
|
|
12
12
|
import {
|
|
13
13
|
initializeProjectRuntime
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-IUDD5FYL.mjs";
|
|
15
|
+
import "./chunk-LBJAJLKU.mjs";
|
|
16
16
|
import "./chunk-D7O4SU6N.mjs";
|
|
17
17
|
import {
|
|
18
18
|
prepareProjectDiscovery
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-2RGJTPYF.mjs";
|
|
20
|
+
import "./chunk-UPZH6KCF.mjs";
|
|
21
21
|
import {
|
|
22
22
|
ensureProjectConfig,
|
|
23
23
|
loadProjectConfig
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-ONKESAQA.mjs";
|
|
25
25
|
import {
|
|
26
26
|
loadGeneratedProjectRegistry
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-2DKQKZML.mjs";
|
|
28
28
|
import {
|
|
29
29
|
HOLO_RUNTIME_ROOT,
|
|
30
30
|
bundleProjectModule,
|
|
31
31
|
resolveProjectPackageImportSpecifier
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-ILU426CF.mjs";
|
|
33
33
|
|
|
34
34
|
// src/queue.ts
|
|
35
35
|
import { spawn } from "child_process";
|