everything-dev 1.27.0 → 1.28.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/cli/infra.cjs +1 -1
- package/dist/cli/infra.mjs +1 -1
- package/dist/cli/init.cjs +7 -9
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +1 -1
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts +1 -1
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +7 -9
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/prompts.cjs +28 -24
- package/dist/cli/prompts.cjs.map +1 -1
- package/dist/cli/prompts.mjs +27 -24
- package/dist/cli/prompts.mjs.map +1 -1
- package/dist/cli/sync.cjs +4 -1
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +4 -1
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli.cjs +187 -12
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +186 -11
- package/dist/cli.mjs.map +1 -1
- package/dist/contract.cjs +1 -1
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +38 -34
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +38 -34
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.mjs +1 -0
- package/dist/contract.mjs.map +1 -1
- package/dist/dev-session.cjs +0 -1
- package/dist/dev-session.mjs +1 -1
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +0 -1
- package/dist/near-cli.cjs +1 -1
- package/dist/near-cli.mjs +1 -1
- package/dist/orchestrator.cjs +1 -1
- package/dist/orchestrator.mjs +1 -1
- package/dist/plugin.cjs +163 -139
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +67 -34
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +66 -34
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +153 -130
- package/dist/plugin.mjs.map +1 -1
- package/dist/service-descriptor.d.cts +34 -0
- package/dist/service-descriptor.d.cts.map +1 -0
- package/dist/service-descriptor.d.mts +36 -0
- package/dist/service-descriptor.d.mts.map +1 -0
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/package.json +2 -2
- package/src/api-contract.ts +0 -623
- package/src/app.ts +0 -193
- package/src/cli/catalog.ts +0 -49
- package/src/cli/framework-version.ts +0 -61
- package/src/cli/help.ts +0 -13
- package/src/cli/infra.ts +0 -190
- package/src/cli/init.ts +0 -1145
- package/src/cli/parse.ts +0 -147
- package/src/cli/prompts.ts +0 -135
- package/src/cli/snapshot.ts +0 -46
- package/src/cli/status.ts +0 -99
- package/src/cli/sync.ts +0 -429
- package/src/cli/timing.ts +0 -63
- package/src/cli/upgrade.ts +0 -869
- package/src/cli.ts +0 -516
- package/src/components/dev-view.tsx +0 -352
- package/src/components/streaming-view.ts +0 -177
- package/src/config.ts +0 -893
- package/src/contract.meta.ts +0 -140
- package/src/contract.ts +0 -326
- package/src/dev-logs.ts +0 -92
- package/src/dev-session.ts +0 -283
- package/src/fastkv.ts +0 -181
- package/src/index.ts +0 -8
- package/src/integrity.ts +0 -138
- package/src/internal/manifest-normalizer.ts +0 -290
- package/src/merge.ts +0 -187
- package/src/mf.ts +0 -147
- package/src/near-cli.ts +0 -259
- package/src/network.ts +0 -3
- package/src/orchestrator.ts +0 -493
- package/src/plugin.ts +0 -1799
- package/src/sdk.ts +0 -14
- package/src/service-descriptor.ts +0 -281
- package/src/shared.ts +0 -249
- package/src/sidebar.ts +0 -140
- package/src/types.ts +0 -330
- package/src/ui/head.ts +0 -83
- package/src/ui/index.ts +0 -5
- package/src/ui/metadata.ts +0 -95
- package/src/ui/router.ts +0 -88
- package/src/ui/runtime.ts +0 -42
- package/src/ui/types.ts +0 -65
- package/src/utils/banner.ts +0 -21
- package/src/utils/linkify.ts +0 -11
- package/src/utils/path-match.ts +0 -16
- package/src/utils/run.ts +0 -31
- package/src/utils/save-config.ts +0 -20
- package/src/utils/theme.ts +0 -39
package/dist/plugin.mjs
CHANGED
|
@@ -3,32 +3,67 @@ import { getNetworkIdForAccount } from "./network.mjs";
|
|
|
3
3
|
import { buildRuntimePluginsForConfig, findConfigPath, getHostDevelopmentPort, getProjectRoot, loadConfig, resolveLocalDevelopmentPath, writeResolvedConfig } from "./config.mjs";
|
|
4
4
|
import { createPlugin, z } from "./sdk.mjs";
|
|
5
5
|
import { bosContract } from "./contract.mjs";
|
|
6
|
+
import { writePluginSidebarGen } from "./sidebar.mjs";
|
|
7
|
+
import { computeSriHashForUrl } from "./integrity.mjs";
|
|
6
8
|
import { syncApiContractBridge } from "./api-contract.mjs";
|
|
7
9
|
import { buildRuntimeConfig, detectLocalPackages, prepareDevelopmentRuntimeConfig } from "./app.mjs";
|
|
8
10
|
import { ensureEnvFile, writeGeneratedInfra } from "./cli/infra.mjs";
|
|
9
11
|
import { saveBosConfig } from "./utils/save-config.mjs";
|
|
10
|
-
import { buildInitPatterns, copyFilteredFiles, detectGitRemoteUrl, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, removeInitLockfile, resolveSourceDir, runBunInstall,
|
|
11
|
-
import { promptInitOptions } from "./cli/prompts.mjs";
|
|
12
|
+
import { buildInitPatterns, copyFilteredFiles, detectGitRemoteUrl, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, removeInitLockfile, resolveSourceDir, runBunInstall, runTypesGen, scaffoldMinimalProject, stripOrphanedWorkspacesFromLockfile, writeInitSnapshot } from "./cli/init.mjs";
|
|
12
13
|
import { getStatus } from "./cli/status.mjs";
|
|
13
14
|
import { syncTemplate } from "./cli/sync.mjs";
|
|
14
|
-
import { timePhase } from "./cli/timing.mjs";
|
|
15
15
|
import { upgradeTemplate } from "./cli/upgrade.mjs";
|
|
16
|
-
import { computeSriHashForUrl } from "./integrity.mjs";
|
|
17
16
|
import { addFunctionCallAccessKey, ensureNearCli, executeTransaction } from "./near-cli.mjs";
|
|
18
17
|
import { buildDescription, buildServiceDescriptorMap } from "./service-descriptor.mjs";
|
|
19
18
|
import { syncAndGenerateSharedUi } from "./shared.mjs";
|
|
20
|
-
import { writePluginSidebarGen } from "./sidebar.mjs";
|
|
21
19
|
import { run } from "./utils/run.mjs";
|
|
22
|
-
import { colors } from "./utils/theme.mjs";
|
|
23
20
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
24
21
|
import { basename, dirname, join, resolve } from "node:path";
|
|
22
|
+
import { EventEmitter } from "node:events";
|
|
25
23
|
import process from "node:process";
|
|
26
|
-
import * as p from "@clack/prompts";
|
|
27
24
|
import { Effect } from "effect";
|
|
28
25
|
|
|
29
26
|
//#region src/plugin.ts
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
const pluginEvents = new EventEmitter();
|
|
28
|
+
let pendingSession = null;
|
|
29
|
+
let pendingStartSummary = null;
|
|
30
|
+
function consumeDevSession() {
|
|
31
|
+
const data = pendingSession;
|
|
32
|
+
const summary = pendingStartSummary;
|
|
33
|
+
pendingSession = null;
|
|
34
|
+
pendingStartSummary = null;
|
|
35
|
+
if (!data) return null;
|
|
36
|
+
return summary ? {
|
|
37
|
+
...data,
|
|
38
|
+
summary
|
|
39
|
+
} : data;
|
|
40
|
+
}
|
|
41
|
+
async function timePhase(timings, name, fn) {
|
|
42
|
+
pluginEvents.emit("progress", {
|
|
43
|
+
phase: name,
|
|
44
|
+
status: "running"
|
|
45
|
+
});
|
|
46
|
+
const startedAt = Date.now();
|
|
47
|
+
try {
|
|
48
|
+
const result = await fn();
|
|
49
|
+
timings.push({
|
|
50
|
+
name,
|
|
51
|
+
durationMs: Date.now() - startedAt
|
|
52
|
+
});
|
|
53
|
+
pluginEvents.emit("progress", {
|
|
54
|
+
phase: name,
|
|
55
|
+
status: "done",
|
|
56
|
+
durationMs: Date.now() - startedAt
|
|
57
|
+
});
|
|
58
|
+
return result;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
pluginEvents.emit("progress", {
|
|
61
|
+
phase: name,
|
|
62
|
+
status: "error",
|
|
63
|
+
durationMs: Date.now() - startedAt
|
|
64
|
+
});
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
32
67
|
}
|
|
33
68
|
const buildCommands = {
|
|
34
69
|
host: {
|
|
@@ -435,6 +470,10 @@ var plugin_default = createPlugin({
|
|
|
435
470
|
}),
|
|
436
471
|
dev: builder.dev.handler(async ({ input }) => {
|
|
437
472
|
ensureEnvFile(deps.configDir);
|
|
473
|
+
pluginEvents.emit("progress", {
|
|
474
|
+
phase: "config",
|
|
475
|
+
status: "running"
|
|
476
|
+
});
|
|
438
477
|
const localPackages = detectLocalPackages(deps.bosConfig ?? void 0, deps.runtimeConfig ?? void 0);
|
|
439
478
|
const hostSource = localPackages.includes("host") ? parseSourceMode(input.host, "local") : "remote";
|
|
440
479
|
const uiSource = localPackages.includes("ui") ? parseSourceMode(input.ui, "local") : "remote";
|
|
@@ -447,9 +486,41 @@ var plugin_default = createPlugin({
|
|
|
447
486
|
hostMode: hostSource,
|
|
448
487
|
bosConfig: deps.bosConfig ?? void 0,
|
|
449
488
|
extendsChain: []
|
|
450
|
-
})).catalogChanged)
|
|
451
|
-
|
|
489
|
+
})).catalogChanged) {
|
|
490
|
+
pluginEvents.emit("progress", {
|
|
491
|
+
phase: "install",
|
|
492
|
+
status: "running"
|
|
493
|
+
});
|
|
494
|
+
await run("bun", ["install"], { cwd: deps.configDir });
|
|
495
|
+
pluginEvents.emit("progress", {
|
|
496
|
+
phase: "install",
|
|
497
|
+
status: "done"
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
if (apiSource === "local" && !proxy || localPackages.some((pkg) => pkg.startsWith("plugin:"))) {
|
|
501
|
+
pluginEvents.emit("progress", {
|
|
502
|
+
phase: "build plugin",
|
|
503
|
+
status: "running"
|
|
504
|
+
});
|
|
505
|
+
await buildEveryPluginQuietly(deps.configDir);
|
|
506
|
+
pluginEvents.emit("progress", {
|
|
507
|
+
phase: "build plugin",
|
|
508
|
+
status: "done"
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
pluginEvents.emit("progress", {
|
|
512
|
+
phase: "build",
|
|
513
|
+
status: "running"
|
|
514
|
+
});
|
|
452
515
|
await buildEverythingDevQuietly(deps.configDir);
|
|
516
|
+
pluginEvents.emit("progress", {
|
|
517
|
+
phase: "build",
|
|
518
|
+
status: "done"
|
|
519
|
+
});
|
|
520
|
+
pluginEvents.emit("progress", {
|
|
521
|
+
phase: "config",
|
|
522
|
+
status: "done"
|
|
523
|
+
});
|
|
453
524
|
const refreshed = await loadConfig({ cwd: deps.configDir });
|
|
454
525
|
deps.bosConfig = refreshed?.config ?? deps.bosConfig;
|
|
455
526
|
deps.runtimeConfig = refreshed?.runtime ?? deps.runtimeConfig;
|
|
@@ -497,8 +568,11 @@ var plugin_default = createPlugin({
|
|
|
497
568
|
port: runtimeConfig.host.port,
|
|
498
569
|
interactive: input.interactive
|
|
499
570
|
};
|
|
500
|
-
|
|
501
|
-
|
|
571
|
+
pendingSession = {
|
|
572
|
+
orchestrator,
|
|
573
|
+
services,
|
|
574
|
+
runtimeConfig
|
|
575
|
+
};
|
|
502
576
|
return {
|
|
503
577
|
status: "started",
|
|
504
578
|
description: orchestrator.description,
|
|
@@ -507,6 +581,10 @@ var plugin_default = createPlugin({
|
|
|
507
581
|
}),
|
|
508
582
|
start: builder.start.handler(async ({ input }) => {
|
|
509
583
|
ensureEnvFile(deps.configDir);
|
|
584
|
+
pluginEvents.emit("progress", {
|
|
585
|
+
phase: "config",
|
|
586
|
+
status: "running"
|
|
587
|
+
});
|
|
510
588
|
const account = input.account ?? process.env.BOS_ACCOUNT;
|
|
511
589
|
const domain = input.domain ?? process.env.BOS_GATEWAY;
|
|
512
590
|
let config = null;
|
|
@@ -541,10 +619,18 @@ var plugin_default = createPlugin({
|
|
|
541
619
|
env: "production",
|
|
542
620
|
plugins: runtimePlugins
|
|
543
621
|
});
|
|
622
|
+
pluginEvents.emit("progress", {
|
|
623
|
+
phase: "generate artifacts",
|
|
624
|
+
status: "running"
|
|
625
|
+
});
|
|
544
626
|
await generateCodeArtifacts(deps.configDir, config, {
|
|
545
627
|
env: "production",
|
|
546
628
|
runtimeConfig
|
|
547
629
|
});
|
|
630
|
+
pluginEvents.emit("progress", {
|
|
631
|
+
phase: "generate artifacts",
|
|
632
|
+
status: "done"
|
|
633
|
+
});
|
|
548
634
|
const productionEnv = {};
|
|
549
635
|
const warnings = [];
|
|
550
636
|
if (!process.env.CORS_ORIGIN && config.domain) {
|
|
@@ -564,32 +650,40 @@ var plugin_default = createPlugin({
|
|
|
564
650
|
if (missingSecrets.length > 0) warnings.push(`Missing ${missingSecrets.length} secret(s): ${missingSecrets.join(", ")}`);
|
|
565
651
|
const services = buildServiceDescriptorMap(runtimeConfig);
|
|
566
652
|
const stagingEnvVars = isStaging ? { BOS_GATEWAY: config.staging?.domain ?? config.domain ?? "" } : {};
|
|
567
|
-
const
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
summaryLines.push("");
|
|
578
|
-
console.log(summaryLines.join("\n"));
|
|
579
|
-
const orchestrator = {
|
|
580
|
-
packages: ["host"],
|
|
581
|
-
env: {
|
|
582
|
-
NODE_ENV: "production",
|
|
583
|
-
...productionEnv,
|
|
584
|
-
...stagingEnvVars
|
|
653
|
+
const summary = {
|
|
654
|
+
configSource: remoteConfig ? `bos://${account}/${domain}` : findConfigPath() ?? "bos.config.json",
|
|
655
|
+
configSourceHttp: remoteConfig && account && domain ? buildRegistryConfigUrl(account, domain) : void 0,
|
|
656
|
+
account: config.account,
|
|
657
|
+
domain: config.domain ?? void 0,
|
|
658
|
+
modules: {
|
|
659
|
+
host: runtimeConfig.host.remoteUrl ?? runtimeConfig.host.url ?? "local",
|
|
660
|
+
ui: runtimeConfig.ui.url ?? "local",
|
|
661
|
+
api: runtimeConfig.api.url ?? "local",
|
|
662
|
+
auth: runtimeConfig.auth?.url ?? void 0
|
|
585
663
|
},
|
|
586
|
-
|
|
587
|
-
port,
|
|
588
|
-
interactive: input.interactive,
|
|
589
|
-
noLogs: true
|
|
664
|
+
warnings
|
|
590
665
|
};
|
|
591
|
-
|
|
592
|
-
|
|
666
|
+
pendingSession = {
|
|
667
|
+
orchestrator: {
|
|
668
|
+
packages: ["host"],
|
|
669
|
+
env: {
|
|
670
|
+
NODE_ENV: "production",
|
|
671
|
+
...productionEnv,
|
|
672
|
+
...stagingEnvVars
|
|
673
|
+
},
|
|
674
|
+
description: `${isStaging ? "Staging" : "Production"} Mode (${config.account})`,
|
|
675
|
+
port,
|
|
676
|
+
interactive: input.interactive,
|
|
677
|
+
noLogs: true
|
|
678
|
+
},
|
|
679
|
+
services,
|
|
680
|
+
runtimeConfig
|
|
681
|
+
};
|
|
682
|
+
pendingStartSummary = summary;
|
|
683
|
+
pluginEvents.emit("progress", {
|
|
684
|
+
phase: "config",
|
|
685
|
+
status: "done"
|
|
686
|
+
});
|
|
593
687
|
return {
|
|
594
688
|
status: "running",
|
|
595
689
|
url: `http://localhost:${port}`
|
|
@@ -779,8 +873,8 @@ var plugin_default = createPlugin({
|
|
|
779
873
|
let extendsAccount = "";
|
|
780
874
|
let extendsGateway = "";
|
|
781
875
|
let directory = input.directory;
|
|
782
|
-
|
|
783
|
-
|
|
876
|
+
const account = input.account;
|
|
877
|
+
const domain = input.domain;
|
|
784
878
|
let overrides = input.overrides;
|
|
785
879
|
let plugins = input.plugins;
|
|
786
880
|
if (input.extends) {
|
|
@@ -792,77 +886,22 @@ var plugin_default = createPlugin({
|
|
|
792
886
|
}
|
|
793
887
|
extendsAccount = extendsAccount || "dev.everything.near";
|
|
794
888
|
extendsGateway = extendsGateway || "everything.dev";
|
|
795
|
-
const s = p.spinner();
|
|
796
|
-
s.start("Initializing project");
|
|
797
889
|
let parentPluginKeys = [];
|
|
798
890
|
let parentConfig = null;
|
|
799
891
|
try {
|
|
800
|
-
parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway)
|
|
892
|
+
parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway));
|
|
801
893
|
if (parentConfig?.plugins && typeof parentConfig.plugins === "object") parentPluginKeys = Object.keys(parentConfig.plugins);
|
|
802
894
|
} catch {}
|
|
803
|
-
if (!input.noInteractive) {
|
|
804
|
-
s.stop("Config fetched");
|
|
805
|
-
const initialExtendsAccount = extendsAccount;
|
|
806
|
-
const initialExtendsGateway = extendsGateway;
|
|
807
|
-
const prompted = await promptInitOptions({
|
|
808
|
-
extends: `bos://${extendsAccount}/${extendsGateway}`,
|
|
809
|
-
directory,
|
|
810
|
-
account,
|
|
811
|
-
domain,
|
|
812
|
-
plugins,
|
|
813
|
-
overrides,
|
|
814
|
-
parentPluginKeys
|
|
815
|
-
});
|
|
816
|
-
extendsAccount = prompted.extendsAccount;
|
|
817
|
-
extendsGateway = prompted.extendsGateway;
|
|
818
|
-
directory = prompted.directory;
|
|
819
|
-
account = prompted.account;
|
|
820
|
-
domain = prompted.domain;
|
|
821
|
-
plugins = prompted.plugins;
|
|
822
|
-
overrides = prompted.overrides;
|
|
823
|
-
if (!parentConfig || prompted.extendsAccount !== initialExtendsAccount || prompted.extendsGateway !== initialExtendsGateway) {
|
|
824
|
-
try {
|
|
825
|
-
parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(prompted.extendsAccount, prompted.extendsGateway), s);
|
|
826
|
-
if (parentConfig?.plugins && typeof parentConfig.plugins === "object") parentPluginKeys = Object.keys(parentConfig.plugins);
|
|
827
|
-
else parentPluginKeys = [];
|
|
828
|
-
} catch {
|
|
829
|
-
return {
|
|
830
|
-
status: "error",
|
|
831
|
-
directory,
|
|
832
|
-
extendsRef: `bos://${prompted.extendsAccount}/${prompted.extendsGateway}`,
|
|
833
|
-
account,
|
|
834
|
-
domain,
|
|
835
|
-
extends: `bos://${prompted.extendsAccount}/${prompted.extendsGateway}`,
|
|
836
|
-
plugins,
|
|
837
|
-
overrides,
|
|
838
|
-
filesCopied: 0,
|
|
839
|
-
timings,
|
|
840
|
-
error: `No config found at bos://${prompted.extendsAccount}/${prompted.extendsGateway} — are you sure this is the right parent?`
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
s.stop("Config fetched");
|
|
844
|
-
}
|
|
845
|
-
if (typeof parentConfig?.title === "string" && parentConfig.title.trim() && typeof parentConfig.description === "string" && parentConfig.description.trim()) {
|
|
846
|
-
const shouldContinue = await p.confirm({
|
|
847
|
-
message: `You will be extending ${parentConfig.title} - ${parentConfig.description}. Continue?`,
|
|
848
|
-
initialValue: true
|
|
849
|
-
});
|
|
850
|
-
if (p.isCancel(shouldContinue) || !shouldContinue) process.exit(0);
|
|
851
|
-
}
|
|
852
|
-
s.start("Setting up project");
|
|
853
|
-
}
|
|
854
895
|
overrides = overrides?.length ? overrides : ["ui", "api"];
|
|
855
|
-
if (overrides.includes("plugins") &&
|
|
896
|
+
if (overrides.includes("plugins") && plugins === void 0) plugins = parentPluginKeys;
|
|
856
897
|
plugins = plugins ?? [];
|
|
857
898
|
directory = directory || domain || extendsGateway;
|
|
858
899
|
const targetDir = resolve(directory);
|
|
859
900
|
const extendsRef = `bos://${extendsAccount}/${extendsGateway}`;
|
|
860
|
-
if (overrides.includes("plugins") && !plugins.length) {}
|
|
861
901
|
const repository = await detectGitRemoteUrl(process.cwd()).catch(() => void 0) ?? parentConfig?.repository;
|
|
862
902
|
if (!parentConfig) try {
|
|
863
|
-
parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway)
|
|
903
|
+
parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway));
|
|
864
904
|
} catch {
|
|
865
|
-
s.stop("Failed");
|
|
866
905
|
return {
|
|
867
906
|
status: "error",
|
|
868
907
|
directory,
|
|
@@ -881,7 +920,7 @@ var plugin_default = createPlugin({
|
|
|
881
920
|
extendsAccount,
|
|
882
921
|
extendsGateway,
|
|
883
922
|
source: input.source
|
|
884
|
-
})
|
|
923
|
+
}));
|
|
885
924
|
parentConfig = resolvedParentConfig;
|
|
886
925
|
const isMinimalScaffold = sourceDir === "";
|
|
887
926
|
try {
|
|
@@ -897,7 +936,7 @@ var plugin_default = createPlugin({
|
|
|
897
936
|
repository,
|
|
898
937
|
title: parentConfig?.title,
|
|
899
938
|
description: parentConfig?.description
|
|
900
|
-
})
|
|
939
|
+
}));
|
|
901
940
|
await timePhase(timings, "personalize config", () => personalizeConfig(targetDir, {
|
|
902
941
|
extendsAccount,
|
|
903
942
|
extendsGateway,
|
|
@@ -911,13 +950,13 @@ var plugin_default = createPlugin({
|
|
|
911
950
|
description: parentConfig?.description,
|
|
912
951
|
testnet: parentConfig?.testnet,
|
|
913
952
|
staging: parentConfig?.staging
|
|
914
|
-
})
|
|
953
|
+
}));
|
|
915
954
|
} else {
|
|
916
955
|
const patterns = buildInitPatterns(overrides, plugins);
|
|
917
956
|
filesCopied = await timePhase(timings, "copy files", () => copyFilteredFiles(sourceDir, targetDir, patterns, {
|
|
918
957
|
overrides,
|
|
919
958
|
plugins
|
|
920
|
-
})
|
|
959
|
+
}));
|
|
921
960
|
await timePhase(timings, "personalize config", () => personalizeConfig(targetDir, {
|
|
922
961
|
extendsAccount,
|
|
923
962
|
extendsGateway,
|
|
@@ -931,45 +970,28 @@ var plugin_default = createPlugin({
|
|
|
931
970
|
description: parentConfig?.description,
|
|
932
971
|
testnet: parentConfig?.testnet,
|
|
933
972
|
staging: parentConfig?.staging
|
|
934
|
-
})
|
|
973
|
+
}));
|
|
935
974
|
await timePhase(timings, "write snapshot", () => writeInitSnapshot(targetDir, extendsAccount, extendsGateway, sourceDir, patterns, {
|
|
936
975
|
overrides,
|
|
937
976
|
plugins
|
|
938
|
-
})
|
|
977
|
+
}));
|
|
939
978
|
}
|
|
940
979
|
const lockfilePath = join(targetDir, "bun.lock");
|
|
941
980
|
stripOrphanedWorkspacesFromLockfile(lockfilePath, computeAllowedWorkspaces(overrides, plugins));
|
|
942
981
|
removeInitLockfile(lockfilePath);
|
|
943
|
-
const initConfig = await timePhase(timings, "resolve config", () => loadConfig({ cwd: targetDir })
|
|
982
|
+
const initConfig = await timePhase(timings, "resolve config", () => loadConfig({ cwd: targetDir }));
|
|
944
983
|
if (initConfig?.runtime) await timePhase(timings, "generate env/docker", async () => {
|
|
945
984
|
writeGeneratedInfra(targetDir, initConfig.runtime);
|
|
946
|
-
}
|
|
985
|
+
});
|
|
947
986
|
await timePhase(timings, "create env file", async () => {
|
|
948
987
|
ensureEnvFile(targetDir);
|
|
949
|
-
}
|
|
988
|
+
});
|
|
950
989
|
if (!input.noInstall) {
|
|
951
|
-
await timePhase(timings, "install dependencies", () => runBunInstall(targetDir
|
|
952
|
-
await timePhase(timings, "generate types", () => runTypesGen(targetDir
|
|
953
|
-
await timePhase(timings, "generate migrations", () => generateDatabaseMigrations(targetDir)
|
|
954
|
-
}
|
|
955
|
-
if (input.noInstall && initConfig?.config) await timePhase(timings, "generate code artifacts", () => generateCodeArtifacts(targetDir, initConfig.config), s);
|
|
956
|
-
s.stop("Project initialized");
|
|
957
|
-
if (!input.noInteractive) {
|
|
958
|
-
if (await p.confirm({
|
|
959
|
-
message: "Run docker compose up -d --wait?",
|
|
960
|
-
initialValue: true
|
|
961
|
-
}) === true) {
|
|
962
|
-
const dockerSpinner = p.spinner();
|
|
963
|
-
dockerSpinner.start("Starting Docker services");
|
|
964
|
-
try {
|
|
965
|
-
await timePhase(timings, "docker compose up", () => runDockerComposeUp(targetDir));
|
|
966
|
-
dockerSpinner.stop("Docker services ready");
|
|
967
|
-
} catch (error) {
|
|
968
|
-
dockerSpinner.stop("Docker services not started");
|
|
969
|
-
p.log.warn(`docker compose up -d --wait failed: ${error instanceof Error ? error.message : error}`);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
990
|
+
await timePhase(timings, "install dependencies", () => runBunInstall(targetDir));
|
|
991
|
+
await timePhase(timings, "generate types", () => runTypesGen(targetDir));
|
|
992
|
+
await timePhase(timings, "generate migrations", () => generateDatabaseMigrations(targetDir));
|
|
972
993
|
}
|
|
994
|
+
if (input.noInstall && initConfig?.config) await timePhase(timings, "generate code artifacts", () => generateCodeArtifacts(targetDir, initConfig.config));
|
|
973
995
|
return {
|
|
974
996
|
status: "initialized",
|
|
975
997
|
directory,
|
|
@@ -980,7 +1002,8 @@ var plugin_default = createPlugin({
|
|
|
980
1002
|
plugins,
|
|
981
1003
|
overrides,
|
|
982
1004
|
filesCopied,
|
|
983
|
-
timings
|
|
1005
|
+
timings,
|
|
1006
|
+
targetDir
|
|
984
1007
|
};
|
|
985
1008
|
} finally {
|
|
986
1009
|
await cleanup();
|
|
@@ -1155,10 +1178,10 @@ function computeAllowedWorkspaces(overrides, plugins) {
|
|
|
1155
1178
|
if (section === "ui") workspaces.push("ui");
|
|
1156
1179
|
if (section === "api") workspaces.push("api");
|
|
1157
1180
|
}
|
|
1158
|
-
if (plugins
|
|
1181
|
+
if (plugins && plugins.length > 0) workspaces.push("plugins/*");
|
|
1159
1182
|
return workspaces;
|
|
1160
1183
|
}
|
|
1161
1184
|
|
|
1162
1185
|
//#endregion
|
|
1163
|
-
export { plugin_default as default };
|
|
1186
|
+
export { consumeDevSession, plugin_default as default, pluginEvents };
|
|
1164
1187
|
//# sourceMappingURL=plugin.mjs.map
|