everything-dev 0.3.2 → 1.3.2
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/README.md +64 -0
- package/cli.js +10 -0
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/api-contract.cjs +172 -0
- package/dist/api-contract.cjs.map +1 -0
- package/dist/api-contract.mjs +171 -0
- package/dist/api-contract.mjs.map +1 -0
- package/dist/api.cjs +124 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.cts +36 -0
- package/dist/api.d.cts.map +1 -0
- package/dist/api.d.mts +36 -0
- package/dist/api.d.mts.map +1 -0
- package/dist/api.mjs +119 -0
- package/dist/api.mjs.map +1 -0
- package/dist/app.cjs +156 -0
- package/dist/app.cjs.map +1 -0
- package/dist/app.mjs +153 -0
- package/dist/app.mjs.map +1 -0
- package/dist/cli/catalog.cjs +30 -0
- package/dist/cli/catalog.cjs.map +1 -0
- package/dist/cli/catalog.mjs +29 -0
- package/dist/cli/catalog.mjs.map +1 -0
- package/dist/cli/help.cjs +16 -0
- package/dist/cli/help.cjs.map +1 -0
- package/dist/cli/help.mjs +16 -0
- package/dist/cli/help.mjs.map +1 -0
- package/dist/cli/init.cjs +317 -0
- package/dist/cli/init.cjs.map +1 -0
- package/dist/cli/init.d.cts +36 -0
- package/dist/cli/init.d.cts.map +1 -0
- package/dist/cli/init.d.mts +36 -0
- package/dist/cli/init.d.mts.map +1 -0
- package/dist/cli/init.mjs +309 -0
- package/dist/cli/init.mjs.map +1 -0
- package/dist/cli/parse.cjs +96 -0
- package/dist/cli/parse.cjs.map +1 -0
- package/dist/cli/parse.mjs +95 -0
- package/dist/cli/parse.mjs.map +1 -0
- package/dist/cli/prompts.cjs +42 -0
- package/dist/cli/prompts.cjs.map +1 -0
- package/dist/cli/prompts.mjs +41 -0
- package/dist/cli/prompts.mjs.map +1 -0
- package/dist/cli.cjs +167 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +166 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/components/dev-view.cjs +307 -0
- package/dist/components/dev-view.cjs.map +1 -0
- package/dist/components/dev-view.mjs +306 -0
- package/dist/components/dev-view.mjs.map +1 -0
- package/dist/components/streaming-view.cjs +146 -0
- package/dist/components/streaming-view.cjs.map +1 -0
- package/dist/components/streaming-view.mjs +144 -0
- package/dist/components/streaming-view.mjs.map +1 -0
- package/dist/config.cjs +280 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +35 -0
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +35 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +266 -0
- package/dist/config.mjs.map +1 -0
- package/dist/contract.cjs +209 -0
- package/dist/contract.cjs.map +1 -0
- package/dist/contract.d.cts +490 -0
- package/dist/contract.d.cts.map +1 -0
- package/dist/contract.d.mts +490 -0
- package/dist/contract.d.mts.map +1 -0
- package/dist/contract.meta.cjs +104 -0
- package/dist/contract.meta.cjs.map +1 -0
- package/dist/contract.meta.d.cts +141 -0
- package/dist/contract.meta.d.cts.map +1 -0
- package/dist/contract.meta.d.mts +141 -0
- package/dist/contract.meta.d.mts.map +1 -0
- package/dist/contract.meta.mjs +102 -0
- package/dist/contract.meta.mjs.map +1 -0
- package/dist/contract.mjs +186 -0
- package/dist/contract.mjs.map +1 -0
- package/dist/dev-logs.cjs +53 -0
- package/dist/dev-logs.cjs.map +1 -0
- package/dist/dev-logs.mjs +51 -0
- package/dist/dev-logs.mjs.map +1 -0
- package/dist/dev-session.cjs +195 -0
- package/dist/dev-session.cjs.map +1 -0
- package/dist/dev-session.mjs +194 -0
- package/dist/dev-session.mjs.map +1 -0
- package/dist/fastkv.cjs +89 -0
- package/dist/fastkv.cjs.map +1 -0
- package/dist/fastkv.d.cts +11 -0
- package/dist/fastkv.d.cts.map +1 -0
- package/dist/fastkv.d.mts +11 -0
- package/dist/fastkv.d.mts.map +1 -0
- package/dist/fastkv.mjs +82 -0
- package/dist/fastkv.mjs.map +1 -0
- package/dist/federation.server.cjs +27 -0
- package/dist/federation.server.cjs.map +1 -0
- package/dist/federation.server.mjs +27 -0
- package/dist/federation.server.mjs.map +1 -0
- package/dist/host.cjs +367 -0
- package/dist/host.cjs.map +1 -0
- package/dist/host.d.cts +22 -0
- package/dist/host.d.cts.map +1 -0
- package/dist/host.d.mts +22 -0
- package/dist/host.d.mts.map +1 -0
- package/dist/host.mjs +364 -0
- package/dist/host.mjs.map +1 -0
- package/dist/index.cjs +122 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +9 -0
- package/dist/integrity.cjs +39 -0
- package/dist/integrity.cjs.map +1 -0
- package/dist/integrity.d.cts +7 -0
- package/dist/integrity.d.cts.map +1 -0
- package/dist/integrity.d.mts +7 -0
- package/dist/integrity.d.mts.map +1 -0
- package/dist/integrity.mjs +35 -0
- package/dist/integrity.mjs.map +1 -0
- package/dist/mf.cjs +77 -0
- package/dist/mf.cjs.map +1 -0
- package/dist/mf.d.cts +19 -0
- package/dist/mf.d.cts.map +1 -0
- package/dist/mf.d.mts +19 -0
- package/dist/mf.d.mts.map +1 -0
- package/dist/mf.mjs +71 -0
- package/dist/mf.mjs.map +1 -0
- package/dist/near-cli.cjs +196 -0
- package/dist/near-cli.cjs.map +1 -0
- package/dist/near-cli.mjs +193 -0
- package/dist/near-cli.mjs.map +1 -0
- package/dist/network.cjs +9 -0
- package/dist/network.cjs.map +1 -0
- package/dist/network.mjs +8 -0
- package/dist/network.mjs.map +1 -0
- package/dist/orchestrator.cjs +441 -0
- package/dist/orchestrator.cjs.map +1 -0
- package/dist/orchestrator.d.cts +40 -0
- package/dist/orchestrator.d.cts.map +1 -0
- package/dist/orchestrator.d.mts +40 -0
- package/dist/orchestrator.d.mts.map +1 -0
- package/dist/orchestrator.mjs +436 -0
- package/dist/orchestrator.mjs.map +1 -0
- package/dist/plugin.cjs +825 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts +347 -0
- package/dist/plugin.d.cts.map +1 -0
- package/dist/plugin.d.mts +348 -0
- package/dist/plugin.d.mts.map +1 -0
- package/dist/plugin.mjs +822 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/process-registry.cjs +120 -0
- package/dist/process-registry.cjs.map +1 -0
- package/dist/process-registry.d.cts +25 -0
- package/dist/process-registry.d.cts.map +1 -0
- package/dist/process-registry.d.mts +25 -0
- package/dist/process-registry.d.mts.map +1 -0
- package/dist/process-registry.mjs +119 -0
- package/dist/process-registry.mjs.map +1 -0
- package/dist/sdk.cjs +61 -0
- package/dist/sdk.d.cts +5 -0
- package/dist/sdk.d.mts +5 -0
- package/dist/sdk.mjs +6 -0
- package/dist/shared.cjs +143 -0
- package/dist/shared.cjs.map +1 -0
- package/dist/shared.d.cts +33 -0
- package/dist/shared.d.cts.map +1 -0
- package/dist/shared.d.mts +33 -0
- package/dist/shared.d.mts.map +1 -0
- package/dist/shared.mjs +140 -0
- package/dist/shared.mjs.map +1 -0
- package/dist/types.cjs +160 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +269 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +269 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +144 -0
- package/dist/types.mjs.map +1 -0
- package/dist/ui/head.cjs +67 -0
- package/dist/ui/head.cjs.map +1 -0
- package/dist/ui/head.d.cts +19 -0
- package/dist/ui/head.d.cts.map +1 -0
- package/dist/ui/head.d.mts +19 -0
- package/dist/ui/head.d.mts.map +1 -0
- package/dist/ui/head.mjs +61 -0
- package/dist/ui/head.mjs.map +1 -0
- package/dist/ui/index.cjs +32 -0
- package/dist/ui/index.d.cts +7 -0
- package/dist/ui/index.d.mts +7 -0
- package/dist/ui/index.mjs +6 -0
- package/dist/ui/metadata.cjs +106 -0
- package/dist/ui/metadata.cjs.map +1 -0
- package/dist/ui/metadata.d.cts +35 -0
- package/dist/ui/metadata.d.cts.map +1 -0
- package/dist/ui/metadata.d.mts +35 -0
- package/dist/ui/metadata.d.mts.map +1 -0
- package/dist/ui/metadata.mjs +100 -0
- package/dist/ui/metadata.mjs.map +1 -0
- package/dist/ui/router.cjs +56 -0
- package/dist/ui/router.cjs.map +1 -0
- package/dist/ui/router.d.cts +11 -0
- package/dist/ui/router.d.cts.map +1 -0
- package/dist/ui/router.d.mts +11 -0
- package/dist/ui/router.d.mts.map +1 -0
- package/dist/ui/router.mjs +51 -0
- package/dist/ui/router.mjs.map +1 -0
- package/dist/ui/runtime.cjs +65 -0
- package/dist/ui/runtime.cjs.map +1 -0
- package/dist/ui/runtime.d.cts +29 -0
- package/dist/ui/runtime.d.cts.map +1 -0
- package/dist/ui/runtime.d.mts +29 -0
- package/dist/ui/runtime.d.mts.map +1 -0
- package/dist/ui/runtime.mjs +53 -0
- package/dist/ui/runtime.mjs.map +1 -0
- package/dist/ui/types.cjs +0 -0
- package/dist/ui/types.d.cts +52 -0
- package/dist/ui/types.d.cts.map +1 -0
- package/dist/ui/types.d.mts +52 -0
- package/dist/ui/types.d.mts.map +1 -0
- package/dist/ui/types.mjs +1 -0
- package/dist/utils/banner.cjs +24 -0
- package/dist/utils/banner.cjs.map +1 -0
- package/dist/utils/banner.mjs +23 -0
- package/dist/utils/banner.mjs.map +1 -0
- package/dist/utils/linkify.cjs +15 -0
- package/dist/utils/linkify.cjs.map +1 -0
- package/dist/utils/linkify.mjs +14 -0
- package/dist/utils/linkify.mjs.map +1 -0
- package/dist/utils/run.cjs +40 -0
- package/dist/utils/run.cjs.map +1 -0
- package/dist/utils/run.mjs +39 -0
- package/dist/utils/run.mjs.map +1 -0
- package/dist/utils/theme.cjs +44 -0
- package/dist/utils/theme.cjs.map +1 -0
- package/dist/utils/theme.mjs +37 -0
- package/dist/utils/theme.mjs.map +1 -0
- package/package.json +269 -80
- package/src/api-contract.ts +309 -0
- package/src/api.ts +181 -0
- package/src/app.ts +346 -0
- package/src/cli/catalog.ts +49 -0
- package/src/cli/help.ts +13 -0
- package/src/cli/init.ts +415 -0
- package/src/cli/parse.ts +130 -0
- package/src/cli/prompts.ts +64 -0
- package/src/cli.ts +203 -1507
- package/src/components/dev-view.tsx +104 -41
- package/src/components/streaming-view.ts +89 -22
- package/src/config.ts +462 -532
- package/src/contract.meta.ts +96 -0
- package/src/contract.ts +164 -561
- package/src/dev-logs.ts +85 -0
- package/src/dev-session.ts +318 -0
- package/src/fastkv.ts +153 -0
- package/src/federation.server.ts +43 -0
- package/src/host.ts +526 -0
- package/src/index.ts +6 -3
- package/src/integrity.ts +54 -0
- package/src/mf.ts +105 -0
- package/src/near-cli.ts +284 -0
- package/src/network.ts +3 -0
- package/src/orchestrator.ts +648 -0
- package/src/plugin.ts +1116 -2303
- package/src/process-registry.ts +154 -0
- package/src/scripts/sync-api-contract.ts +24 -0
- package/src/sdk.ts +14 -0
- package/src/shared.ts +206 -0
- package/src/types.ts +152 -206
- package/src/ui/head.ts +34 -27
- package/src/ui/index.ts +3 -3
- package/src/ui/metadata.ts +95 -0
- package/src/ui/router.ts +22 -6
- package/src/ui/runtime.ts +55 -6
- package/src/ui/types.ts +24 -11
- package/src/utils/banner.ts +10 -6
- package/src/utils/run.ts +26 -27
- package/src/utils/theme.ts +3 -66
- package/src/components/monitor-view.tsx +0 -475
- package/src/components/status-view.tsx +0 -173
- package/src/lib/env.ts +0 -109
- package/src/lib/near-cli.ts +0 -289
- package/src/lib/nova.ts +0 -266
- package/src/lib/orchestrator.ts +0 -276
- package/src/lib/process-registry.ts +0 -166
- package/src/lib/process.ts +0 -549
- package/src/lib/resource-monitor/assertions.ts +0 -234
- package/src/lib/resource-monitor/command.ts +0 -283
- package/src/lib/resource-monitor/diff.ts +0 -157
- package/src/lib/resource-monitor/errors.ts +0 -127
- package/src/lib/resource-monitor/index.ts +0 -305
- package/src/lib/resource-monitor/platform/darwin.ts +0 -306
- package/src/lib/resource-monitor/platform/index.ts +0 -35
- package/src/lib/resource-monitor/platform/linux.ts +0 -332
- package/src/lib/resource-monitor/platform/windows.ts +0 -298
- package/src/lib/resource-monitor/snapshot.ts +0 -217
- package/src/lib/resource-monitor/types.ts +0 -74
- package/src/lib/session-recorder/errors.ts +0 -102
- package/src/lib/session-recorder/flows/login.ts +0 -210
- package/src/lib/session-recorder/index.ts +0 -361
- package/src/lib/session-recorder/playwright.ts +0 -257
- package/src/lib/session-recorder/report.ts +0 -353
- package/src/lib/session-recorder/server.ts +0 -267
- package/src/lib/session-recorder/types.ts +0 -115
- package/src/lib/sync.ts +0 -1
- package/src/ui/files.ts +0 -134
package/src/ui/runtime.ts
CHANGED
|
@@ -1,35 +1,84 @@
|
|
|
1
|
+
import { getNetworkIdForAccount } from "../network";
|
|
1
2
|
import type { ClientRuntimeConfig } from "../types";
|
|
2
3
|
|
|
4
|
+
export type { ClientRuntimeInfo } from "../types";
|
|
5
|
+
|
|
3
6
|
declare global {
|
|
4
7
|
interface Window {
|
|
5
8
|
__RUNTIME_CONFIG__?: ClientRuntimeConfig;
|
|
6
9
|
}
|
|
7
10
|
}
|
|
8
11
|
|
|
9
|
-
export function getRuntimeConfig(): ClientRuntimeConfig
|
|
10
|
-
if (typeof window === "undefined")
|
|
12
|
+
export function getRuntimeConfig(): ClientRuntimeConfig {
|
|
13
|
+
if (typeof window === "undefined") {
|
|
14
|
+
throw new Error("Runtime config is only available in the browser");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (!window.__RUNTIME_CONFIG__) {
|
|
18
|
+
throw new Error("Missing runtime config");
|
|
19
|
+
}
|
|
20
|
+
|
|
11
21
|
return window.__RUNTIME_CONFIG__;
|
|
12
22
|
}
|
|
13
23
|
|
|
14
|
-
export function
|
|
24
|
+
export function getActiveRuntime(runtimeConfig?: Partial<ClientRuntimeConfig>) {
|
|
25
|
+
return runtimeConfig?.runtime;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function getRuntimeBasePath(runtimeConfig?: Partial<ClientRuntimeConfig>) {
|
|
29
|
+
return getActiveRuntime(runtimeConfig)?.runtimeBasePath || "/";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function buildRuntimeHref(pathname: string, runtimeConfig?: Partial<ClientRuntimeConfig>) {
|
|
33
|
+
const basePath = getRuntimeBasePath(runtimeConfig);
|
|
34
|
+
if (basePath === "/") {
|
|
35
|
+
return pathname;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!pathname.startsWith("/")) {
|
|
39
|
+
return `${basePath}/${pathname}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return pathname === "/" ? basePath : `${basePath}${pathname}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function buildPublishedAccountHref(accountId: string) {
|
|
46
|
+
return `/apps/${encodeURIComponent(accountId)}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function buildPublishedGatewayHref(accountId: string, gatewayId: string) {
|
|
50
|
+
return `${buildPublishedAccountHref(accountId)}/${encodeURIComponent(gatewayId)}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function getAssetsUrl(config?: Partial<ClientRuntimeConfig>): string {
|
|
15
54
|
const cfg = config ?? getRuntimeConfig();
|
|
16
55
|
return cfg?.assetsUrl ?? "";
|
|
17
56
|
}
|
|
18
57
|
|
|
19
|
-
export function getHostUrl(config?: ClientRuntimeConfig): string {
|
|
58
|
+
export function getHostUrl(config?: Partial<ClientRuntimeConfig>): string {
|
|
20
59
|
const cfg = config ?? getRuntimeConfig();
|
|
21
60
|
if (typeof window === "undefined") return "";
|
|
22
61
|
return cfg?.hostUrl ?? window.location.origin;
|
|
23
62
|
}
|
|
24
63
|
|
|
25
|
-
export function getApiBaseUrl(config?: ClientRuntimeConfig): string {
|
|
64
|
+
export function getApiBaseUrl(config?: Partial<ClientRuntimeConfig>): string {
|
|
26
65
|
const cfg = config ?? getRuntimeConfig();
|
|
27
66
|
const base = cfg?.rpcBase;
|
|
28
67
|
if (typeof window === "undefined") return "/api/rpc";
|
|
29
68
|
return base ? `${window.location.origin}${base}` : `${window.location.origin}/api/rpc`;
|
|
30
69
|
}
|
|
31
70
|
|
|
32
|
-
export function getAccount(config?: ClientRuntimeConfig): string {
|
|
71
|
+
export function getAccount(config?: Partial<ClientRuntimeConfig>): string {
|
|
33
72
|
const cfg = config ?? getRuntimeConfig();
|
|
34
73
|
return cfg?.account ?? "every.near";
|
|
35
74
|
}
|
|
75
|
+
|
|
76
|
+
export function getNetworkId(config?: Partial<ClientRuntimeConfig>): "mainnet" | "testnet" {
|
|
77
|
+
const cfg = config ?? getRuntimeConfig();
|
|
78
|
+
return cfg?.networkId ?? getNetworkIdForAccount(cfg?.account ?? "every.near");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function getRepository(config?: Partial<ClientRuntimeConfig>): string | undefined {
|
|
82
|
+
const cfg = config ?? getRuntimeConfig();
|
|
83
|
+
return cfg?.repository;
|
|
84
|
+
}
|
package/src/ui/types.ts
CHANGED
|
@@ -2,15 +2,22 @@ import type { QueryClient } from "@tanstack/react-query";
|
|
|
2
2
|
import type { AnyRouteMatch, AnyRouter, RouterHistory } from "@tanstack/react-router";
|
|
3
3
|
import type { ClientRuntimeConfig } from "../types";
|
|
4
4
|
|
|
5
|
-
export interface RouterContext {
|
|
5
|
+
export interface RouterContext<TSession = unknown> {
|
|
6
6
|
queryClient: QueryClient;
|
|
7
7
|
assetsUrl: string;
|
|
8
|
-
runtimeConfig?: ClientRuntimeConfig
|
|
8
|
+
runtimeConfig?: Partial<ClientRuntimeConfig>;
|
|
9
|
+
session?: TSession;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export interface
|
|
12
|
+
export interface RouterContextWithApi<TApiClient = unknown, TSession = unknown>
|
|
13
|
+
extends RouterContext<TSession> {
|
|
14
|
+
apiClient?: TApiClient;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CreateRouterOptions<TApiClient = unknown, TSession = unknown> {
|
|
12
18
|
history?: RouterHistory;
|
|
13
|
-
context?: Partial<
|
|
19
|
+
context?: Partial<RouterContextWithApi<TApiClient, TSession>>;
|
|
20
|
+
basepath?: string;
|
|
14
21
|
}
|
|
15
22
|
|
|
16
23
|
export type HeadMeta = NonNullable<AnyRouteMatch["meta"]>[number];
|
|
@@ -23,9 +30,16 @@ export interface HeadData {
|
|
|
23
30
|
scripts: HeadScript[];
|
|
24
31
|
}
|
|
25
32
|
|
|
26
|
-
export interface RenderOptions {
|
|
33
|
+
export interface RenderOptions<TSession = unknown> {
|
|
27
34
|
assetsUrl: string;
|
|
28
|
-
runtimeConfig: ClientRuntimeConfig
|
|
35
|
+
runtimeConfig: Partial<ClientRuntimeConfig>;
|
|
36
|
+
basepath?: string;
|
|
37
|
+
session?: TSession;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface RenderOptionsWithApi<TApiClient = unknown, TSession = unknown>
|
|
41
|
+
extends RenderOptions<TSession> {
|
|
42
|
+
apiClient: TApiClient;
|
|
29
43
|
}
|
|
30
44
|
|
|
31
45
|
export interface RenderResult {
|
|
@@ -34,18 +48,17 @@ export interface RenderResult {
|
|
|
34
48
|
headers: Headers;
|
|
35
49
|
}
|
|
36
50
|
|
|
37
|
-
export interface RouterModule {
|
|
38
|
-
createRouter: (opts?: CreateRouterOptions) => {
|
|
51
|
+
export interface RouterModule<TApiClient = unknown, TSession = unknown> {
|
|
52
|
+
createRouter: (opts?: CreateRouterOptions<TApiClient, TSession>) => {
|
|
39
53
|
router: AnyRouter;
|
|
40
54
|
queryClient: QueryClient;
|
|
41
55
|
};
|
|
42
56
|
getRouteHead: (
|
|
43
57
|
pathname: string,
|
|
44
|
-
context?: Partial<
|
|
58
|
+
context?: Partial<RouterContextWithApi<TApiClient, TSession>>,
|
|
45
59
|
) => Promise<HeadData>;
|
|
46
60
|
renderToStream: (
|
|
47
61
|
request: Request,
|
|
48
|
-
options:
|
|
62
|
+
options: RenderOptionsWithApi<TApiClient, TSession>,
|
|
49
63
|
) => Promise<RenderResult>;
|
|
50
|
-
routeTree: AnyRouter["routeTree"];
|
|
51
64
|
}
|
package/src/utils/banner.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import { colors, divider, gradients } from "./theme";
|
|
2
3
|
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const pkg = require("../../package.json") as { version: string };
|
|
6
|
+
|
|
3
7
|
const ASCII_BOS = `
|
|
4
8
|
██████╗ ██████╗ ███████╗
|
|
5
9
|
██╔══██╗██╔═══██╗██╔════╝
|
|
@@ -8,10 +12,10 @@ const ASCII_BOS = `
|
|
|
8
12
|
██████╔╝╚██████╔╝███████║
|
|
9
13
|
╚═════╝ ╚═════╝ ╚══════╝`;
|
|
10
14
|
|
|
11
|
-
export function printBanner(title = "everything-dev", version =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
export function printBanner(title = "everything-dev", version = pkg.version) {
|
|
16
|
+
console.log(gradients.cyber(ASCII_BOS));
|
|
17
|
+
console.log();
|
|
18
|
+
console.log(colors.dim(` ${title} ${colors.cyan(`v${version}`)}`));
|
|
19
|
+
console.log(colors.dim(` ${divider(30)}`));
|
|
20
|
+
console.log();
|
|
17
21
|
}
|
package/src/utils/run.ts
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
import { type Options as ExecaOptions, execa } from "execa";
|
|
3
|
-
import { getProjectRoot } from "../config";
|
|
1
|
+
type RunResult = { stdout: string; stderr: string; exitCode: number };
|
|
4
2
|
|
|
5
3
|
export async function run(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
) {
|
|
10
|
-
|
|
4
|
+
cmd: string,
|
|
5
|
+
args: string[],
|
|
6
|
+
options: { cwd?: string; env?: Record<string, string>; capture?: boolean } = {},
|
|
7
|
+
): Promise<RunResult | undefined> {
|
|
8
|
+
const proc = Bun.spawn({
|
|
9
|
+
cmd: [cmd, ...args],
|
|
10
|
+
cwd: options.cwd,
|
|
11
|
+
env: options.env ? { ...(process.env as Record<string, string>), ...options.env } : process.env,
|
|
12
|
+
stdio: options.capture ? ["inherit", "pipe", "pipe"] : ["inherit", "inherit", "inherit"],
|
|
13
|
+
});
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
}
|
|
15
|
+
if (!options.capture) {
|
|
16
|
+
const exitCode = await proc.exited;
|
|
17
|
+
if (exitCode !== 0) {
|
|
18
|
+
throw new Error(`${cmd} ${args.join(" ")} failed with exit code ${exitCode}`);
|
|
19
|
+
}
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
process.exit(result.exitCode);
|
|
31
|
-
}
|
|
23
|
+
const [stdout, stderr, exitCode] = await Promise.all([
|
|
24
|
+
new Response(proc.stdout).text(),
|
|
25
|
+
new Response(proc.stderr).text(),
|
|
26
|
+
proc.exited,
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
const result = { stdout, stderr, exitCode };
|
|
30
|
+
return result;
|
|
32
31
|
}
|
package/src/utils/theme.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import gradient from "gradient-string";
|
|
2
1
|
import chalk from "chalk";
|
|
2
|
+
import gradient from "gradient-string";
|
|
3
3
|
|
|
4
|
-
export const gradients = {
|
|
4
|
+
export const gradients: Record<string, (text: string) => string> = {
|
|
5
5
|
cyber: gradient(["#00ffff", "#ff00ff"]),
|
|
6
|
-
matrix: gradient(["#003300", "#00ff41"]),
|
|
7
|
-
frost: gradient(["#0080ff", "#00ffff"]),
|
|
8
|
-
neon: gradient(["#00ff41", "#00ffff"]),
|
|
9
6
|
};
|
|
10
7
|
|
|
11
8
|
export const colors = {
|
|
@@ -13,89 +10,29 @@ export const colors = {
|
|
|
13
10
|
magenta: chalk.hex("#ff00ff"),
|
|
14
11
|
green: chalk.hex("#00ff41"),
|
|
15
12
|
blue: chalk.hex("#0080ff"),
|
|
16
|
-
purple: chalk.hex("#bf00ff"),
|
|
17
13
|
white: chalk.hex("#f0f0f0"),
|
|
18
14
|
gray: chalk.hex("#555555"),
|
|
19
15
|
dim: chalk.dim,
|
|
20
|
-
bold: chalk.bold,
|
|
21
16
|
error: chalk.hex("#ff3366"),
|
|
22
17
|
};
|
|
23
18
|
|
|
24
19
|
export const icons = {
|
|
25
|
-
config: "◆",
|
|
26
|
-
host: "●",
|
|
27
|
-
pkg: "▸",
|
|
28
20
|
scan: "○",
|
|
29
21
|
run: "▶",
|
|
30
|
-
test: "◇",
|
|
31
|
-
db: "▪",
|
|
32
|
-
clean: "✕",
|
|
33
22
|
ok: "✓",
|
|
34
23
|
err: "✗",
|
|
35
24
|
pending: "○",
|
|
36
25
|
arrow: "→",
|
|
37
|
-
line: "─",
|
|
38
26
|
dot: "·",
|
|
39
|
-
bar: "│",
|
|
40
|
-
corner: "└",
|
|
41
27
|
app: "◉",
|
|
28
|
+
config: "⚙",
|
|
42
29
|
};
|
|
43
30
|
|
|
44
31
|
export const frames = {
|
|
45
32
|
top: (width: number) => `┌${"─".repeat(width - 2)}┐`,
|
|
46
33
|
bottom: (width: number) => `└${"─".repeat(width - 2)}┘`,
|
|
47
|
-
side: "│",
|
|
48
|
-
empty: (width: number) => `│${" ".repeat(width - 2)}│`,
|
|
49
34
|
};
|
|
50
35
|
|
|
51
|
-
export function box(content: string, width = 50): string {
|
|
52
|
-
const lines = content.split("\n");
|
|
53
|
-
const maxLen = Math.max(...lines.map((l) => l.length), width - 4);
|
|
54
|
-
const innerWidth = maxLen + 2;
|
|
55
|
-
const totalWidth = innerWidth + 2;
|
|
56
|
-
|
|
57
|
-
const top = frames.top(totalWidth);
|
|
58
|
-
const bottom = frames.bottom(totalWidth);
|
|
59
|
-
const body = lines
|
|
60
|
-
.map((line) => {
|
|
61
|
-
const padding = " ".repeat(maxLen - stripAnsi(line).length);
|
|
62
|
-
return `${frames.side} ${line}${padding} ${frames.side}`;
|
|
63
|
-
})
|
|
64
|
-
.join("\n");
|
|
65
|
-
|
|
66
|
-
return `${top}\n${body}\n${bottom}`;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function stripAnsi(str: string): string {
|
|
70
|
-
const ansiPattern = new RegExp("\\x1b\\[[0-9;]*m", "g");
|
|
71
|
-
return str.replace(ansiPattern, "");
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function header(text: string): string {
|
|
75
|
-
const styled = gradients.cyber(text);
|
|
76
|
-
return box(styled);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
36
|
export function divider(width = 48): string {
|
|
80
37
|
return colors.dim("─".repeat(width));
|
|
81
38
|
}
|
|
82
|
-
|
|
83
|
-
export function label(text: string): string {
|
|
84
|
-
return colors.cyan(text);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function value(text: string): string {
|
|
88
|
-
return colors.white(text);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function success(text: string): string {
|
|
92
|
-
return colors.green(text);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export function error(text: string): string {
|
|
96
|
-
return colors.error(text);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function statusIcon(ok: boolean): string {
|
|
100
|
-
return ok ? success(icons.ok) : error(icons.err);
|
|
101
|
-
}
|