everything-dev 1.16.2 → 1.17.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/api-contract.cjs +16 -5
- package/dist/api-contract.cjs.map +1 -1
- package/dist/api-contract.mjs +16 -5
- package/dist/api-contract.mjs.map +1 -1
- package/dist/cli/init.cjs +50 -51
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +50 -51
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/sync.cjs +3 -5
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +3 -5
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli/timing.cjs +30 -0
- package/dist/cli/timing.cjs.map +1 -0
- package/dist/cli/timing.mjs +27 -0
- package/dist/cli/timing.mjs.map +1 -0
- package/dist/cli/upgrade.cjs +214 -48
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +214 -48
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/cli.cjs +9 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +9 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/components/dev-view.cjs +1 -1
- package/dist/components/dev-view.mjs +1 -1
- package/dist/components/streaming-view.cjs +1 -1
- package/dist/components/streaming-view.mjs +1 -1
- package/dist/config.cjs +125 -74
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +9 -2
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +9 -2
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +126 -76
- package/dist/config.mjs.map +1 -1
- package/dist/contract.cjs +7 -0
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +58 -13
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +58 -13
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.mjs +7 -1
- package/dist/contract.mjs.map +1 -1
- package/dist/dev-session.cjs +5 -3
- package/dist/dev-session.cjs.map +1 -1
- package/dist/dev-session.mjs +3 -3
- package/dist/dev-session.mjs.map +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/merge.cjs +1 -0
- package/dist/merge.mjs +1 -1
- package/dist/orchestrator.cjs +1 -1
- package/dist/orchestrator.mjs +1 -1
- package/dist/plugin.cjs +49 -37
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +44 -12
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +44 -12
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +48 -36
- package/dist/plugin.mjs.map +1 -1
- package/dist/sidebar.cjs +6 -14
- package/dist/sidebar.cjs.map +1 -1
- package/dist/sidebar.d.cts +3 -3
- package/dist/sidebar.d.cts.map +1 -1
- package/dist/sidebar.d.mts +3 -3
- package/dist/sidebar.d.mts.map +1 -1
- package/dist/sidebar.mjs +6 -14
- package/dist/sidebar.mjs.map +1 -1
- package/dist/types.cjs +10 -16
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +56 -12
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +56 -12
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +10 -17
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api-contract.ts +21 -3
- package/src/cli/init.ts +95 -63
- package/src/cli/sync.ts +5 -8
- package/src/cli/timing.ts +36 -0
- package/src/cli/upgrade.ts +292 -56
- package/src/cli.ts +15 -0
- package/src/config.ts +250 -107
- package/src/contract.ts +8 -0
- package/src/dev-session.ts +1 -1
- package/src/plugin.ts +97 -54
- package/src/sidebar.ts +9 -31
- package/src/types.ts +10 -15
package/dist/plugin.d.mts
CHANGED
|
@@ -93,15 +93,13 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
93
93
|
production: z.ZodOptional<z.ZodString>;
|
|
94
94
|
staging: z.ZodOptional<z.ZodString>;
|
|
95
95
|
}, z.core.$strip>]>>;
|
|
96
|
+
name: z.ZodOptional<z.ZodString>;
|
|
96
97
|
development: z.ZodOptional<z.ZodString>;
|
|
97
98
|
production: z.ZodOptional<z.ZodString>;
|
|
98
99
|
integrity: z.ZodOptional<z.ZodString>;
|
|
99
|
-
name: z.ZodOptional<z.ZodString>;
|
|
100
|
-
version: z.ZodOptional<z.ZodString>;
|
|
101
100
|
proxy: z.ZodOptional<z.ZodString>;
|
|
102
101
|
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
103
102
|
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
104
|
-
routes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
105
103
|
sidebar: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
106
104
|
icon: z.ZodString;
|
|
107
105
|
label: z.ZodString;
|
|
@@ -112,6 +110,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
112
110
|
admin: "admin";
|
|
113
111
|
}>>;
|
|
114
112
|
}, z.core.$strip>>>;
|
|
113
|
+
routes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
+
version: z.ZodOptional<z.ZodString>;
|
|
115
115
|
app: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
116
116
|
shared: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
117
117
|
version: z.ZodString;
|
|
@@ -139,7 +139,12 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
139
139
|
ssrIntegrity: z.ZodOptional<z.ZodString>;
|
|
140
140
|
}, z.core.$strip>;
|
|
141
141
|
api: z.ZodObject<{
|
|
142
|
-
|
|
142
|
+
extends: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
143
|
+
development: z.ZodOptional<z.ZodString>;
|
|
144
|
+
production: z.ZodOptional<z.ZodString>;
|
|
145
|
+
staging: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$strip>]>>;
|
|
147
|
+
name: z.ZodOptional<z.ZodString>;
|
|
143
148
|
development: z.ZodOptional<z.ZodString>;
|
|
144
149
|
production: z.ZodOptional<z.ZodString>;
|
|
145
150
|
integrity: z.ZodOptional<z.ZodString>;
|
|
@@ -156,9 +161,15 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
156
161
|
admin: "admin";
|
|
157
162
|
}>>;
|
|
158
163
|
}, z.core.$strip>>>;
|
|
164
|
+
routes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
159
165
|
}, z.core.$strip>;
|
|
160
166
|
auth: z.ZodOptional<z.ZodObject<{
|
|
161
|
-
|
|
167
|
+
extends: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
168
|
+
development: z.ZodOptional<z.ZodString>;
|
|
169
|
+
production: z.ZodOptional<z.ZodString>;
|
|
170
|
+
staging: z.ZodOptional<z.ZodString>;
|
|
171
|
+
}, z.core.$strip>]>>;
|
|
172
|
+
name: z.ZodOptional<z.ZodString>;
|
|
162
173
|
development: z.ZodOptional<z.ZodString>;
|
|
163
174
|
production: z.ZodOptional<z.ZodString>;
|
|
164
175
|
integrity: z.ZodOptional<z.ZodString>;
|
|
@@ -175,6 +186,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
175
186
|
admin: "admin";
|
|
176
187
|
}>>;
|
|
177
188
|
}, z.core.$strip>>>;
|
|
189
|
+
routes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
178
190
|
}, z.core.$strip>>;
|
|
179
191
|
}, z.core.$strip>;
|
|
180
192
|
}, z.core.$strip>>;
|
|
@@ -307,6 +319,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
307
319
|
extends: z.ZodString;
|
|
308
320
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
309
321
|
filesCopied: z.ZodNumber;
|
|
322
|
+
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
323
|
+
name: z.ZodString;
|
|
324
|
+
durationMs: z.ZodNumber;
|
|
325
|
+
}, z.core.$strip>>>;
|
|
310
326
|
error: z.ZodOptional<z.ZodString>;
|
|
311
327
|
}, z.core.$strip>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
312
328
|
sync: ContractProcedure<z.ZodObject<{
|
|
@@ -354,6 +370,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
354
370
|
migrated: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
355
371
|
availablePlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
356
372
|
selectedPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
373
|
+
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
374
|
+
name: z.ZodString;
|
|
375
|
+
durationMs: z.ZodNumber;
|
|
376
|
+
}, z.core.$strip>>>;
|
|
357
377
|
changelogUrl: z.ZodOptional<z.ZodString>;
|
|
358
378
|
error: z.ZodOptional<z.ZodString>;
|
|
359
379
|
}, z.core.$strip>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
@@ -381,8 +401,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
381
401
|
}, z.core.$strip>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
382
402
|
typesGen: ContractProcedure<z.ZodObject<{
|
|
383
403
|
env: z.ZodOptional<z.ZodEnum<{
|
|
384
|
-
production: "production";
|
|
385
404
|
development: "development";
|
|
405
|
+
production: "production";
|
|
386
406
|
}>>;
|
|
387
407
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
388
408
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -421,7 +441,12 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
421
441
|
ssrIntegrity?: string | undefined;
|
|
422
442
|
};
|
|
423
443
|
api: {
|
|
424
|
-
|
|
444
|
+
extends?: string | {
|
|
445
|
+
development?: string | undefined;
|
|
446
|
+
production?: string | undefined;
|
|
447
|
+
staging?: string | undefined;
|
|
448
|
+
} | undefined;
|
|
449
|
+
name?: string | undefined;
|
|
425
450
|
development?: string | undefined;
|
|
426
451
|
production?: string | undefined;
|
|
427
452
|
integrity?: string | undefined;
|
|
@@ -434,9 +459,15 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
434
459
|
to?: string | undefined;
|
|
435
460
|
roleRequired?: "anon" | "member" | "admin" | undefined;
|
|
436
461
|
}[] | undefined;
|
|
462
|
+
routes?: string[] | undefined;
|
|
437
463
|
};
|
|
438
464
|
auth?: {
|
|
439
|
-
|
|
465
|
+
extends?: string | {
|
|
466
|
+
development?: string | undefined;
|
|
467
|
+
production?: string | undefined;
|
|
468
|
+
staging?: string | undefined;
|
|
469
|
+
} | undefined;
|
|
470
|
+
name?: string | undefined;
|
|
440
471
|
development?: string | undefined;
|
|
441
472
|
production?: string | undefined;
|
|
442
473
|
integrity?: string | undefined;
|
|
@@ -449,6 +480,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
449
480
|
to?: string | undefined;
|
|
450
481
|
roleRequired?: "anon" | "member" | "admin" | undefined;
|
|
451
482
|
}[] | undefined;
|
|
483
|
+
routes?: string[] | undefined;
|
|
452
484
|
} | undefined;
|
|
453
485
|
};
|
|
454
486
|
extends?: string | {
|
|
@@ -478,21 +510,21 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
478
510
|
production?: string | undefined;
|
|
479
511
|
staging?: string | undefined;
|
|
480
512
|
} | undefined;
|
|
513
|
+
name?: string | undefined;
|
|
481
514
|
development?: string | undefined;
|
|
482
515
|
production?: string | undefined;
|
|
483
516
|
integrity?: string | undefined;
|
|
484
|
-
name?: string | undefined;
|
|
485
|
-
version?: string | undefined;
|
|
486
517
|
proxy?: string | undefined;
|
|
487
518
|
variables?: Record<string, string> | undefined;
|
|
488
519
|
secrets?: string[] | undefined;
|
|
489
|
-
routes?: string[] | undefined;
|
|
490
520
|
sidebar?: {
|
|
491
521
|
icon: string;
|
|
492
522
|
label: string;
|
|
493
523
|
to?: string | undefined;
|
|
494
524
|
roleRequired?: "anon" | "member" | "admin" | undefined;
|
|
495
525
|
}[] | undefined;
|
|
526
|
+
routes?: string[] | undefined;
|
|
527
|
+
version?: string | undefined;
|
|
496
528
|
app?: Record<string, unknown> | undefined;
|
|
497
529
|
shared?: Record<string, Record<string, {
|
|
498
530
|
version: string;
|
|
@@ -506,7 +538,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
506
538
|
}> | undefined;
|
|
507
539
|
} | null;
|
|
508
540
|
runtimeConfig: {
|
|
509
|
-
env: "
|
|
541
|
+
env: "development" | "production" | "staging";
|
|
510
542
|
account: string;
|
|
511
543
|
networkId: "testnet" | "mainnet";
|
|
512
544
|
host: {
|
package/dist/plugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;cAoDwC,QAAA"}
|
package/dist/plugin.mjs
CHANGED
|
@@ -11,21 +11,24 @@ import { copyFilteredFiles, fetchParentConfig, generateDatabaseMigrations, perso
|
|
|
11
11
|
import { promptInitOptions } from "./cli/prompts.mjs";
|
|
12
12
|
import { getStatus } from "./cli/status.mjs";
|
|
13
13
|
import { syncTemplate } from "./cli/sync.mjs";
|
|
14
|
+
import { timePhase } from "./cli/timing.mjs";
|
|
14
15
|
import { upgradeTemplate } from "./cli/upgrade.mjs";
|
|
15
|
-
import { colors } from "./utils/theme.mjs";
|
|
16
16
|
import { computeSriHashForUrl } from "./integrity.mjs";
|
|
17
|
-
import { buildDescription, buildServiceDescriptorMap } from "./service-descriptor.mjs";
|
|
18
|
-
import { devApp, startApp } from "./dev-session.mjs";
|
|
19
17
|
import { addFunctionCallAccessKey, ensureNearCli, executeTransaction } from "./near-cli.mjs";
|
|
18
|
+
import { buildDescription, buildServiceDescriptorMap } from "./service-descriptor.mjs";
|
|
20
19
|
import { syncAndGenerateSharedUi } from "./shared.mjs";
|
|
21
20
|
import { writePluginSidebarGen } from "./sidebar.mjs";
|
|
22
21
|
import { run } from "./utils/run.mjs";
|
|
22
|
+
import { colors } from "./utils/theme.mjs";
|
|
23
23
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
24
24
|
import { basename, dirname, join, resolve } from "node:path";
|
|
25
25
|
import * as p from "@clack/prompts";
|
|
26
26
|
import { Effect } from "effect";
|
|
27
27
|
|
|
28
28
|
//#region src/plugin.ts
|
|
29
|
+
async function loadDevSession() {
|
|
30
|
+
return import("./dev-session.mjs");
|
|
31
|
+
}
|
|
29
32
|
const buildCommands = {
|
|
30
33
|
host: {
|
|
31
34
|
cmd: "bun",
|
|
@@ -131,10 +134,10 @@ function listPluginAttachments(config) {
|
|
|
131
134
|
}).sort((a, b) => a.key.localeCompare(b.key));
|
|
132
135
|
}
|
|
133
136
|
async function generateCodeArtifacts(configDir, config, opts) {
|
|
134
|
-
writePluginSidebarGen(configDir, config);
|
|
135
137
|
if (opts?.env) writeResolvedConfig(configDir, config, opts.env, opts.extendsChain);
|
|
136
138
|
const runtimeConfig = opts?.runtimeConfig ?? (await loadConfig({ cwd: configDir }))?.runtime;
|
|
137
139
|
if (!runtimeConfig) return null;
|
|
140
|
+
writePluginSidebarGen(configDir, runtimeConfig);
|
|
138
141
|
const bridge = await syncApiContractBridge({
|
|
139
142
|
configDir,
|
|
140
143
|
runtimeConfig,
|
|
@@ -405,15 +408,15 @@ var plugin_default = createPlugin({
|
|
|
405
408
|
const pluginConfigPath = join(localPath, "bos.config.json");
|
|
406
409
|
if (existsSync(pluginConfigPath)) try {
|
|
407
410
|
const pluginConfig = JSON.parse(readFileSync(pluginConfigPath, "utf-8"));
|
|
408
|
-
if (!pluginConfig.
|
|
409
|
-
const
|
|
410
|
-
if (!
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
if (integrity)
|
|
414
|
-
else delete
|
|
411
|
+
if (!pluginConfig.plugins || typeof pluginConfig.plugins !== "object") pluginConfig.plugins = {};
|
|
412
|
+
const plugins = pluginConfig.plugins;
|
|
413
|
+
if (!plugins[input.key] || typeof plugins[input.key] !== "object") plugins[input.key] = {};
|
|
414
|
+
const entry = plugins[input.key];
|
|
415
|
+
entry.production = publishedUrl;
|
|
416
|
+
if (integrity) entry.integrity = integrity;
|
|
417
|
+
else delete entry.integrity;
|
|
415
418
|
writeFileSync(pluginConfigPath, `${JSON.stringify(pluginConfig, null, 2)}\n`);
|
|
416
|
-
console.log(` ✅ Updated ${pluginConfigPath}:
|
|
419
|
+
console.log(` ✅ Updated ${pluginConfigPath}: plugins.${input.key}.production`);
|
|
417
420
|
} catch (err) {
|
|
418
421
|
console.error(` ❌ Failed to update plugin bos.config.json:`, err instanceof Error ? err.message : err);
|
|
419
422
|
}
|
|
@@ -531,6 +534,7 @@ var plugin_default = createPlugin({
|
|
|
531
534
|
port: runtimeConfig.host.port,
|
|
532
535
|
interactive: input.interactive
|
|
533
536
|
};
|
|
537
|
+
const { devApp } = await loadDevSession();
|
|
534
538
|
devApp(orchestrator, services, runtimeConfig);
|
|
535
539
|
return {
|
|
536
540
|
status: "started",
|
|
@@ -609,7 +613,7 @@ var plugin_default = createPlugin({
|
|
|
609
613
|
}
|
|
610
614
|
summaryLines.push("");
|
|
611
615
|
console.log(summaryLines.join("\n"));
|
|
612
|
-
|
|
616
|
+
const orchestrator = {
|
|
613
617
|
packages: ["host"],
|
|
614
618
|
env: {
|
|
615
619
|
NODE_ENV: "production",
|
|
@@ -620,7 +624,9 @@ var plugin_default = createPlugin({
|
|
|
620
624
|
port,
|
|
621
625
|
interactive: input.interactive,
|
|
622
626
|
noLogs: true
|
|
623
|
-
}
|
|
627
|
+
};
|
|
628
|
+
const { startApp } = await loadDevSession();
|
|
629
|
+
startApp(orchestrator, services, runtimeConfig);
|
|
624
630
|
return {
|
|
625
631
|
status: "running",
|
|
626
632
|
url: `http://localhost:${port}`
|
|
@@ -818,6 +824,7 @@ var plugin_default = createPlugin({
|
|
|
818
824
|
}),
|
|
819
825
|
init: builder.init.handler(async ({ input }) => {
|
|
820
826
|
try {
|
|
827
|
+
const timings = [];
|
|
821
828
|
let extendsAccount = input.extendsAccount;
|
|
822
829
|
let extendsGateway = input.extendsGateway;
|
|
823
830
|
let directory = input.directory;
|
|
@@ -837,7 +844,7 @@ var plugin_default = createPlugin({
|
|
|
837
844
|
let parentPluginKeys = [];
|
|
838
845
|
let parentConfig = null;
|
|
839
846
|
try {
|
|
840
|
-
parentConfig = await fetchParentConfig(extendsAccount, extendsGateway);
|
|
847
|
+
parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway));
|
|
841
848
|
if (parentConfig?.plugins && typeof parentConfig.plugins === "object") parentPluginKeys = Object.keys(parentConfig.plugins);
|
|
842
849
|
} catch {}
|
|
843
850
|
if (!input.noInteractive) {
|
|
@@ -864,7 +871,7 @@ var plugin_default = createPlugin({
|
|
|
864
871
|
const targetDir = resolve(directory);
|
|
865
872
|
plugins = plugins ?? [];
|
|
866
873
|
if (!parentConfig) try {
|
|
867
|
-
parentConfig = await fetchParentConfig(extendsAccount, extendsGateway);
|
|
874
|
+
parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway));
|
|
868
875
|
} catch {
|
|
869
876
|
return {
|
|
870
877
|
status: "error",
|
|
@@ -876,14 +883,15 @@ var plugin_default = createPlugin({
|
|
|
876
883
|
extends: `bos://${extendsAccount}/${extendsGateway}`,
|
|
877
884
|
plugins: plugins ?? [],
|
|
878
885
|
filesCopied: 0,
|
|
886
|
+
timings,
|
|
879
887
|
error: `No config found at bos://${extendsAccount}/${extendsGateway} — are you sure this is the right parent?`
|
|
880
888
|
};
|
|
881
889
|
}
|
|
882
|
-
const { sourceDir, parentConfig: resolvedParentConfig, cleanup } = await resolveSourceDir({
|
|
890
|
+
const { sourceDir, parentConfig: resolvedParentConfig, cleanup } = await timePhase(timings, "template source", () => resolveSourceDir({
|
|
883
891
|
extendsAccount,
|
|
884
892
|
extendsGateway,
|
|
885
893
|
source: input.source
|
|
886
|
-
});
|
|
894
|
+
}));
|
|
887
895
|
parentConfig = resolvedParentConfig;
|
|
888
896
|
try {
|
|
889
897
|
const patterns = await readTemplatekeep(sourceDir);
|
|
@@ -900,18 +908,16 @@ var plugin_default = createPlugin({
|
|
|
900
908
|
error: "No .templatekeep found in template source"
|
|
901
909
|
};
|
|
902
910
|
const pluginRoutes = {};
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
if (entryRef?.routes && entryRef.routes.length > 0) pluginRoutes[key] = entryRef.routes;
|
|
906
|
-
}
|
|
911
|
+
const parentRuntimePlugins = await buildRuntimePluginsForConfig(parentConfig, sourceDir, "production");
|
|
912
|
+
for (const [key, plugin] of Object.entries(parentRuntimePlugins ?? {})) if (plugin.routes && plugin.routes.length > 0) pluginRoutes[key] = plugin.routes;
|
|
907
913
|
const s = p.spinner();
|
|
908
914
|
s.start("Setting up project");
|
|
909
|
-
const filesCopied = await copyFilteredFiles(sourceDir, targetDir, patterns, {
|
|
915
|
+
const filesCopied = await timePhase(timings, "copy files", () => copyFilteredFiles(sourceDir, targetDir, patterns, {
|
|
910
916
|
withHost,
|
|
911
917
|
plugins,
|
|
912
918
|
pluginRoutes
|
|
913
|
-
});
|
|
914
|
-
await personalizeConfig(targetDir, {
|
|
919
|
+
}));
|
|
920
|
+
await timePhase(timings, "personalize config", () => personalizeConfig(targetDir, {
|
|
915
921
|
extendsAccount,
|
|
916
922
|
extendsGateway,
|
|
917
923
|
account: account || extendsAccount,
|
|
@@ -920,21 +926,25 @@ var plugin_default = createPlugin({
|
|
|
920
926
|
pluginRoutes,
|
|
921
927
|
workspaceOpts: { sourceDir },
|
|
922
928
|
withHost
|
|
923
|
-
});
|
|
924
|
-
await writeInitSnapshot(targetDir, extendsAccount, extendsGateway, sourceDir, patterns, {
|
|
929
|
+
}));
|
|
930
|
+
await timePhase(timings, "write snapshot", () => writeInitSnapshot(targetDir, extendsAccount, extendsGateway, sourceDir, patterns, {
|
|
925
931
|
withHost,
|
|
926
932
|
plugins,
|
|
927
933
|
pluginRoutes
|
|
934
|
+
}));
|
|
935
|
+
const initConfig = await timePhase(timings, "resolve config", () => loadConfig({ cwd: targetDir }));
|
|
936
|
+
if (initConfig?.runtime) await timePhase(timings, "generate env/docker", async () => {
|
|
937
|
+
writeGeneratedInfra(targetDir, initConfig.runtime);
|
|
938
|
+
});
|
|
939
|
+
await timePhase(timings, "create env file", async () => {
|
|
940
|
+
ensureEnvFile(targetDir);
|
|
928
941
|
});
|
|
929
|
-
const initConfig = await loadConfig({ cwd: targetDir });
|
|
930
|
-
if (initConfig?.runtime) writeGeneratedInfra(targetDir, initConfig.runtime);
|
|
931
|
-
ensureEnvFile(targetDir);
|
|
932
942
|
if (!input.noInstall) {
|
|
933
|
-
await runBunInstall(targetDir);
|
|
934
|
-
await runTypesGen(targetDir);
|
|
935
|
-
await generateDatabaseMigrations(targetDir);
|
|
943
|
+
await timePhase(timings, "install dependencies", () => runBunInstall(targetDir));
|
|
944
|
+
await timePhase(timings, "generate types", () => runTypesGen(targetDir));
|
|
945
|
+
await timePhase(timings, "generate migrations", () => generateDatabaseMigrations(targetDir));
|
|
936
946
|
}
|
|
937
|
-
if (initConfig?.config) await generateCodeArtifacts(targetDir, initConfig.config);
|
|
947
|
+
if (input.noInstall && initConfig?.config) await timePhase(timings, "generate code artifacts", () => generateCodeArtifacts(targetDir, initConfig.config));
|
|
938
948
|
s.stop("Project initialized");
|
|
939
949
|
if (!input.noInteractive) {
|
|
940
950
|
if (await p.confirm({
|
|
@@ -944,7 +954,7 @@ var plugin_default = createPlugin({
|
|
|
944
954
|
const dockerSpinner = p.spinner();
|
|
945
955
|
dockerSpinner.start("Starting Docker services");
|
|
946
956
|
try {
|
|
947
|
-
await runDockerComposeUp(targetDir);
|
|
957
|
+
await timePhase(timings, "docker compose up", () => runDockerComposeUp(targetDir));
|
|
948
958
|
dockerSpinner.stop("Docker services ready");
|
|
949
959
|
} catch (error) {
|
|
950
960
|
dockerSpinner.stop("Docker services not started");
|
|
@@ -961,7 +971,8 @@ var plugin_default = createPlugin({
|
|
|
961
971
|
domain,
|
|
962
972
|
extends: `bos://${extendsAccount}/${extendsGateway}`,
|
|
963
973
|
plugins,
|
|
964
|
-
filesCopied
|
|
974
|
+
filesCopied,
|
|
975
|
+
timings
|
|
965
976
|
};
|
|
966
977
|
} finally {
|
|
967
978
|
await cleanup();
|
|
@@ -977,6 +988,7 @@ var plugin_default = createPlugin({
|
|
|
977
988
|
extends: input.extendsAccount && input.extendsGateway ? `bos://${input.extendsAccount}/${input.extendsGateway}` : "",
|
|
978
989
|
plugins: input.plugins ?? [],
|
|
979
990
|
filesCopied: 0,
|
|
991
|
+
timings: [],
|
|
980
992
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
981
993
|
};
|
|
982
994
|
}
|