everything-dev 0.0.16 → 0.0.17
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/package.json +1 -1
- package/src/lib/orchestrator.ts +21 -20
- package/src/lib/process.ts +8 -10
- package/src/plugin.ts +2 -0
package/package.json
CHANGED
package/src/lib/orchestrator.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { appendFile } from "node:fs/promises";
|
|
|
2
2
|
import { BunContext, BunRuntime } from "@effect/platform-bun";
|
|
3
3
|
import { Effect } from "every-plugin/effect";
|
|
4
4
|
import path from "path";
|
|
5
|
-
import type { AppConfig } from "../config";
|
|
6
5
|
import {
|
|
7
6
|
type DevViewHandle,
|
|
8
7
|
type LogEntry,
|
|
9
8
|
type ProcessState,
|
|
10
9
|
renderDevView,
|
|
11
10
|
} from "../components/dev-view";
|
|
12
|
-
import { renderStreamingView
|
|
11
|
+
import { renderStreamingView } from "../components/streaming-view";
|
|
12
|
+
import type { AppConfig, BosConfig } from "../config";
|
|
13
13
|
import { getProcessConfig, makeDevProcess, type ProcessCallbacks, type ProcessHandle } from "./process";
|
|
14
14
|
|
|
15
15
|
const LOG_NOISE_PATTERNS = [
|
|
@@ -32,6 +32,7 @@ export interface AppOrchestrator {
|
|
|
32
32
|
env: Record<string, string>;
|
|
33
33
|
description: string;
|
|
34
34
|
appConfig: AppConfig;
|
|
35
|
+
bosConfig?: BosConfig;
|
|
35
36
|
port?: number;
|
|
36
37
|
interactive?: boolean;
|
|
37
38
|
noLogs?: boolean;
|
|
@@ -79,12 +80,12 @@ export const runDevServers = (orchestrator: AppOrchestrator) =>
|
|
|
79
80
|
const initialProcesses: ProcessState[] = orderedPackages.map((pkg) => {
|
|
80
81
|
const portOverride = pkg === "host" ? orchestrator.port : undefined;
|
|
81
82
|
const config = getProcessConfig(pkg, undefined, portOverride);
|
|
82
|
-
const source = pkg === "host"
|
|
83
|
-
? orchestrator.appConfig.host
|
|
83
|
+
const source = pkg === "host"
|
|
84
|
+
? orchestrator.appConfig.host
|
|
84
85
|
: pkg === "ui" || pkg === "ui-ssr"
|
|
85
86
|
? orchestrator.appConfig.ui
|
|
86
|
-
: pkg === "api"
|
|
87
|
-
? orchestrator.appConfig.api
|
|
87
|
+
: pkg === "api"
|
|
88
|
+
? orchestrator.appConfig.api
|
|
88
89
|
: undefined;
|
|
89
90
|
return {
|
|
90
91
|
name: pkg,
|
|
@@ -139,22 +140,22 @@ export const runDevServers = (orchestrator: AppOrchestrator) =>
|
|
|
139
140
|
};
|
|
140
141
|
|
|
141
142
|
const useInteractive = orchestrator.interactive ?? isInteractiveSupported();
|
|
142
|
-
|
|
143
|
+
|
|
143
144
|
view = useInteractive
|
|
144
145
|
? renderDevView(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
initialProcesses,
|
|
147
|
+
orchestrator.description,
|
|
148
|
+
orchestrator.env,
|
|
149
|
+
() => cleanup(false),
|
|
150
|
+
() => cleanup(true)
|
|
151
|
+
)
|
|
151
152
|
: renderStreamingView(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
initialProcesses,
|
|
154
|
+
orchestrator.description,
|
|
155
|
+
orchestrator.env,
|
|
156
|
+
() => cleanup(false),
|
|
157
|
+
() => cleanup(true)
|
|
158
|
+
);
|
|
158
159
|
|
|
159
160
|
const callbacks: ProcessCallbacks = {
|
|
160
161
|
onStatus: (name, status, message) => {
|
|
@@ -182,7 +183,7 @@ export const runDevServers = (orchestrator: AppOrchestrator) =>
|
|
|
182
183
|
|
|
183
184
|
for (const pkg of orderedPackages) {
|
|
184
185
|
const portOverride = pkg === "host" ? orchestrator.port : undefined;
|
|
185
|
-
const handle = yield* makeDevProcess(pkg, orchestrator.env, callbacks, portOverride);
|
|
186
|
+
const handle = yield* makeDevProcess(pkg, orchestrator.env, callbacks, portOverride, orchestrator.bosConfig);
|
|
186
187
|
handles.push(handle);
|
|
187
188
|
|
|
188
189
|
yield* Effect.race(
|
package/src/lib/process.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
1
|
import { Command } from "@effect/platform";
|
|
3
2
|
import { Deferred, Effect, Fiber, Ref, Stream } from "every-plugin/effect";
|
|
4
|
-
import { getConfigDir, getPortsFromConfig, type SourceMode } from "../config";
|
|
3
|
+
import { type BosConfig, getConfigDir, getPortsFromConfig, type SourceMode } from "../config";
|
|
5
4
|
import type { ProcessStatus } from "../components/dev-view";
|
|
6
5
|
import { loadSecretsFor } from "./secrets";
|
|
7
6
|
|
|
@@ -204,7 +203,7 @@ interface ServerHandle {
|
|
|
204
203
|
}
|
|
205
204
|
|
|
206
205
|
interface BootstrapConfig {
|
|
207
|
-
|
|
206
|
+
config?: BosConfig;
|
|
208
207
|
secrets?: Record<string, string>;
|
|
209
208
|
host?: { url?: string };
|
|
210
209
|
ui?: { source?: SourceMode };
|
|
@@ -255,7 +254,8 @@ const patchConsole = (
|
|
|
255
254
|
|
|
256
255
|
export const spawnRemoteHost = (
|
|
257
256
|
config: DevProcess,
|
|
258
|
-
callbacks: ProcessCallbacks
|
|
257
|
+
callbacks: ProcessCallbacks,
|
|
258
|
+
bosConfig?: BosConfig
|
|
259
259
|
) =>
|
|
260
260
|
Effect.gen(function* () {
|
|
261
261
|
const remoteUrl = config.env?.HOST_REMOTE_URL;
|
|
@@ -272,9 +272,6 @@ export const spawnRemoteHost = (
|
|
|
272
272
|
|
|
273
273
|
callbacks.onStatus(config.name, "starting");
|
|
274
274
|
|
|
275
|
-
const configDir = getConfigDir();
|
|
276
|
-
const configPath = resolve(configDir, "bos.config.json");
|
|
277
|
-
|
|
278
275
|
let hostUrl = `http://localhost:${config.port}`;
|
|
279
276
|
if (process.env.HOST_URL) {
|
|
280
277
|
hostUrl = process.env.HOST_URL;
|
|
@@ -289,7 +286,7 @@ export const spawnRemoteHost = (
|
|
|
289
286
|
const apiProxy = config.env?.API_PROXY;
|
|
290
287
|
|
|
291
288
|
const bootstrap: BootstrapConfig = {
|
|
292
|
-
|
|
289
|
+
config: bosConfig,
|
|
293
290
|
secrets: allSecrets,
|
|
294
291
|
host: { url: hostUrl },
|
|
295
292
|
ui: { source: uiSource },
|
|
@@ -364,7 +361,8 @@ export const makeDevProcess = (
|
|
|
364
361
|
pkg: string,
|
|
365
362
|
env: Record<string, string> | undefined,
|
|
366
363
|
callbacks: ProcessCallbacks,
|
|
367
|
-
portOverride?: number
|
|
364
|
+
portOverride?: number,
|
|
365
|
+
bosConfig?: BosConfig
|
|
368
366
|
) =>
|
|
369
367
|
Effect.gen(function* () {
|
|
370
368
|
const config = getProcessConfig(pkg, env, portOverride);
|
|
@@ -373,7 +371,7 @@ export const makeDevProcess = (
|
|
|
373
371
|
}
|
|
374
372
|
|
|
375
373
|
if (pkg === "host" && env?.HOST_SOURCE === "remote") {
|
|
376
|
-
return yield* spawnRemoteHost(config, callbacks);
|
|
374
|
+
return yield* spawnRemoteHost(config, callbacks, bosConfig);
|
|
377
375
|
}
|
|
378
376
|
|
|
379
377
|
return yield* spawnDevProcess(config, callbacks);
|
package/src/plugin.ts
CHANGED
|
@@ -224,6 +224,7 @@ export default createPlugin({
|
|
|
224
224
|
env,
|
|
225
225
|
description,
|
|
226
226
|
appConfig,
|
|
227
|
+
bosConfig: deps.bosConfig ?? undefined,
|
|
227
228
|
port: input.port,
|
|
228
229
|
interactive: input.interactive,
|
|
229
230
|
};
|
|
@@ -322,6 +323,7 @@ export default createPlugin({
|
|
|
322
323
|
ui: "remote",
|
|
323
324
|
api: "remote",
|
|
324
325
|
},
|
|
326
|
+
bosConfig: config,
|
|
325
327
|
port,
|
|
326
328
|
interactive: input.interactive,
|
|
327
329
|
noLogs: true,
|