@walkeros/cli 0.3.5 → 0.3.6
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/CHANGELOG.md +10 -0
- package/README.md +22 -0
- package/dist/commands/bundle/index.d.ts.map +1 -1
- package/dist/commands/bundle/index.js +2 -2
- package/dist/commands/bundle/index.js.map +1 -1
- package/dist/commands/run/index.d.ts.map +1 -1
- package/dist/commands/run/index.js +8 -3
- package/dist/commands/run/index.js.map +1 -1
- package/dist/commands/run/types.d.ts +8 -4
- package/dist/commands/run/types.d.ts.map +1 -1
- package/dist/config/utils.d.ts +34 -4
- package/dist/config/utils.d.ts.map +1 -1
- package/dist/config/utils.js +95 -7
- package/dist/config/utils.js.map +1 -1
- package/dist/core/docker.d.ts +8 -4
- package/dist/core/docker.d.ts.map +1 -1
- package/dist/core/docker.js +50 -15
- package/dist/core/docker.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +158 -72
- package/dist/index.js.map +1 -1
- package/examples/README.md +330 -0
- package/examples/server-collect.json +53 -0
- package/examples/server-collect.mjs +13370 -0
- package/examples/web-serve.json +74 -0
- package/examples/web-serve.mjs +19456 -0
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -432,8 +432,10 @@ interface RunCommandOptions extends GlobalOptions {
|
|
|
432
432
|
port?: number;
|
|
433
433
|
/** Server host (default: 0.0.0.0) */
|
|
434
434
|
host?: string;
|
|
435
|
-
/**
|
|
436
|
-
|
|
435
|
+
/** Serve path (URL directory path, e.g., 'libs/v1') */
|
|
436
|
+
servePath?: string;
|
|
437
|
+
/** Serve name (filename in URL, default: walker.js) */
|
|
438
|
+
serveName?: string;
|
|
437
439
|
/** Enable JSON output */
|
|
438
440
|
json?: boolean;
|
|
439
441
|
}
|
|
@@ -447,8 +449,10 @@ interface RunOptions {
|
|
|
447
449
|
port?: number;
|
|
448
450
|
/** Server host */
|
|
449
451
|
host?: string;
|
|
450
|
-
/**
|
|
451
|
-
|
|
452
|
+
/** Serve path (URL directory path, e.g., 'libs/v1') */
|
|
453
|
+
servePath?: string;
|
|
454
|
+
/** Serve name (filename in URL, default: walker.js) */
|
|
455
|
+
serveName?: string;
|
|
452
456
|
/** Suppress output */
|
|
453
457
|
silent?: boolean;
|
|
454
458
|
/** Verbose logging */
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAY5C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC;AAItD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAIrC,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC7E,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,SAAS,GACV,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
5
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
6
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
7
|
+
import { dirname, join } from "path";
|
|
8
8
|
|
|
9
9
|
// src/core/logger.ts
|
|
10
10
|
import chalk from "chalk";
|
|
@@ -123,14 +123,106 @@ function formatBytes(bytes) {
|
|
|
123
123
|
|
|
124
124
|
// src/core/docker.ts
|
|
125
125
|
import { spawn } from "child_process";
|
|
126
|
+
import path2 from "path";
|
|
127
|
+
import { readFileSync } from "fs";
|
|
128
|
+
import { fileURLToPath } from "url";
|
|
129
|
+
import { VERSION as DOCKER_VERSION } from "@walkeros/docker";
|
|
130
|
+
|
|
131
|
+
// src/config/utils.ts
|
|
132
|
+
import fs from "fs-extra";
|
|
126
133
|
import path from "path";
|
|
127
|
-
|
|
128
|
-
|
|
134
|
+
import os from "os";
|
|
135
|
+
function isUrl(str) {
|
|
136
|
+
try {
|
|
137
|
+
const url = new URL(str);
|
|
138
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
139
|
+
} catch {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async function downloadFromUrl(url) {
|
|
144
|
+
if (!isUrl(url)) {
|
|
145
|
+
throw new Error(`Invalid URL: ${url}`);
|
|
146
|
+
}
|
|
147
|
+
try {
|
|
148
|
+
const response = await fetch(url);
|
|
149
|
+
if (!response.ok) {
|
|
150
|
+
throw new Error(
|
|
151
|
+
`Failed to download ${url}: ${response.status} ${response.statusText}`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
const content = await response.text();
|
|
155
|
+
const urlObj = new URL(url);
|
|
156
|
+
const urlFilename = path.basename(urlObj.pathname);
|
|
157
|
+
const extension = path.extname(urlFilename) || ".json";
|
|
158
|
+
const randomId = Math.random().toString(36).substring(2, 11);
|
|
159
|
+
const filename = `walkeros-download-${Date.now()}-${randomId}${extension}`;
|
|
160
|
+
const tempPath = path.join(os.tmpdir(), filename);
|
|
161
|
+
await fs.writeFile(tempPath, content, "utf-8");
|
|
162
|
+
return tempPath;
|
|
163
|
+
} catch (error) {
|
|
164
|
+
if (error instanceof Error) {
|
|
165
|
+
throw new Error(`Failed to download from URL: ${error.message}`);
|
|
166
|
+
}
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function loadJsonConfig(configPath) {
|
|
171
|
+
let absolutePath;
|
|
172
|
+
let isTemporary = false;
|
|
173
|
+
if (isUrl(configPath)) {
|
|
174
|
+
absolutePath = await downloadFromUrl(configPath);
|
|
175
|
+
isTemporary = true;
|
|
176
|
+
} else {
|
|
177
|
+
absolutePath = path.resolve(configPath);
|
|
178
|
+
if (!await fs.pathExists(absolutePath)) {
|
|
179
|
+
throw new Error(`Configuration file not found: ${absolutePath}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
const rawConfig = await fs.readJson(absolutePath);
|
|
184
|
+
return rawConfig;
|
|
185
|
+
} catch (error) {
|
|
186
|
+
throw new Error(
|
|
187
|
+
`Invalid JSON in config file: ${configPath}. ${error instanceof Error ? error.message : error}`
|
|
188
|
+
);
|
|
189
|
+
} finally {
|
|
190
|
+
if (isTemporary) {
|
|
191
|
+
try {
|
|
192
|
+
await fs.remove(absolutePath);
|
|
193
|
+
} catch {
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function getTempDir(tempDir = ".tmp") {
|
|
199
|
+
const randomId = Math.random().toString(36).substring(2, 11);
|
|
200
|
+
const basePath = path.isAbsolute(tempDir) ? tempDir : path.join(process.cwd(), tempDir);
|
|
201
|
+
return path.join(basePath, `cli-${Date.now()}-${randomId}`);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// src/core/docker.ts
|
|
205
|
+
function readPackageVersion() {
|
|
206
|
+
const moduleFilename = fileURLToPath(import.meta.url);
|
|
207
|
+
const moduleDir = path2.dirname(moduleFilename);
|
|
208
|
+
const prodPath = path2.join(moduleDir, "../package.json");
|
|
209
|
+
try {
|
|
210
|
+
const pkg = JSON.parse(readFileSync(prodPath, "utf-8"));
|
|
211
|
+
return pkg.version;
|
|
212
|
+
} catch {
|
|
213
|
+
const devPath = path2.join(moduleDir, "../../package.json");
|
|
214
|
+
const pkg = JSON.parse(readFileSync(devPath, "utf-8"));
|
|
215
|
+
return pkg.version;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
var CLI_VERSION = readPackageVersion();
|
|
219
|
+
var CLI_DOCKER_IMAGE = process.env.WALKEROS_CLI_DOCKER_IMAGE || `walkeros/cli:${CLI_VERSION}`;
|
|
220
|
+
var RUNTIME_DOCKER_IMAGE = process.env.WALKEROS_RUNTIME_DOCKER_IMAGE || `walkeros/docker:${DOCKER_VERSION}`;
|
|
129
221
|
function buildDockerCommand(command, args, options = {}, configFile) {
|
|
130
222
|
const cwd = process.cwd();
|
|
131
223
|
const cmd = ["docker", "run", "--rm"];
|
|
132
|
-
if (configFile) {
|
|
133
|
-
const configPath =
|
|
224
|
+
if (configFile && !isUrl(configFile)) {
|
|
225
|
+
const configPath = path2.resolve(cwd, configFile);
|
|
134
226
|
cmd.push("-v", `${configPath}:/config/flow.json:ro`);
|
|
135
227
|
args = args.map((arg) => arg === configFile ? "/config/flow.json" : arg);
|
|
136
228
|
}
|
|
@@ -195,21 +287,26 @@ function buildDockerRunCommand(mode, flowPath, options = {}) {
|
|
|
195
287
|
const cmd = ["docker", "run", "--rm"];
|
|
196
288
|
cmd.push("-e", `MODE=${mode}`);
|
|
197
289
|
if (mode === "collect" && flowPath) {
|
|
198
|
-
const absoluteFlowPath =
|
|
290
|
+
const absoluteFlowPath = path2.resolve(cwd, flowPath);
|
|
199
291
|
cmd.push("-v", `${absoluteFlowPath}:/app/flow.mjs:ro`);
|
|
200
292
|
cmd.push("-e", "FLOW=/app/flow.mjs");
|
|
201
293
|
}
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
cmd.push("-
|
|
294
|
+
if (mode === "serve" && flowPath) {
|
|
295
|
+
const absoluteFilePath = path2.resolve(cwd, flowPath);
|
|
296
|
+
cmd.push("-v", `${absoluteFilePath}:/app/bundle.mjs:ro`);
|
|
297
|
+
cmd.push("-e", "FILE_PATH=/app/bundle.mjs");
|
|
205
298
|
}
|
|
299
|
+
const port = options.port !== void 0 ? options.port : 8080;
|
|
300
|
+
cmd.push("-p", `${port}:${port}`);
|
|
301
|
+
cmd.push("-e", `PORT=${port}`);
|
|
206
302
|
if (options.host) {
|
|
207
303
|
cmd.push("-e", `HOST=${options.host}`);
|
|
208
304
|
}
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
305
|
+
if (options.serveName) {
|
|
306
|
+
cmd.push("-e", `SERVE_NAME=${options.serveName}`);
|
|
307
|
+
}
|
|
308
|
+
if (options.servePath) {
|
|
309
|
+
cmd.push("-e", `SERVE_PATH=${options.servePath}`);
|
|
213
310
|
}
|
|
214
311
|
if (process.platform !== "win32") {
|
|
215
312
|
try {
|
|
@@ -284,29 +381,29 @@ async function executeCommand(localHandler, dockerCommand, dockerArgs, options,
|
|
|
284
381
|
}
|
|
285
382
|
|
|
286
383
|
// src/core/asset-resolver.ts
|
|
287
|
-
import { fileURLToPath } from "url";
|
|
288
|
-
import
|
|
384
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
385
|
+
import path3 from "path";
|
|
289
386
|
function getPackageRoot() {
|
|
290
|
-
const currentFile =
|
|
387
|
+
const currentFile = fileURLToPath2(import.meta.url);
|
|
291
388
|
if (currentFile.includes("/src/")) {
|
|
292
389
|
const srcIndex = currentFile.indexOf("/src/");
|
|
293
390
|
return currentFile.substring(0, srcIndex);
|
|
294
391
|
}
|
|
295
|
-
return
|
|
392
|
+
return path3.resolve(currentFile, "../..");
|
|
296
393
|
}
|
|
297
394
|
function resolveAsset(assetPath, assetType, baseDir) {
|
|
298
395
|
const packageRoot = getPackageRoot();
|
|
299
396
|
if (!assetPath.includes("/") && !assetPath.includes("\\")) {
|
|
300
397
|
if (assetType === "template") {
|
|
301
|
-
return
|
|
398
|
+
return path3.join(packageRoot, "templates", assetPath);
|
|
302
399
|
}
|
|
303
|
-
return
|
|
400
|
+
return path3.join(packageRoot, "examples", assetPath);
|
|
304
401
|
}
|
|
305
|
-
if (
|
|
402
|
+
if (path3.isAbsolute(assetPath)) {
|
|
306
403
|
return assetPath;
|
|
307
404
|
}
|
|
308
405
|
const resolveBase = baseDir || process.cwd();
|
|
309
|
-
return
|
|
406
|
+
return path3.resolve(resolveBase, assetPath);
|
|
310
407
|
}
|
|
311
408
|
|
|
312
409
|
// src/config/validators.ts
|
|
@@ -323,29 +420,6 @@ function isSingleEnvConfig(data) {
|
|
|
323
420
|
return isObject(data) && "flow" in data && "build" in data && isObject(data.flow) && isObject(data.build) && "platform" in data.flow && validatePlatform(data.flow.platform);
|
|
324
421
|
}
|
|
325
422
|
|
|
326
|
-
// src/config/utils.ts
|
|
327
|
-
import fs from "fs-extra";
|
|
328
|
-
import path3 from "path";
|
|
329
|
-
async function loadJsonConfig(configPath) {
|
|
330
|
-
const absolutePath = path3.resolve(configPath);
|
|
331
|
-
if (!await fs.pathExists(absolutePath)) {
|
|
332
|
-
throw new Error(`Configuration file not found: ${absolutePath}`);
|
|
333
|
-
}
|
|
334
|
-
try {
|
|
335
|
-
const rawConfig = await fs.readJson(absolutePath);
|
|
336
|
-
return rawConfig;
|
|
337
|
-
} catch (error) {
|
|
338
|
-
throw new Error(
|
|
339
|
-
`Invalid JSON in config file: ${configPath}. ${error instanceof Error ? error.message : error}`
|
|
340
|
-
);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
function getTempDir(tempDir = ".tmp") {
|
|
344
|
-
const randomId = Math.random().toString(36).substring(2, 11);
|
|
345
|
-
const basePath = path3.isAbsolute(tempDir) ? tempDir : path3.join(process.cwd(), tempDir);
|
|
346
|
-
return path3.join(basePath, `cli-${Date.now()}-${randomId}`);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
423
|
// src/config/defaults.ts
|
|
350
424
|
function getDefaultBuildOptions(platform, code, output) {
|
|
351
425
|
const common = {
|
|
@@ -612,10 +686,10 @@ async function resolveDependencies(pkg, packageDir, logger, visited = /* @__PURE
|
|
|
612
686
|
try {
|
|
613
687
|
const packageJsonPath = path5.join(packageDir, "package.json");
|
|
614
688
|
if (await fs2.pathExists(packageJsonPath)) {
|
|
615
|
-
const
|
|
689
|
+
const packageJson2 = await fs2.readJson(packageJsonPath);
|
|
616
690
|
const deps = {
|
|
617
|
-
...
|
|
618
|
-
...
|
|
691
|
+
...packageJson2.dependencies,
|
|
692
|
+
...packageJson2.peerDependencies
|
|
619
693
|
};
|
|
620
694
|
for (const [name, versionSpec] of Object.entries(deps)) {
|
|
621
695
|
if (typeof versionSpec === "string") {
|
|
@@ -1241,7 +1315,7 @@ async function bundleCommand(options) {
|
|
|
1241
1315
|
throw new Error("Cannot use both --env and --all flags together");
|
|
1242
1316
|
}
|
|
1243
1317
|
logger.info("\u{1F4E6} Reading configuration...");
|
|
1244
|
-
const configPath =
|
|
1318
|
+
const configPath = options.config;
|
|
1245
1319
|
const rawConfig = await loadJsonConfig(configPath);
|
|
1246
1320
|
const configsToBundle = options.all ? loadAllEnvironments(rawConfig, { configPath, logger }) : [
|
|
1247
1321
|
loadBundleConfig(rawConfig, {
|
|
@@ -1378,7 +1452,7 @@ async function bundle(configOrPath, options = {}) {
|
|
|
1378
1452
|
}
|
|
1379
1453
|
|
|
1380
1454
|
// src/commands/simulate/simulator.ts
|
|
1381
|
-
import
|
|
1455
|
+
import path7 from "path";
|
|
1382
1456
|
import fs5 from "fs-extra";
|
|
1383
1457
|
|
|
1384
1458
|
// src/commands/simulate/tracker.ts
|
|
@@ -1415,9 +1489,9 @@ var CallTracker = class {
|
|
|
1415
1489
|
}
|
|
1416
1490
|
for (const fullPath of paths) {
|
|
1417
1491
|
const [destKey, ...pathParts] = fullPath.split(":");
|
|
1418
|
-
const
|
|
1419
|
-
if (!
|
|
1420
|
-
const cleanPath =
|
|
1492
|
+
const path9 = pathParts.join(":");
|
|
1493
|
+
if (!path9) continue;
|
|
1494
|
+
const cleanPath = path9.replace(/^call:/, "");
|
|
1421
1495
|
const parts = cleanPath.split(".");
|
|
1422
1496
|
let current = wrapped;
|
|
1423
1497
|
let source = env;
|
|
@@ -1472,7 +1546,7 @@ async function simulateCore(configPath, event, options = {}) {
|
|
|
1472
1546
|
try {
|
|
1473
1547
|
logger.info("\u{1F3AF} Starting walkerOS simulation...");
|
|
1474
1548
|
logger.info("\u{1F4E6} Loading bundle configuration...");
|
|
1475
|
-
const fullConfigPath =
|
|
1549
|
+
const fullConfigPath = path7.resolve(configPath);
|
|
1476
1550
|
const rawConfig = await loadJsonConfig(fullConfigPath);
|
|
1477
1551
|
parseBundleConfig(rawConfig);
|
|
1478
1552
|
logger.info(`\u{1F680} Executing simulation with event: ${JSON.stringify(event)}`);
|
|
@@ -1567,7 +1641,7 @@ ${envSetupCode.join("\n")}
|
|
|
1567
1641
|
|
|
1568
1642
|
${buildOptions.code || ""}
|
|
1569
1643
|
`;
|
|
1570
|
-
const tempOutput =
|
|
1644
|
+
const tempOutput = path7.join(
|
|
1571
1645
|
tempDir,
|
|
1572
1646
|
`simulation-bundle-${generateId()}.mjs`
|
|
1573
1647
|
);
|
|
@@ -1723,8 +1797,8 @@ async function simulate(configOrPath, event, options = {}) {
|
|
|
1723
1797
|
}
|
|
1724
1798
|
|
|
1725
1799
|
// src/commands/run/index.ts
|
|
1726
|
-
import
|
|
1727
|
-
import
|
|
1800
|
+
import path8 from "path";
|
|
1801
|
+
import os2 from "os";
|
|
1728
1802
|
import {
|
|
1729
1803
|
runFlow,
|
|
1730
1804
|
runServeMode
|
|
@@ -1782,17 +1856,17 @@ async function runCommand(mode, options) {
|
|
|
1782
1856
|
let flowPath = null;
|
|
1783
1857
|
if (mode === "collect") {
|
|
1784
1858
|
if (isPreBuilt) {
|
|
1785
|
-
flowPath =
|
|
1859
|
+
flowPath = path8.resolve(configPath);
|
|
1786
1860
|
if (!options.json && !options.silent) {
|
|
1787
|
-
logger.info(`\u{1F4E6} Using pre-built flow: ${
|
|
1861
|
+
logger.info(`\u{1F4E6} Using pre-built flow: ${path8.basename(flowPath)}`);
|
|
1788
1862
|
}
|
|
1789
1863
|
} else {
|
|
1790
1864
|
if (!options.json && !options.silent) {
|
|
1791
1865
|
logger.info("\u{1F528} Building flow bundle...");
|
|
1792
1866
|
}
|
|
1793
1867
|
const rawConfig = await loadJsonConfig(configPath);
|
|
1794
|
-
const tempPath =
|
|
1795
|
-
|
|
1868
|
+
const tempPath = path8.join(
|
|
1869
|
+
os2.tmpdir(),
|
|
1796
1870
|
`walkeros-${Date.now()}-${Math.random().toString(36).slice(2, 9)}.mjs`
|
|
1797
1871
|
);
|
|
1798
1872
|
const existingBuild = typeof rawConfig === "object" && rawConfig !== null && "build" in rawConfig && typeof rawConfig.build === "object" ? rawConfig.build : {};
|
|
@@ -1828,7 +1902,8 @@ async function runCommand(mode, options) {
|
|
|
1828
1902
|
await executeRunInDocker(mode, flowPath, {
|
|
1829
1903
|
port: options.port,
|
|
1830
1904
|
host: options.host,
|
|
1831
|
-
|
|
1905
|
+
serveName: options.serveName,
|
|
1906
|
+
servePath: options.servePath,
|
|
1832
1907
|
silent: options.silent
|
|
1833
1908
|
});
|
|
1834
1909
|
} else {
|
|
@@ -1852,7 +1927,9 @@ async function runCommand(mode, options) {
|
|
|
1852
1927
|
const config = {
|
|
1853
1928
|
port: options.port,
|
|
1854
1929
|
host: options.host,
|
|
1855
|
-
|
|
1930
|
+
serveName: options.serveName,
|
|
1931
|
+
servePath: options.servePath,
|
|
1932
|
+
filePath: flowPath || void 0
|
|
1856
1933
|
};
|
|
1857
1934
|
await runServeMode(config);
|
|
1858
1935
|
break;
|
|
@@ -1895,11 +1972,11 @@ async function run(mode, options) {
|
|
|
1895
1972
|
const isPreBuilt = flowFile.endsWith(".mjs") || flowFile.endsWith(".js") || flowFile.endsWith(".cjs");
|
|
1896
1973
|
let flowPath;
|
|
1897
1974
|
if (isPreBuilt) {
|
|
1898
|
-
flowPath =
|
|
1975
|
+
flowPath = path8.resolve(flowFile);
|
|
1899
1976
|
} else {
|
|
1900
1977
|
const rawConfig = await loadJsonConfig(flowFile);
|
|
1901
|
-
const tempPath =
|
|
1902
|
-
|
|
1978
|
+
const tempPath = path8.join(
|
|
1979
|
+
os2.tmpdir(),
|
|
1903
1980
|
`walkeros-${Date.now()}-${Math.random().toString(36).slice(2, 9)}.mjs`
|
|
1904
1981
|
);
|
|
1905
1982
|
const existingBuild = typeof rawConfig === "object" && rawConfig !== null && "build" in rawConfig && typeof rawConfig.build === "object" ? rawConfig.build : {};
|
|
@@ -1930,7 +2007,9 @@ async function run(mode, options) {
|
|
|
1930
2007
|
const config = {
|
|
1931
2008
|
port: options.port,
|
|
1932
2009
|
host: options.host,
|
|
1933
|
-
|
|
2010
|
+
serveName: options.serveName,
|
|
2011
|
+
servePath: options.servePath,
|
|
2012
|
+
filePath: flowPath
|
|
1934
2013
|
};
|
|
1935
2014
|
await runServeMode(config);
|
|
1936
2015
|
break;
|
|
@@ -1954,8 +2033,14 @@ async function run(mode, options) {
|
|
|
1954
2033
|
}
|
|
1955
2034
|
|
|
1956
2035
|
// src/index.ts
|
|
2036
|
+
var __filename = fileURLToPath3(import.meta.url);
|
|
2037
|
+
var __dirname = dirname(__filename);
|
|
2038
|
+
var packageJson = JSON.parse(
|
|
2039
|
+
readFileSync2(join(__dirname, "../package.json"), "utf-8")
|
|
2040
|
+
);
|
|
2041
|
+
var VERSION = packageJson.version;
|
|
1957
2042
|
var program = new Command();
|
|
1958
|
-
program.name("walkeros").description("walkerOS CLI - Bundle and deploy walkerOS components").version(
|
|
2043
|
+
program.name("walkeros").description("walkerOS CLI - Bundle and deploy walkerOS components").version(VERSION);
|
|
1959
2044
|
program.command("bundle [file]").description("Bundle NPM packages with custom code").option(
|
|
1960
2045
|
"-e, --env <name>",
|
|
1961
2046
|
"environment to build (for multi-environment configs)"
|
|
@@ -2000,13 +2085,14 @@ runCmd.command("collect [file]").description(
|
|
|
2000
2085
|
});
|
|
2001
2086
|
});
|
|
2002
2087
|
runCmd.command("serve [file]").description(
|
|
2003
|
-
"Run serve mode (
|
|
2004
|
-
).option("-p, --port <number>", "Port to listen on (default: 8080)", parseInt).option("-h, --host <address>", "Host address (default: 0.0.0.0)").option("--
|
|
2088
|
+
"Run serve mode (single-file server for browser bundles). Defaults to baked-in web-serve.mjs if no file specified."
|
|
2089
|
+
).option("-p, --port <number>", "Port to listen on (default: 8080)", parseInt).option("-h, --host <address>", "Host address (default: 0.0.0.0)").option("--name <filename>", "Filename in URL (default: walker.js)").option("--path <directory>", "URL directory path (e.g., libs/v1)").option("--json", "Output results as JSON").option("-v, --verbose", "Verbose output").option("--local", "execute in local Node.js instead of Docker").option("--dry-run", "preview command without executing").option("--silent", "suppress output").action(async (file, options) => {
|
|
2005
2090
|
await runCommand("serve", {
|
|
2006
2091
|
config: file || "web-serve.mjs",
|
|
2007
2092
|
port: options.port,
|
|
2008
2093
|
host: options.host,
|
|
2009
|
-
|
|
2094
|
+
serveName: options.name,
|
|
2095
|
+
servePath: options.path,
|
|
2010
2096
|
json: options.json,
|
|
2011
2097
|
verbose: options.verbose,
|
|
2012
2098
|
local: options.local,
|