viagen 0.1.3 → 0.1.5
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.js +6 -2
- package/dist/index.js +18 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -118,11 +118,15 @@ async function deploySandbox(opts) {
|
|
|
118
118
|
...opts.git.revision ? { revision: opts.git.revision } : {}
|
|
119
119
|
}
|
|
120
120
|
} : {};
|
|
121
|
+
const hasAppCommand = !!opts.envVars?.["VIAGEN_APP_COMMAND"];
|
|
122
|
+
const appPort = parseInt(opts.envVars?.["VIAGEN_APP_PORT"] || "5173", 10);
|
|
123
|
+
const serverPort = parseInt(opts.envVars?.["VIAGEN_SERVER_PORT"] || "5199", 10);
|
|
124
|
+
const sandboxPorts = hasAppCommand ? [serverPort, appPort] : [appPort];
|
|
121
125
|
let sandbox2;
|
|
122
126
|
try {
|
|
123
127
|
sandbox2 = await Sandbox.create({
|
|
124
128
|
runtime: "node22",
|
|
125
|
-
ports:
|
|
129
|
+
ports: sandboxPorts,
|
|
126
130
|
timeout: timeoutMs,
|
|
127
131
|
...sourceOpts
|
|
128
132
|
});
|
|
@@ -243,7 +247,7 @@ async function deploySandbox(opts) {
|
|
|
243
247
|
args: ["-c", devCmd],
|
|
244
248
|
detached: true
|
|
245
249
|
});
|
|
246
|
-
const baseUrl = sandbox2.domain(
|
|
250
|
+
const baseUrl = sandbox2.domain(hasAppCommand ? serverPort : appPort);
|
|
247
251
|
const url = `${baseUrl}/t/${token}`;
|
|
248
252
|
const dots2 = startDots(" Starting dev server");
|
|
249
253
|
const ready = await waitForServer(baseUrl, token, devServer);
|
package/dist/index.js
CHANGED
|
@@ -111,7 +111,7 @@ function registerHealthRoutes(server, env, errorRef) {
|
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
|
-
const currentVersion = true ? "0.1.
|
|
114
|
+
const currentVersion = true ? "0.1.5" : "0.0.0";
|
|
115
115
|
debug("health", `version resolved: ${currentVersion}`);
|
|
116
116
|
let versionCache = null;
|
|
117
117
|
server.middlewares.use("/via/version", (_req, res) => {
|
|
@@ -19346,11 +19346,15 @@ async function deploySandbox(opts) {
|
|
|
19346
19346
|
...opts.git.revision ? { revision: opts.git.revision } : {}
|
|
19347
19347
|
}
|
|
19348
19348
|
} : {};
|
|
19349
|
+
const hasAppCommand = !!opts.envVars?.["VIAGEN_APP_COMMAND"];
|
|
19350
|
+
const appPort = parseInt(opts.envVars?.["VIAGEN_APP_PORT"] || "5173", 10);
|
|
19351
|
+
const serverPort = parseInt(opts.envVars?.["VIAGEN_SERVER_PORT"] || "5199", 10);
|
|
19352
|
+
const sandboxPorts = hasAppCommand ? [serverPort, appPort] : [appPort];
|
|
19349
19353
|
let sandbox;
|
|
19350
19354
|
try {
|
|
19351
19355
|
sandbox = await Sandbox.create({
|
|
19352
19356
|
runtime: "node22",
|
|
19353
|
-
ports:
|
|
19357
|
+
ports: sandboxPorts,
|
|
19354
19358
|
timeout: timeoutMs,
|
|
19355
19359
|
...sourceOpts
|
|
19356
19360
|
});
|
|
@@ -19471,7 +19475,7 @@ async function deploySandbox(opts) {
|
|
|
19471
19475
|
args: ["-c", devCmd],
|
|
19472
19476
|
detached: true
|
|
19473
19477
|
});
|
|
19474
|
-
const baseUrl = sandbox.domain(
|
|
19478
|
+
const baseUrl = sandbox.domain(hasAppCommand ? serverPort : appPort);
|
|
19475
19479
|
const url2 = `${baseUrl}/t/${token}`;
|
|
19476
19480
|
const dots2 = startDots(" Starting dev server");
|
|
19477
19481
|
const ready = await waitForServer(baseUrl, token, devServer);
|
|
@@ -19519,7 +19523,7 @@ function viagen(options) {
|
|
|
19519
19523
|
config(_, { mode }) {
|
|
19520
19524
|
const e = loadEnv(mode, process.cwd(), "");
|
|
19521
19525
|
const serverConfig = {};
|
|
19522
|
-
if (e["VIAGEN_AUTH_TOKEN"] || e["VIAGEN_USER_TOKEN"]) {
|
|
19526
|
+
if (e["VIAGEN_AUTH_TOKEN"] || e["VIAGEN_USER_TOKEN"] || e["VIAGEN_PROMPT"]) {
|
|
19523
19527
|
serverConfig.host = true;
|
|
19524
19528
|
serverConfig.allowedHosts = true;
|
|
19525
19529
|
}
|
|
@@ -19528,6 +19532,11 @@ function viagen(options) {
|
|
|
19528
19532
|
serverConfig.port = viagenPort;
|
|
19529
19533
|
serverConfig.strictPort = true;
|
|
19530
19534
|
}
|
|
19535
|
+
const childAppPort = e["VIAGEN_APP_PORT"] || process.env["VIAGEN_APP_PORT"] || process.env["PORT"];
|
|
19536
|
+
if (process.env["__VIAGEN_CHILD"] && childAppPort) {
|
|
19537
|
+
serverConfig.port = parseInt(childAppPort, 10);
|
|
19538
|
+
serverConfig.strictPort = true;
|
|
19539
|
+
}
|
|
19531
19540
|
if (Object.keys(serverConfig).length > 0) {
|
|
19532
19541
|
return { server: serverConfig };
|
|
19533
19542
|
}
|
|
@@ -19749,6 +19758,11 @@ Page URL: ${pageUrl}`);
|
|
|
19749
19758
|
appPort
|
|
19750
19759
|
});
|
|
19751
19760
|
processManager.start();
|
|
19761
|
+
const cleanup = () => {
|
|
19762
|
+
processManager?.stop().finally(() => process.exit());
|
|
19763
|
+
};
|
|
19764
|
+
process.on("SIGINT", cleanup);
|
|
19765
|
+
process.on("SIGTERM", cleanup);
|
|
19752
19766
|
}
|
|
19753
19767
|
let mcpServers;
|
|
19754
19768
|
const hasPlatformContext = !!(viagenClient && projectId);
|