everything-dev 1.16.1 → 1.16.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-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/infra.cjs +127 -0
- package/dist/cli/infra.cjs.map +1 -0
- package/dist/cli/infra.mjs +124 -0
- package/dist/cli/infra.mjs.map +1 -0
- package/dist/cli/init.cjs +9 -0
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +2 -1
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts +2 -1
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +9 -1
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/sync.cjs +6 -0
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +6 -0
- 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 +66 -47
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +66 -47
- 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/contract.cjs +7 -0
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +22 -1
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +22 -1
- 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 +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- 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 +56 -39
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +8 -0
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +8 -0
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +54 -37
- package/dist/plugin.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api-contract.ts +21 -3
- package/src/cli/infra.ts +190 -0
- package/src/cli/init.ts +4 -0
- package/src/cli/sync.ts +9 -0
- package/src/cli/timing.ts +36 -0
- package/src/cli/upgrade.ts +82 -53
- package/src/cli.ts +15 -0
- package/src/contract.ts +8 -0
- package/src/dev-session.ts +1 -1
- package/src/plugin.ts +98 -67
package/dist/plugin.d.cts
CHANGED
|
@@ -307,6 +307,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
307
307
|
extends: z.ZodString;
|
|
308
308
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
309
309
|
filesCopied: z.ZodNumber;
|
|
310
|
+
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
311
|
+
name: z.ZodString;
|
|
312
|
+
durationMs: z.ZodNumber;
|
|
313
|
+
}, z.core.$strip>>>;
|
|
310
314
|
error: z.ZodOptional<z.ZodString>;
|
|
311
315
|
}, z.core.$strip>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
312
316
|
sync: ContractProcedure<z.ZodObject<{
|
|
@@ -354,6 +358,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
354
358
|
migrated: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
355
359
|
availablePlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
356
360
|
selectedPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
361
|
+
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
362
|
+
name: z.ZodString;
|
|
363
|
+
durationMs: z.ZodNumber;
|
|
364
|
+
}, z.core.$strip>>>;
|
|
357
365
|
changelogUrl: z.ZodOptional<z.ZodString>;
|
|
358
366
|
error: z.ZodOptional<z.ZodString>;
|
|
359
367
|
}, z.core.$strip>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
package/dist/plugin.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;cAoDwC,QAAA"}
|
package/dist/plugin.d.mts
CHANGED
|
@@ -307,6 +307,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
307
307
|
extends: z.ZodString;
|
|
308
308
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
309
309
|
filesCopied: z.ZodNumber;
|
|
310
|
+
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
311
|
+
name: z.ZodString;
|
|
312
|
+
durationMs: z.ZodNumber;
|
|
313
|
+
}, z.core.$strip>>>;
|
|
310
314
|
error: z.ZodOptional<z.ZodString>;
|
|
311
315
|
}, z.core.$strip>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
312
316
|
sync: ContractProcedure<z.ZodObject<{
|
|
@@ -354,6 +358,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
354
358
|
migrated: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
355
359
|
availablePlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
356
360
|
selectedPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
361
|
+
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
362
|
+
name: z.ZodString;
|
|
363
|
+
durationMs: z.ZodNumber;
|
|
364
|
+
}, z.core.$strip>>>;
|
|
357
365
|
changelogUrl: z.ZodOptional<z.ZodString>;
|
|
358
366
|
error: z.ZodOptional<z.ZodString>;
|
|
359
367
|
}, z.core.$strip>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
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
|
@@ -5,41 +5,29 @@ import { buildRuntimePluginsForConfig, findConfigPath, getHostDevelopmentPort, g
|
|
|
5
5
|
import { bosContract } from "./contract.mjs";
|
|
6
6
|
import { syncApiContractBridge } from "./api-contract.mjs";
|
|
7
7
|
import { buildRuntimeConfig, detectLocalPackages, prepareDevelopmentRuntimeConfig } from "./app.mjs";
|
|
8
|
+
import { ensureEnvFile, writeGeneratedInfra } from "./cli/infra.mjs";
|
|
8
9
|
import { saveBosConfig } from "./utils/save-config.mjs";
|
|
9
|
-
import { copyFilteredFiles, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, readTemplatekeep, resolveSourceDir, runBunInstall, runTypesGen, writeInitSnapshot } from "./cli/init.mjs";
|
|
10
|
+
import { copyFilteredFiles, fetchParentConfig, generateDatabaseMigrations, personalizeConfig, readTemplatekeep, resolveSourceDir, runBunInstall, runDockerComposeUp, runTypesGen, writeInitSnapshot } from "./cli/init.mjs";
|
|
10
11
|
import { promptInitOptions } from "./cli/prompts.mjs";
|
|
11
12
|
import { getStatus } from "./cli/status.mjs";
|
|
12
13
|
import { syncTemplate } from "./cli/sync.mjs";
|
|
14
|
+
import { timePhase } from "./cli/timing.mjs";
|
|
13
15
|
import { upgradeTemplate } from "./cli/upgrade.mjs";
|
|
14
|
-
import { colors } from "./utils/theme.mjs";
|
|
15
16
|
import { computeSriHashForUrl } from "./integrity.mjs";
|
|
16
|
-
import { buildDescription, buildServiceDescriptorMap } from "./service-descriptor.mjs";
|
|
17
|
-
import { devApp, startApp } from "./dev-session.mjs";
|
|
18
17
|
import { addFunctionCallAccessKey, ensureNearCli, executeTransaction } from "./near-cli.mjs";
|
|
18
|
+
import { buildDescription, buildServiceDescriptorMap } from "./service-descriptor.mjs";
|
|
19
19
|
import { syncAndGenerateSharedUi } from "./shared.mjs";
|
|
20
20
|
import { writePluginSidebarGen } from "./sidebar.mjs";
|
|
21
21
|
import { run } from "./utils/run.mjs";
|
|
22
|
+
import { colors } from "./utils/theme.mjs";
|
|
22
23
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
23
24
|
import { basename, dirname, join, resolve } from "node:path";
|
|
24
|
-
import { randomBytes } from "node:crypto";
|
|
25
25
|
import * as p from "@clack/prompts";
|
|
26
26
|
import { Effect } from "effect";
|
|
27
27
|
|
|
28
28
|
//#region src/plugin.ts
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
const examplePath = join(configDir, ".env.example");
|
|
32
|
-
if (existsSync(envPath)) return;
|
|
33
|
-
if (!existsSync(examplePath)) return;
|
|
34
|
-
const lines = readFileSync(examplePath, "utf-8").split("\n");
|
|
35
|
-
const secret = randomBytes(32).toString("base64url");
|
|
36
|
-
const corsOrigin = opts?.domain ? `http://localhost:3000,https://${opts.domain}` : "http://localhost:3000";
|
|
37
|
-
writeFileSync(envPath, lines.map((line) => {
|
|
38
|
-
if (/^BETTER_AUTH_SECRET=/.test(line)) return `BETTER_AUTH_SECRET=${secret}`;
|
|
39
|
-
if (/^CORS_ORIGIN=/.test(line)) return `CORS_ORIGIN=${corsOrigin}`;
|
|
40
|
-
return line;
|
|
41
|
-
}).join("\n"));
|
|
42
|
-
p.log.info(`Created .env from .env.example with generated BETTER_AUTH_SECRET`);
|
|
29
|
+
async function loadDevSession() {
|
|
30
|
+
return import("./dev-session.mjs");
|
|
43
31
|
}
|
|
44
32
|
const buildCommands = {
|
|
45
33
|
host: {
|
|
@@ -546,6 +534,7 @@ var plugin_default = createPlugin({
|
|
|
546
534
|
port: runtimeConfig.host.port,
|
|
547
535
|
interactive: input.interactive
|
|
548
536
|
};
|
|
537
|
+
const { devApp } = await loadDevSession();
|
|
549
538
|
devApp(orchestrator, services, runtimeConfig);
|
|
550
539
|
return {
|
|
551
540
|
status: "started",
|
|
@@ -624,7 +613,7 @@ var plugin_default = createPlugin({
|
|
|
624
613
|
}
|
|
625
614
|
summaryLines.push("");
|
|
626
615
|
console.log(summaryLines.join("\n"));
|
|
627
|
-
|
|
616
|
+
const orchestrator = {
|
|
628
617
|
packages: ["host"],
|
|
629
618
|
env: {
|
|
630
619
|
NODE_ENV: "production",
|
|
@@ -635,7 +624,9 @@ var plugin_default = createPlugin({
|
|
|
635
624
|
port,
|
|
636
625
|
interactive: input.interactive,
|
|
637
626
|
noLogs: true
|
|
638
|
-
}
|
|
627
|
+
};
|
|
628
|
+
const { startApp } = await loadDevSession();
|
|
629
|
+
startApp(orchestrator, services, runtimeConfig);
|
|
639
630
|
return {
|
|
640
631
|
status: "running",
|
|
641
632
|
url: `http://localhost:${port}`
|
|
@@ -833,6 +824,7 @@ var plugin_default = createPlugin({
|
|
|
833
824
|
}),
|
|
834
825
|
init: builder.init.handler(async ({ input }) => {
|
|
835
826
|
try {
|
|
827
|
+
const timings = [];
|
|
836
828
|
let extendsAccount = input.extendsAccount;
|
|
837
829
|
let extendsGateway = input.extendsGateway;
|
|
838
830
|
let directory = input.directory;
|
|
@@ -852,7 +844,7 @@ var plugin_default = createPlugin({
|
|
|
852
844
|
let parentPluginKeys = [];
|
|
853
845
|
let parentConfig = null;
|
|
854
846
|
try {
|
|
855
|
-
parentConfig = await fetchParentConfig(extendsAccount, extendsGateway);
|
|
847
|
+
parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway));
|
|
856
848
|
if (parentConfig?.plugins && typeof parentConfig.plugins === "object") parentPluginKeys = Object.keys(parentConfig.plugins);
|
|
857
849
|
} catch {}
|
|
858
850
|
if (!input.noInteractive) {
|
|
@@ -876,9 +868,10 @@ var plugin_default = createPlugin({
|
|
|
876
868
|
plugins = prompted.plugins;
|
|
877
869
|
}
|
|
878
870
|
directory = directory || domain || extendsGateway;
|
|
871
|
+
const targetDir = resolve(directory);
|
|
879
872
|
plugins = plugins ?? [];
|
|
880
873
|
if (!parentConfig) try {
|
|
881
|
-
parentConfig = await fetchParentConfig(extendsAccount, extendsGateway);
|
|
874
|
+
parentConfig = await timePhase(timings, "parent config", () => fetchParentConfig(extendsAccount, extendsGateway));
|
|
882
875
|
} catch {
|
|
883
876
|
return {
|
|
884
877
|
status: "error",
|
|
@@ -890,14 +883,15 @@ var plugin_default = createPlugin({
|
|
|
890
883
|
extends: `bos://${extendsAccount}/${extendsGateway}`,
|
|
891
884
|
plugins: plugins ?? [],
|
|
892
885
|
filesCopied: 0,
|
|
886
|
+
timings,
|
|
893
887
|
error: `No config found at bos://${extendsAccount}/${extendsGateway} — are you sure this is the right parent?`
|
|
894
888
|
};
|
|
895
889
|
}
|
|
896
|
-
const { sourceDir, parentConfig: resolvedParentConfig, cleanup } = await resolveSourceDir({
|
|
890
|
+
const { sourceDir, parentConfig: resolvedParentConfig, cleanup } = await timePhase(timings, "template source", () => resolveSourceDir({
|
|
897
891
|
extendsAccount,
|
|
898
892
|
extendsGateway,
|
|
899
893
|
source: input.source
|
|
900
|
-
});
|
|
894
|
+
}));
|
|
901
895
|
parentConfig = resolvedParentConfig;
|
|
902
896
|
try {
|
|
903
897
|
const patterns = await readTemplatekeep(sourceDir);
|
|
@@ -920,12 +914,12 @@ var plugin_default = createPlugin({
|
|
|
920
914
|
}
|
|
921
915
|
const s = p.spinner();
|
|
922
916
|
s.start("Setting up project");
|
|
923
|
-
const filesCopied = await copyFilteredFiles(sourceDir,
|
|
917
|
+
const filesCopied = await timePhase(timings, "copy files", () => copyFilteredFiles(sourceDir, targetDir, patterns, {
|
|
924
918
|
withHost,
|
|
925
919
|
plugins,
|
|
926
920
|
pluginRoutes
|
|
927
|
-
});
|
|
928
|
-
await personalizeConfig(
|
|
921
|
+
}));
|
|
922
|
+
await timePhase(timings, "personalize config", () => personalizeConfig(targetDir, {
|
|
929
923
|
extendsAccount,
|
|
930
924
|
extendsGateway,
|
|
931
925
|
account: account || extendsAccount,
|
|
@@ -934,21 +928,42 @@ var plugin_default = createPlugin({
|
|
|
934
928
|
pluginRoutes,
|
|
935
929
|
workspaceOpts: { sourceDir },
|
|
936
930
|
withHost
|
|
937
|
-
});
|
|
938
|
-
await writeInitSnapshot(
|
|
931
|
+
}));
|
|
932
|
+
await timePhase(timings, "write snapshot", () => writeInitSnapshot(targetDir, extendsAccount, extendsGateway, sourceDir, patterns, {
|
|
939
933
|
withHost,
|
|
940
934
|
plugins,
|
|
941
935
|
pluginRoutes
|
|
936
|
+
}));
|
|
937
|
+
const initConfig = await timePhase(timings, "resolve config", () => loadConfig({ cwd: targetDir }));
|
|
938
|
+
if (initConfig?.runtime) await timePhase(timings, "generate env/docker", async () => {
|
|
939
|
+
writeGeneratedInfra(targetDir, initConfig.runtime);
|
|
940
|
+
});
|
|
941
|
+
await timePhase(timings, "create env file", async () => {
|
|
942
|
+
ensureEnvFile(targetDir);
|
|
942
943
|
});
|
|
943
|
-
ensureEnvFile(directory, { domain });
|
|
944
944
|
if (!input.noInstall) {
|
|
945
|
-
await runBunInstall(
|
|
946
|
-
await runTypesGen(
|
|
947
|
-
await generateDatabaseMigrations(
|
|
945
|
+
await timePhase(timings, "install dependencies", () => runBunInstall(targetDir));
|
|
946
|
+
await timePhase(timings, "generate types", () => runTypesGen(targetDir));
|
|
947
|
+
await timePhase(timings, "generate migrations", () => generateDatabaseMigrations(targetDir));
|
|
948
948
|
}
|
|
949
|
-
|
|
950
|
-
if (initConfig?.config) await generateCodeArtifacts(directory, initConfig.config);
|
|
949
|
+
if (input.noInstall && initConfig?.config) await timePhase(timings, "generate code artifacts", () => generateCodeArtifacts(targetDir, initConfig.config));
|
|
951
950
|
s.stop("Project initialized");
|
|
951
|
+
if (!input.noInteractive) {
|
|
952
|
+
if (await p.confirm({
|
|
953
|
+
message: "Run docker compose up -d --wait?",
|
|
954
|
+
initialValue: true
|
|
955
|
+
}) === true) {
|
|
956
|
+
const dockerSpinner = p.spinner();
|
|
957
|
+
dockerSpinner.start("Starting Docker services");
|
|
958
|
+
try {
|
|
959
|
+
await timePhase(timings, "docker compose up", () => runDockerComposeUp(targetDir));
|
|
960
|
+
dockerSpinner.stop("Docker services ready");
|
|
961
|
+
} catch (error) {
|
|
962
|
+
dockerSpinner.stop("Docker services not started");
|
|
963
|
+
p.log.warn(`docker compose up -d --wait failed: ${error instanceof Error ? error.message : error}`);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
}
|
|
952
967
|
return {
|
|
953
968
|
status: "initialized",
|
|
954
969
|
directory,
|
|
@@ -958,7 +973,8 @@ var plugin_default = createPlugin({
|
|
|
958
973
|
domain,
|
|
959
974
|
extends: `bos://${extendsAccount}/${extendsGateway}`,
|
|
960
975
|
plugins,
|
|
961
|
-
filesCopied
|
|
976
|
+
filesCopied,
|
|
977
|
+
timings
|
|
962
978
|
};
|
|
963
979
|
} finally {
|
|
964
980
|
await cleanup();
|
|
@@ -974,6 +990,7 @@ var plugin_default = createPlugin({
|
|
|
974
990
|
extends: input.extendsAccount && input.extendsGateway ? `bos://${input.extendsAccount}/${input.extendsGateway}` : "",
|
|
975
991
|
plugins: input.plugins ?? [],
|
|
976
992
|
filesCopied: 0,
|
|
993
|
+
timings: [],
|
|
977
994
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
978
995
|
};
|
|
979
996
|
}
|