@walkeros/cli 0.6.1-next-1766186076625 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # @walkeros/cli
2
2
 
3
- ## 0.6.1-next-1766186076625
3
+ ## 0.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [f5120b2]
8
+ - @walkeros/core@0.7.0
9
+ - @walkeros/server-core@0.6.1
10
+
11
+ ## 0.6.1
4
12
 
5
13
  ### Patch Changes
6
14
 
@@ -56,7 +56,6 @@
56
56
  }
57
57
  },
58
58
  "collector": {
59
- "run": true,
60
59
  "globals": {
61
60
  "environment": "production",
62
61
  "version": "1.0.0"
@@ -22,9 +22,6 @@
22
22
  }
23
23
  }
24
24
  }
25
- },
26
- "collector": {
27
- "run": true
28
25
  }
29
26
  }
30
27
  }
@@ -71,7 +71,6 @@
71
71
  }
72
72
  },
73
73
  "collector": {
74
- "run": true,
75
74
  "globals": {
76
75
  "environment": "production",
77
76
  "version": "1.0.0"
package/dist/index.d.ts CHANGED
@@ -187,6 +187,7 @@ interface BundleCommandOptions {
187
187
  verbose?: boolean;
188
188
  dryRun?: boolean;
189
189
  silent?: boolean;
190
+ dockerfile?: boolean;
190
191
  }
191
192
  declare function bundleCommand(options: BundleCommandOptions): Promise<void>;
192
193
  /**
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ var VERSION = JSON.parse(findPackageJson()).version;
29
29
 
30
30
  // src/commands/bundle/index.ts
31
31
  import path9 from "path";
32
+ import fs8 from "fs-extra";
32
33
 
33
34
  // src/core/logger.ts
34
35
  import chalk from "chalk";
@@ -1383,6 +1384,13 @@ async function bundleCommand(options) {
1383
1384
  if (!options.json && !options.all && options.stats && stats) {
1384
1385
  displayStats(stats, logger2);
1385
1386
  }
1387
+ if (options.dockerfile && !options.all) {
1388
+ const dockerfilePath = path9.join(
1389
+ path9.dirname(buildOptions.output),
1390
+ "Dockerfile"
1391
+ );
1392
+ await generateDockerfile(dockerfilePath, buildOptions.output, logger2);
1393
+ }
1386
1394
  } catch (error) {
1387
1395
  const errorMessage = getErrorMessage(error);
1388
1396
  results.push({
@@ -1465,10 +1473,25 @@ async function bundle(configOrPath, options = {}) {
1465
1473
  options.stats ?? false
1466
1474
  );
1467
1475
  }
1476
+ async function generateDockerfile(dockerfilePath, bundleOutput, logger2) {
1477
+ const bundleFilename = path9.basename(bundleOutput);
1478
+ const dockerfile = `# Generated by walkeros CLI
1479
+ FROM walkeros/flow:latest
1480
+
1481
+ COPY ${bundleFilename} /app/flow/bundle.mjs
1482
+
1483
+ ENV MODE=collect
1484
+ ENV FLOW=/app/flow/bundle.mjs
1485
+
1486
+ EXPOSE 8080
1487
+ `;
1488
+ await fs8.writeFile(dockerfilePath, dockerfile);
1489
+ logger2.log(`Dockerfile: ${dockerfilePath}`);
1490
+ }
1468
1491
 
1469
1492
  // src/commands/simulate/simulator.ts
1470
1493
  import path10 from "path";
1471
- import fs9 from "fs-extra";
1494
+ import fs10 from "fs-extra";
1472
1495
  import { getPlatform as getPlatform2 } from "@walkeros/core";
1473
1496
 
1474
1497
  // src/commands/simulate/tracker.ts
@@ -1551,7 +1574,7 @@ var CallTracker = class {
1551
1574
 
1552
1575
  // src/commands/simulate/jsdom-executor.ts
1553
1576
  import { JSDOM, VirtualConsole } from "jsdom";
1554
- import fs8 from "fs-extra";
1577
+ import fs9 from "fs-extra";
1555
1578
  function buildSandboxFromEnvs(envs, destinations, tracker) {
1556
1579
  const baseBrowserMocks = {
1557
1580
  Image: class MockImage {
@@ -1620,7 +1643,7 @@ async function executeInJSDOM(bundlePath, destinations, event, tracker, envs, ti
1620
1643
  const sandbox = buildSandboxFromEnvs(envs, destinations, tracker);
1621
1644
  Object.assign(window, sandbox.window);
1622
1645
  Object.assign(window.document, sandbox.document);
1623
- const bundleCode = await fs8.readFile(bundlePath, "utf8");
1646
+ const bundleCode = await fs9.readFile(bundlePath, "utf8");
1624
1647
  try {
1625
1648
  window.eval(bundleCode);
1626
1649
  } catch (error) {
@@ -1813,7 +1836,7 @@ async function executeSimulation(event, inputPath, platformOverride, options = {
1813
1836
  const tempDir = getTmpPath();
1814
1837
  const collectorLoggerConfig = options.logger ? createCollectorLoggerConfig(options.logger, options.verbose) : void 0;
1815
1838
  try {
1816
- await fs9.ensureDir(tempDir);
1839
+ await fs10.ensureDir(tempDir);
1817
1840
  const detected = await detectInput(inputPath, platformOverride);
1818
1841
  if (!isObject(event) || !("name" in event) || typeof event.name !== "string") {
1819
1842
  throw new Error(
@@ -1849,7 +1872,7 @@ async function executeSimulation(event, inputPath, platformOverride, options = {
1849
1872
  };
1850
1873
  } finally {
1851
1874
  if (tempDir) {
1852
- await fs9.remove(tempDir).catch(() => {
1875
+ await fs10.remove(tempDir).catch(() => {
1853
1876
  });
1854
1877
  }
1855
1878
  }
@@ -1920,7 +1943,7 @@ async function executeBundleSimulation(bundleContent, platform, typedEvent, temp
1920
1943
  tempDir,
1921
1944
  `bundle-${generateId()}.${platform === "server" ? "mjs" : "js"}`
1922
1945
  );
1923
- await fs9.writeFile(tempOutput, bundleContent, "utf8");
1946
+ await fs10.writeFile(tempOutput, bundleContent, "utf8");
1924
1947
  const tracker = new CallTracker();
1925
1948
  let result;
1926
1949
  if (platform === "web") {
@@ -2016,7 +2039,7 @@ async function simulate(configOrPath, event, options = {}) {
2016
2039
  // src/commands/push/index.ts
2017
2040
  import path11 from "path";
2018
2041
  import { JSDOM as JSDOM2, VirtualConsole as VirtualConsole2 } from "jsdom";
2019
- import fs10 from "fs-extra";
2042
+ import fs11 from "fs-extra";
2020
2043
  import {
2021
2044
  getPlatform as getPlatform3
2022
2045
  } from "@walkeros/core";
@@ -2119,7 +2142,7 @@ async function pushCommand(options) {
2119
2142
  process.exit(1);
2120
2143
  } finally {
2121
2144
  if (tempDir) {
2122
- await fs10.remove(tempDir).catch(() => {
2145
+ await fs11.remove(tempDir).catch(() => {
2123
2146
  });
2124
2147
  }
2125
2148
  }
@@ -2139,7 +2162,7 @@ async function executeConfigPush(options, validatedEvent, logger2, setTempDir) {
2139
2162
  `push-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
2140
2163
  );
2141
2164
  setTempDir(tempDir);
2142
- await fs10.ensureDir(tempDir);
2165
+ await fs11.ensureDir(tempDir);
2143
2166
  const tempPath = path11.join(
2144
2167
  tempDir,
2145
2168
  `bundle.${platform === "web" ? "js" : "mjs"}`
@@ -2179,12 +2202,12 @@ async function executeBundlePush(bundleContent, platform, validatedEvent, logger
2179
2202
  `push-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
2180
2203
  );
2181
2204
  setTempDir(tempDir);
2182
- await fs10.ensureDir(tempDir);
2205
+ await fs11.ensureDir(tempDir);
2183
2206
  const tempPath = path11.join(
2184
2207
  tempDir,
2185
2208
  `bundle.${platform === "server" ? "mjs" : "js"}`
2186
2209
  );
2187
- await fs10.writeFile(tempPath, bundleContent, "utf8");
2210
+ await fs11.writeFile(tempPath, bundleContent, "utf8");
2188
2211
  logger2.debug(`Bundle written to: ${tempPath}`);
2189
2212
  if (platform === "web") {
2190
2213
  logger2.debug("Executing in web environment (JSDOM)");
@@ -2206,7 +2229,7 @@ async function executeWebPush(bundlePath, event, logger2) {
2206
2229
  });
2207
2230
  const { window } = dom;
2208
2231
  logger2.debug("Loading bundle...");
2209
- const bundleCode = await fs10.readFile(bundlePath, "utf8");
2232
+ const bundleCode = await fs11.readFile(bundlePath, "utf8");
2210
2233
  window.eval(bundleCode);
2211
2234
  logger2.debug("Waiting for collector...");
2212
2235
  await waitForWindowProperty2(
@@ -2353,7 +2376,7 @@ function validatePort(port) {
2353
2376
 
2354
2377
  // src/commands/run/utils.ts
2355
2378
  import path12 from "path";
2356
- import fs11 from "fs-extra";
2379
+ import fs12 from "fs-extra";
2357
2380
  async function prepareBundleForRun(configPath, options) {
2358
2381
  const configDir = path12.dirname(path12.resolve(configPath));
2359
2382
  const tempDir = path12.join(
@@ -2361,7 +2384,7 @@ async function prepareBundleForRun(configPath, options) {
2361
2384
  ".tmp",
2362
2385
  `run-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
2363
2386
  );
2364
- await fs11.ensureDir(tempDir);
2387
+ await fs12.ensureDir(tempDir);
2365
2388
  const tempPath = path12.join(tempDir, "bundle.mjs");
2366
2389
  await bundle(configPath, {
2367
2390
  cache: true,
@@ -2635,20 +2658,20 @@ async function run(mode, options) {
2635
2658
  }
2636
2659
 
2637
2660
  // src/commands/cache.ts
2638
- import fs12 from "fs-extra";
2661
+ import fs13 from "fs-extra";
2639
2662
  function registerCacheCommand(program2) {
2640
2663
  const cache = program2.command("cache").description("Manage the CLI cache");
2641
2664
  cache.command("clear").description("Clear all cached packages and builds").option("--packages", "Clear only package cache").option("--builds", "Clear only build cache").option("--tmp-dir <dir>", "Custom temp directory").option("--silent", "Suppress output").action(async (options) => {
2642
2665
  const logger2 = createLogger({ silent: options.silent });
2643
2666
  const tmpDir = options.tmpDir;
2644
2667
  if (options.packages) {
2645
- await fs12.remove(getTmpPath(tmpDir, "cache", "packages"));
2668
+ await fs13.remove(getTmpPath(tmpDir, "cache", "packages"));
2646
2669
  logger2.log("Package cache cleared");
2647
2670
  } else if (options.builds) {
2648
- await fs12.remove(getTmpPath(tmpDir, "cache", "builds"));
2671
+ await fs13.remove(getTmpPath(tmpDir, "cache", "builds"));
2649
2672
  logger2.log("Build cache cleared");
2650
2673
  } else {
2651
- await fs12.remove(getTmpPath(tmpDir, "cache"));
2674
+ await fs13.remove(getTmpPath(tmpDir, "cache"));
2652
2675
  logger2.log("All caches cleared");
2653
2676
  }
2654
2677
  });
@@ -2668,13 +2691,13 @@ function registerCleanCommand(program2) {
2668
2691
  program2.command("clean").description("Clear the entire temp directory (.tmp/)").option("--tmp-dir <dir>", "Custom temp directory").option("--silent", "Suppress output").action(async (options) => {
2669
2692
  const logger2 = createLogger({ silent: options.silent });
2670
2693
  const tmpDir = options.tmpDir || getDefaultTmpRoot();
2671
- await fs12.remove(tmpDir);
2694
+ await fs13.remove(tmpDir);
2672
2695
  logger2.log(`Temp directory cleared: ${tmpDir}`);
2673
2696
  });
2674
2697
  }
2675
2698
  async function countEntries(dir) {
2676
- if (!await fs12.pathExists(dir)) return 0;
2677
- const entries = await fs12.readdir(dir);
2699
+ if (!await fs13.pathExists(dir)) return 0;
2700
+ const entries = await fs13.readdir(dir);
2678
2701
  return entries.length;
2679
2702
  }
2680
2703
 
@@ -2687,7 +2710,7 @@ program.hook("preAction", (thisCommand, actionCommand) => {
2687
2710
  console.log(chalk2.hex("#01b5e2")(`walkerOS v${VERSION}`));
2688
2711
  }
2689
2712
  });
2690
- program.command("bundle [file]").description("Bundle NPM packages with custom code").option("-f, --flow <name>", "flow to build (for multi-flow configs)").option("--all", "build all flows (for multi-flow configs)").option("-s, --stats", "show bundle statistics").option("--json", "output statistics in JSON format (implies --stats)").option("--no-cache", "disable package caching and download fresh packages").option("-v, --verbose", "verbose output").option("--dry-run", "preview command without executing").option("--silent", "suppress output").action(async (file, options) => {
2713
+ program.command("bundle [file]").description("Bundle NPM packages with custom code").option("-f, --flow <name>", "flow to build (for multi-flow configs)").option("--all", "build all flows (for multi-flow configs)").option("-s, --stats", "show bundle statistics").option("--json", "output statistics in JSON format (implies --stats)").option("--no-cache", "disable package caching and download fresh packages").option("-v, --verbose", "verbose output").option("--dry-run", "preview command without executing").option("--silent", "suppress output").option("--dockerfile", "generate Dockerfile alongside bundle").action(async (file, options) => {
2691
2714
  await bundleCommand({
2692
2715
  config: file || "bundle.config.json",
2693
2716
  flow: options.flow,
@@ -2697,7 +2720,8 @@ program.command("bundle [file]").description("Bundle NPM packages with custom co
2697
2720
  cache: options.cache,
2698
2721
  verbose: options.verbose,
2699
2722
  dryRun: options.dryRun,
2700
- silent: options.silent
2723
+ silent: options.silent,
2724
+ dockerfile: options.dockerfile
2701
2725
  });
2702
2726
  });
2703
2727
  program.command("simulate [file]").description("Simulate event processing and capture API calls").option(