@walkeros/cli 0.4.0 → 0.4.1
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/dist/__tests__/bundle/bundler-helpers.test.d.ts +2 -0
- package/dist/__tests__/bundle/bundler-helpers.test.d.ts.map +1 -0
- package/dist/__tests__/bundle/bundler-helpers.test.js +285 -0
- package/dist/__tests__/bundle/bundler-helpers.test.js.map +1 -0
- package/dist/__tests__/bundle/bundler.test.js +3 -3
- package/dist/__tests__/bundle/bundler.test.js.map +1 -1
- package/dist/__tests__/bundle/programmatic.test.js +1 -1
- package/dist/__tests__/bundle/programmatic.test.js.map +1 -1
- package/dist/__tests__/bundle/serializer.test.js +1 -1
- package/dist/__tests__/bundle/serializer.test.js.map +1 -1
- package/dist/__tests__/bundle/template-engine.test.js +1 -1
- package/dist/__tests__/bundle/template-engine.test.js.map +1 -1
- package/dist/__tests__/cli-e2e.test.js +1 -1
- package/dist/__tests__/cli-e2e.test.js.map +1 -1
- package/dist/__tests__/cli.test.js +4 -73
- package/dist/__tests__/cli.test.js.map +1 -1
- package/dist/__tests__/config-loader.test.js +8 -5
- package/dist/__tests__/config-loader.test.js.map +1 -1
- package/dist/__tests__/core/config.test.js +1 -1
- package/dist/__tests__/core/config.test.js.map +1 -1
- package/dist/__tests__/core/logger.test.js +1 -1
- package/dist/__tests__/core/logger.test.js.map +1 -1
- package/dist/__tests__/integration/bundle-run.integration.test.d.ts +8 -0
- package/dist/__tests__/integration/bundle-run.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/bundle-run.integration.test.js +50 -0
- package/dist/__tests__/integration/bundle-run.integration.test.js.map +1 -0
- package/dist/__tests__/push/push.test.d.ts +7 -0
- package/dist/__tests__/push/push.test.d.ts.map +1 -0
- package/dist/__tests__/push/push.test.js +197 -0
- package/dist/__tests__/push/push.test.js.map +1 -0
- package/dist/__tests__/simulate/env-loader.test.d.ts +2 -0
- package/dist/__tests__/simulate/env-loader.test.d.ts.map +1 -0
- package/dist/__tests__/simulate/env-loader.test.js +47 -0
- package/dist/__tests__/simulate/env-loader.test.js.map +1 -0
- package/dist/__tests__/smoke/production.smoke.test.d.ts +8 -0
- package/dist/__tests__/smoke/production.smoke.test.d.ts.map +1 -0
- package/dist/__tests__/smoke/production.smoke.test.js +58 -0
- package/dist/__tests__/smoke/production.smoke.test.js.map +1 -0
- package/dist/commands/bundle/bundler.d.ts +2 -2
- package/dist/commands/bundle/bundler.d.ts.map +1 -1
- package/dist/commands/bundle/bundler.js +63 -51
- package/dist/commands/bundle/bundler.js.map +1 -1
- package/dist/commands/bundle/index.d.ts +1 -1
- package/dist/commands/bundle/index.d.ts.map +1 -1
- package/dist/commands/bundle/index.js +11 -23
- package/dist/commands/bundle/index.js.map +1 -1
- package/dist/commands/bundle/package-manager.d.ts +1 -1
- package/dist/commands/bundle/package-manager.d.ts.map +1 -1
- package/dist/commands/bundle/serializer.d.ts +1 -1
- package/dist/commands/bundle/serializer.d.ts.map +1 -1
- package/dist/commands/bundle/serializer.js +1 -1
- package/dist/commands/bundle/serializer.js.map +1 -1
- package/dist/commands/bundle/stats.d.ts +2 -2
- package/dist/commands/bundle/stats.d.ts.map +1 -1
- package/dist/commands/bundle/stats.js +1 -1
- package/dist/commands/bundle/stats.js.map +1 -1
- package/dist/commands/bundle/template-engine.d.ts +1 -1
- package/dist/commands/bundle/template-engine.d.ts.map +1 -1
- package/dist/commands/bundle/template-engine.js +2 -2
- package/dist/commands/bundle/template-engine.js.map +1 -1
- package/dist/commands/push/index.d.ts +7 -0
- package/dist/commands/push/index.d.ts.map +1 -0
- package/dist/commands/push/index.js +252 -0
- package/dist/commands/push/index.js.map +1 -0
- package/dist/commands/push/types.d.ts +21 -0
- package/dist/commands/push/types.d.ts.map +1 -0
- package/dist/commands/push/types.js +2 -0
- package/dist/commands/push/types.js.map +1 -0
- package/dist/commands/run/__tests__/run.integration.test.js +1 -1
- package/dist/commands/run/__tests__/run.integration.test.js.map +1 -1
- package/dist/commands/run/__tests__/validators.test.js +1 -1
- package/dist/commands/run/__tests__/validators.test.js.map +1 -1
- package/dist/commands/run/execution.d.ts +14 -0
- package/dist/commands/run/execution.d.ts.map +1 -0
- package/dist/commands/run/execution.js +37 -0
- package/dist/commands/run/execution.js.map +1 -0
- package/dist/commands/run/index.d.ts +1 -1
- package/dist/commands/run/index.d.ts.map +1 -1
- package/dist/commands/run/index.js +33 -107
- package/dist/commands/run/index.js.map +1 -1
- package/dist/commands/run/types.d.ts +1 -1
- package/dist/commands/run/types.d.ts.map +1 -1
- package/dist/commands/run/utils.d.ts +26 -0
- package/dist/commands/run/utils.d.ts.map +1 -0
- package/dist/commands/run/utils.js +58 -0
- package/dist/commands/run/utils.js.map +1 -0
- package/dist/commands/run/validators.d.ts +1 -1
- package/dist/commands/run/validators.d.ts.map +1 -1
- package/dist/commands/run/validators.js +1 -1
- package/dist/commands/run/validators.js.map +1 -1
- package/dist/commands/simulate/env-loader.d.ts +19 -0
- package/dist/commands/simulate/env-loader.d.ts.map +1 -0
- package/dist/commands/simulate/env-loader.js +46 -0
- package/dist/commands/simulate/env-loader.js.map +1 -0
- package/dist/commands/simulate/index.d.ts +3 -3
- package/dist/commands/simulate/index.d.ts.map +1 -1
- package/dist/commands/simulate/index.js +10 -19
- package/dist/commands/simulate/index.js.map +1 -1
- package/dist/commands/simulate/jsdom-executor.d.ts +13 -8
- package/dist/commands/simulate/jsdom-executor.d.ts.map +1 -1
- package/dist/commands/simulate/jsdom-executor.js +26 -49
- package/dist/commands/simulate/jsdom-executor.js.map +1 -1
- package/dist/commands/simulate/simulator.d.ts +1 -1
- package/dist/commands/simulate/simulator.d.ts.map +1 -1
- package/dist/commands/simulate/simulator.js +14 -10
- package/dist/commands/simulate/simulator.js.map +1 -1
- package/dist/commands/simulate/types.d.ts +2 -2
- package/dist/commands/simulate/types.d.ts.map +1 -1
- package/dist/config/defaults.d.ts +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/index.d.ts +8 -8
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +5 -5
- package/dist/config/index.js.map +1 -1
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +23 -19
- package/dist/config/loader.js.map +1 -1
- package/dist/config/parser.d.ts +65 -1
- package/dist/config/parser.d.ts.map +1 -1
- package/dist/config/parser.js +176 -71
- package/dist/config/parser.js.map +1 -1
- package/dist/config/utils.d.ts.map +1 -1
- package/dist/config/utils.js +3 -2
- package/dist/config/utils.js.map +1 -1
- package/dist/config/validators.d.ts +4 -1
- package/dist/config/validators.d.ts.map +1 -1
- package/dist/config/validators.js +4 -2
- package/dist/config/validators.js.map +1 -1
- package/dist/core/asset-resolver.d.ts.map +1 -1
- package/dist/core/asset-resolver.js +10 -3
- package/dist/core/asset-resolver.js.map +1 -1
- package/dist/core/docker.d.ts +17 -1
- package/dist/core/docker.d.ts.map +1 -1
- package/dist/core/docker.js +22 -1
- package/dist/core/docker.js.map +1 -1
- package/dist/core/execution.d.ts +2 -2
- package/dist/core/execution.d.ts.map +1 -1
- package/dist/core/execution.js +1 -1
- package/dist/core/execution.js.map +1 -1
- package/dist/core/index.d.ts +8 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +8 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/logger.d.ts +11 -0
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +14 -0
- package/dist/core/logger.js.map +1 -1
- package/dist/core/temp-manager.d.ts +51 -0
- package/dist/core/temp-manager.d.ts.map +1 -0
- package/dist/core/temp-manager.js +73 -0
- package/dist/core/temp-manager.js.map +1 -0
- package/dist/core/utils.d.ts +10 -0
- package/dist/core/utils.d.ts.map +1 -0
- package/dist/core/utils.js +12 -0
- package/dist/core/utils.js.map +1 -0
- package/dist/index.d.ts +16 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2531 -121
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.js.map +1 -1
- package/examples/event.json +1 -1
- package/examples/server-collect.mjs +1360 -1190
- package/examples/web-serve.js +25469 -11
- package/package.json +3 -2
- package/dist/__tests__/bundle/bundler-integration.test.d.ts +0 -2
- package/dist/__tests__/bundle/bundler-integration.test.d.ts.map +0 -1
- package/dist/__tests__/bundle/bundler-integration.test.js +0 -106
- package/dist/__tests__/bundle/bundler-integration.test.js.map +0 -1
- package/dist/__tests__/simulate/programmatic.test.d.ts +0 -2
- package/dist/__tests__/simulate/programmatic.test.d.ts.map +0 -1
- package/dist/__tests__/simulate/programmatic.test.js +0 -51
- package/dist/__tests__/simulate/programmatic.test.js.map +0 -1
- package/dist/__tests__/simulate/simulator.test.d.ts +0 -2
- package/dist/__tests__/simulate/simulator.test.d.ts.map +0 -1
- package/dist/__tests__/simulate/simulator.test.js +0 -29
- package/dist/__tests__/simulate/simulator.test.js.map +0 -1
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import { JSDOM, VirtualConsole } from 'jsdom';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import { createCommandLogger, createLogger, executeCommand, getErrorMessage, buildCommonDockerArgs, } from '../../core/index.js';
|
|
6
|
+
import { loadJsonConfig, loadJsonFromSource, loadBundleConfig, } from '../../config/index.js';
|
|
7
|
+
import { bundle } from '../bundle/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* CLI command handler for push command
|
|
10
|
+
*/
|
|
11
|
+
export async function pushCommand(options) {
|
|
12
|
+
const logger = createCommandLogger(options);
|
|
13
|
+
// Build Docker args
|
|
14
|
+
const dockerArgs = buildCommonDockerArgs(options);
|
|
15
|
+
dockerArgs.push('--event', options.event);
|
|
16
|
+
if (options.env)
|
|
17
|
+
dockerArgs.push('--env', options.env);
|
|
18
|
+
await executeCommand(async () => {
|
|
19
|
+
const startTime = Date.now();
|
|
20
|
+
try {
|
|
21
|
+
// Step 1: Load event
|
|
22
|
+
logger.info('📥 Loading event...');
|
|
23
|
+
const event = await loadJsonFromSource(options.event, {
|
|
24
|
+
name: 'event',
|
|
25
|
+
});
|
|
26
|
+
// Validate event format
|
|
27
|
+
if (!event ||
|
|
28
|
+
typeof event !== 'object' ||
|
|
29
|
+
!('name' in event) ||
|
|
30
|
+
typeof event.name !== 'string') {
|
|
31
|
+
throw new Error('Event must be an object with a "name" property (string)');
|
|
32
|
+
}
|
|
33
|
+
// Warn about event naming format
|
|
34
|
+
if (!event.name.includes(' ')) {
|
|
35
|
+
logger.warn(`Event name "${event.name}" should follow "ENTITY ACTION" format (e.g., "page view")`);
|
|
36
|
+
}
|
|
37
|
+
// Step 2: Load config
|
|
38
|
+
logger.info('📦 Loading flow configuration...');
|
|
39
|
+
const configPath = path.resolve(options.config);
|
|
40
|
+
const rawConfig = await loadJsonConfig(configPath);
|
|
41
|
+
const { flowConfig, buildOptions, environment, isMultiEnvironment } = loadBundleConfig(rawConfig, {
|
|
42
|
+
configPath: options.config,
|
|
43
|
+
environment: options.env,
|
|
44
|
+
logger,
|
|
45
|
+
});
|
|
46
|
+
const platform = flowConfig.platform;
|
|
47
|
+
// Step 3: Bundle to temp file
|
|
48
|
+
logger.info('🔨 Bundling flow configuration...');
|
|
49
|
+
const tempPath = path.join(os.tmpdir(), `walkeros-push-${Date.now()}-${Math.random().toString(36).slice(2, 9)}.${platform === 'web' ? 'js' : 'mjs'}`);
|
|
50
|
+
const configWithOutput = {
|
|
51
|
+
flow: flowConfig,
|
|
52
|
+
build: {
|
|
53
|
+
...buildOptions,
|
|
54
|
+
output: tempPath,
|
|
55
|
+
// Web uses IIFE for browser-like execution, server uses ESM
|
|
56
|
+
format: platform === 'web' ? 'iife' : 'esm',
|
|
57
|
+
platform: platform === 'web' ? 'browser' : 'node',
|
|
58
|
+
...(platform === 'web' && {
|
|
59
|
+
windowCollector: 'collector',
|
|
60
|
+
windowElb: 'elb',
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
await bundle(configWithOutput, {
|
|
65
|
+
cache: true,
|
|
66
|
+
verbose: options.verbose,
|
|
67
|
+
silent: !options.verbose,
|
|
68
|
+
});
|
|
69
|
+
logger.debug(`Bundle created: ${tempPath}`);
|
|
70
|
+
// Step 4: Execute based on platform
|
|
71
|
+
let result;
|
|
72
|
+
if (platform === 'web') {
|
|
73
|
+
logger.info('🌐 Executing in web environment (JSDOM)...');
|
|
74
|
+
result = await executeWebPush(tempPath, event, logger);
|
|
75
|
+
}
|
|
76
|
+
else if (platform === 'server') {
|
|
77
|
+
logger.info('🖥️ Executing in server environment (Node.js)...');
|
|
78
|
+
result = await executeServerPush(tempPath, event, logger);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
82
|
+
}
|
|
83
|
+
// Step 5: Output results
|
|
84
|
+
const duration = Date.now() - startTime;
|
|
85
|
+
if (options.json) {
|
|
86
|
+
// JSON output
|
|
87
|
+
const outputLogger = createLogger({ silent: false, json: false });
|
|
88
|
+
outputLogger.log('white', JSON.stringify({
|
|
89
|
+
success: result.success,
|
|
90
|
+
event: result.elbResult,
|
|
91
|
+
duration,
|
|
92
|
+
}, null, 2));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// Standard output
|
|
96
|
+
if (result.success) {
|
|
97
|
+
logger.success('✅ Event pushed successfully');
|
|
98
|
+
if (result.elbResult && typeof result.elbResult === 'object') {
|
|
99
|
+
const pushResult = result.elbResult;
|
|
100
|
+
if ('id' in pushResult && pushResult.id) {
|
|
101
|
+
logger.info(` Event ID: ${pushResult.id}`);
|
|
102
|
+
}
|
|
103
|
+
if ('entity' in pushResult && pushResult.entity) {
|
|
104
|
+
logger.info(` Entity: ${pushResult.entity}`);
|
|
105
|
+
}
|
|
106
|
+
if ('action' in pushResult && pushResult.action) {
|
|
107
|
+
logger.info(` Action: ${pushResult.action}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
logger.info(` Duration: ${duration}ms`);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
logger.error(`❌ Push failed: ${result.error}`);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Cleanup
|
|
118
|
+
try {
|
|
119
|
+
await fs.remove(tempPath);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
// Ignore cleanup errors
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
const duration = Date.now() - startTime;
|
|
127
|
+
const errorMessage = getErrorMessage(error);
|
|
128
|
+
if (options.json) {
|
|
129
|
+
const outputLogger = createLogger({ silent: false, json: false });
|
|
130
|
+
outputLogger.log('white', JSON.stringify({
|
|
131
|
+
success: false,
|
|
132
|
+
error: errorMessage,
|
|
133
|
+
duration,
|
|
134
|
+
}, null, 2));
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
logger.error(`❌ Push command failed: ${errorMessage}`);
|
|
138
|
+
}
|
|
139
|
+
process.exit(1);
|
|
140
|
+
}
|
|
141
|
+
}, 'push', dockerArgs, options, logger, options.config);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Execute push for web platform using JSDOM with real APIs
|
|
145
|
+
*/
|
|
146
|
+
async function executeWebPush(bundlePath, event, logger) {
|
|
147
|
+
const startTime = Date.now();
|
|
148
|
+
try {
|
|
149
|
+
// Create JSDOM with silent console
|
|
150
|
+
const virtualConsole = new VirtualConsole();
|
|
151
|
+
const dom = new JSDOM('<!DOCTYPE html><html><body></body></html>', {
|
|
152
|
+
url: 'http://localhost',
|
|
153
|
+
runScripts: 'dangerously',
|
|
154
|
+
resources: 'usable',
|
|
155
|
+
virtualConsole,
|
|
156
|
+
});
|
|
157
|
+
const { window } = dom;
|
|
158
|
+
// JSDOM provides fetch natively, no need to inject node-fetch
|
|
159
|
+
// Load and execute bundle
|
|
160
|
+
logger.debug('Loading bundle...');
|
|
161
|
+
const bundleCode = await fs.readFile(bundlePath, 'utf8');
|
|
162
|
+
window.eval(bundleCode);
|
|
163
|
+
// Wait for window.elb assignment
|
|
164
|
+
logger.debug('Waiting for elb...');
|
|
165
|
+
await waitForWindowProperty(window, 'elb', 5000);
|
|
166
|
+
const windowObj = window;
|
|
167
|
+
const elb = windowObj.elb;
|
|
168
|
+
// Push event
|
|
169
|
+
logger.info(`Pushing event: ${event.name}`);
|
|
170
|
+
const eventData = (event.data || {});
|
|
171
|
+
const elbResult = await elb(event.name, eventData);
|
|
172
|
+
return {
|
|
173
|
+
success: true,
|
|
174
|
+
elbResult,
|
|
175
|
+
duration: Date.now() - startTime,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
return {
|
|
180
|
+
success: false,
|
|
181
|
+
duration: Date.now() - startTime,
|
|
182
|
+
error: getErrorMessage(error),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Execute push for server platform using Node.js
|
|
188
|
+
*/
|
|
189
|
+
async function executeServerPush(bundlePath, event, logger, timeout = 60000) {
|
|
190
|
+
const startTime = Date.now();
|
|
191
|
+
try {
|
|
192
|
+
// Create timeout promise
|
|
193
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
194
|
+
setTimeout(() => reject(new Error(`Server push timeout after ${timeout}ms`)), timeout);
|
|
195
|
+
});
|
|
196
|
+
// Execute with timeout
|
|
197
|
+
const executePromise = (async () => {
|
|
198
|
+
// Dynamic import of ESM bundle
|
|
199
|
+
logger.debug('Importing bundle...');
|
|
200
|
+
const flowModule = await import(bundlePath);
|
|
201
|
+
if (!flowModule.default || typeof flowModule.default !== 'function') {
|
|
202
|
+
throw new Error('Bundle does not export default factory function');
|
|
203
|
+
}
|
|
204
|
+
// Call factory function to start flow
|
|
205
|
+
logger.debug('Calling factory function...');
|
|
206
|
+
const result = await flowModule.default();
|
|
207
|
+
if (!result || !result.elb || typeof result.elb !== 'function') {
|
|
208
|
+
throw new Error('Factory function did not return valid result with elb');
|
|
209
|
+
}
|
|
210
|
+
const { elb } = result;
|
|
211
|
+
// Push event
|
|
212
|
+
logger.info(`Pushing event: ${event.name}`);
|
|
213
|
+
const eventData = (event.data || {});
|
|
214
|
+
const elbResult = await elb(event.name, eventData);
|
|
215
|
+
return {
|
|
216
|
+
success: true,
|
|
217
|
+
elbResult,
|
|
218
|
+
duration: Date.now() - startTime,
|
|
219
|
+
};
|
|
220
|
+
})();
|
|
221
|
+
// Race between execution and timeout
|
|
222
|
+
return await Promise.race([executePromise, timeoutPromise]);
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
return {
|
|
226
|
+
success: false,
|
|
227
|
+
duration: Date.now() - startTime,
|
|
228
|
+
error: getErrorMessage(error),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Wait for window property to be assigned
|
|
234
|
+
*/
|
|
235
|
+
function waitForWindowProperty(window, prop, timeout = 5000) {
|
|
236
|
+
return new Promise((resolve, reject) => {
|
|
237
|
+
const start = Date.now();
|
|
238
|
+
const check = () => {
|
|
239
|
+
if (window[prop] !== undefined) {
|
|
240
|
+
resolve();
|
|
241
|
+
}
|
|
242
|
+
else if (Date.now() - start > timeout) {
|
|
243
|
+
reject(new Error(`Timeout waiting for window.${prop}. IIFE may have failed to execute.`));
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
setImmediate(check);
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
check();
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/push/index.ts"],"names":[],"mappings":"AAAA,OA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AC,GAAG,EAAE,GAAG,SAAS;aACjC,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;QAEL,qCAAqC;QACrC,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;YAChC,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC;SAC9B,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB,CAC5B,MAA+B,EAC/B,IAAY,EACZ,UAAkB,IAAI;IAEtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEzB,MAAM,KAAK,GAAG,GAAG,EAAE;YACjB,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC/B,OAAO,EAAE,CAAC;YACZ,CAAC;iBAAM,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,OAAO,EAAE,CAAC;gBACxC,MAAM,CACJ,IAAI,KAAK,CACP,8BAA8B,IAAI,oCAAoC,CACvE,CACF,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;QACH,CAAC,CAAC;QAEF,KAAK,EAAE,CAAC;IACV,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Elb } from '@walkeros/core';
|
|
2
|
+
import type { GlobalOptions } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Push command options
|
|
5
|
+
*/
|
|
6
|
+
export interface PushCommandOptions extends GlobalOptions {
|
|
7
|
+
config: string;
|
|
8
|
+
event: string;
|
|
9
|
+
env?: string;
|
|
10
|
+
json?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Push execution result
|
|
14
|
+
*/
|
|
15
|
+
export interface PushResult {
|
|
16
|
+
success: boolean;
|
|
17
|
+
elbResult?: Elb.PushResult;
|
|
18
|
+
duration: number;
|
|
19
|
+
error?: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/push/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/push/types.ts"],"names":[],"mappings":""}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Tests the CLI run command that imports @walkeros/docker as a library
|
|
5
5
|
* No Docker daemon required - runs directly in Node.js process
|
|
6
6
|
*/
|
|
7
|
-
import { runCommand } from '../index';
|
|
7
|
+
import { runCommand } from '../index.js';
|
|
8
8
|
import { join } from 'path';
|
|
9
9
|
import { existsSync } from 'fs';
|
|
10
10
|
describe('Run Command Integration', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.integration.test.js","sourceRoot":"","sources":["../../../../src/commands/run/__tests__/run.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"run.integration.test.js","sourceRoot":"","sources":["../../../../src/commands/run/__tests__/run.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAElC,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;QAC7C,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;YAC3C,MAAM,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;YACjC,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,8CAA8C;YAC9C,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,6BAA6B,CAAC,CAAC;YAEpE,2BAA2B;YAC3B,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE1C,0CAA0C;YAC1C,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;YACzB,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YACpD,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC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|
import { describe, it, expect } from '@jest/globals';
|
|
2
2
|
import { mkdirSync, writeFileSync, rmSync } from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
|
-
import { validateMode, validateFlowFile, validatePort } from '../validators';
|
|
4
|
+
import { validateMode, validateFlowFile, validatePort } from '../validators.js';
|
|
5
5
|
describe('validators', () => {
|
|
6
6
|
describe('validateMode', () => {
|
|
7
7
|
it('should accept valid modes', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.test.js","sourceRoot":"","sources":["../../../../src/commands/run/__tests__/validators.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"validators.test.js","sourceRoot":"","sources":["../../../../src/commands/run/__tests__/validators.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhF,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;QAC5B,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACnC,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE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AAC,CAAC;QAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;YACzC,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YAC3D,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YACxD,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;YACjE,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute run command locally
|
|
3
|
+
*
|
|
4
|
+
* @param mode - Run mode (collect | serve)
|
|
5
|
+
* @param flowPath - Path to flow bundle (required for collect, optional for serve)
|
|
6
|
+
* @param options - Runtime options
|
|
7
|
+
*/
|
|
8
|
+
export declare function executeRunLocal(mode: 'collect' | 'serve', flowPath: string | null, options: {
|
|
9
|
+
port?: number;
|
|
10
|
+
host?: string;
|
|
11
|
+
serveName?: string;
|
|
12
|
+
servePath?: string;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../../src/commands/run/execution.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,SAAS,GAAG,OAAO,EACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,OAAO,EAAE;IACP,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GACA,OAAO,CAAC,IAAI,CAAC,CA6Bf"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { runFlow, runServeMode } from '@walkeros/docker';
|
|
2
|
+
/**
|
|
3
|
+
* Execute run command locally
|
|
4
|
+
*
|
|
5
|
+
* @param mode - Run mode (collect | serve)
|
|
6
|
+
* @param flowPath - Path to flow bundle (required for collect, optional for serve)
|
|
7
|
+
* @param options - Runtime options
|
|
8
|
+
*/
|
|
9
|
+
export async function executeRunLocal(mode, flowPath, options) {
|
|
10
|
+
switch (mode) {
|
|
11
|
+
case 'collect': {
|
|
12
|
+
if (!flowPath) {
|
|
13
|
+
throw new Error('Flow path is required for collect mode');
|
|
14
|
+
}
|
|
15
|
+
const config = {
|
|
16
|
+
port: options.port,
|
|
17
|
+
host: options.host,
|
|
18
|
+
};
|
|
19
|
+
await runFlow(flowPath, config);
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case 'serve': {
|
|
23
|
+
const config = {
|
|
24
|
+
port: options.port,
|
|
25
|
+
host: options.host,
|
|
26
|
+
serveName: options.serveName,
|
|
27
|
+
servePath: options.servePath,
|
|
28
|
+
filePath: flowPath || undefined,
|
|
29
|
+
};
|
|
30
|
+
await runServeMode(config);
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
default:
|
|
34
|
+
throw new Error(`Unknown mode: ${mode}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../../src/commands/run/execution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,IAAyB,EACzB,QAAuB,EACvB,OAKC;IAED,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS,CAAC,CAAC,CAAC;YACf,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;YAC5D,CAAC;YACD,MAAM,MAAM,GAAkB;gBAC5B,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC;YACF,MAAM,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAChC,MAAM;QACR,CAAC;QAED,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,MAAM,GAAgB;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,QAAQ,EAAE,QAAQ,IAAI,SAAS;aAChC,CAAC;YACF,MAAM,YAAY,CAAC,MAAM,CAAC,CAAC;YAC3B,MAAM;QACR,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Runs walkerOS flows using @walkeros/docker as a library
|
|
5
5
|
* No Docker daemon required - runs directly in Node.js
|
|
6
6
|
*/
|
|
7
|
-
import type { RunMode, RunCommandOptions, RunOptions, RunResult } from './types';
|
|
7
|
+
import type { RunMode, RunCommandOptions, RunOptions, RunResult } from './types.js';
|
|
8
8
|
/**
|
|
9
9
|
* CLI command function for `walkeros run`
|
|
10
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/run/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/run/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,SAAS,EACV,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAkHf;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,GAAG,CACvB,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,SAAS,CAAC,CAuDpB;AAGD,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -5,12 +5,10 @@
|
|
|
5
5
|
* No Docker daemon required - runs directly in Node.js
|
|
6
6
|
*/
|
|
7
7
|
import path from 'path';
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { loadJsonConfig } from '../../config';
|
|
13
|
-
import { validateMode, validateFlowFile, validatePort } from './validators';
|
|
8
|
+
import { createCommandLogger, createTimer, getExecutionMode, getErrorMessage, executeRunInDocker, isDockerAvailable, } from '../../core/index.js';
|
|
9
|
+
import { validateMode, validateFlowFile, validatePort } from './validators.js';
|
|
10
|
+
import { prepareBundleForRun, isPreBuiltConfig } from './utils.js';
|
|
11
|
+
import { executeRunLocal } from './execution.js';
|
|
14
12
|
/**
|
|
15
13
|
* CLI command function for `walkeros run`
|
|
16
14
|
*
|
|
@@ -20,11 +18,7 @@ import { validateMode, validateFlowFile, validatePort } from './validators';
|
|
|
20
18
|
export async function runCommand(mode, options) {
|
|
21
19
|
const timer = createTimer();
|
|
22
20
|
timer.start();
|
|
23
|
-
const logger =
|
|
24
|
-
verbose: options.verbose,
|
|
25
|
-
silent: options.silent ?? false,
|
|
26
|
-
json: options.json,
|
|
27
|
-
});
|
|
21
|
+
const logger = createCommandLogger(options);
|
|
28
22
|
try {
|
|
29
23
|
// Step 1: Validate inputs
|
|
30
24
|
validateMode(mode);
|
|
@@ -33,9 +27,7 @@ export async function runCommand(mode, options) {
|
|
|
33
27
|
validatePort(options.port);
|
|
34
28
|
}
|
|
35
29
|
// Step 2: Determine if config is pre-built or needs bundling
|
|
36
|
-
const isPreBuilt = configPath
|
|
37
|
-
configPath.endsWith('.js') ||
|
|
38
|
-
configPath.endsWith('.cjs');
|
|
30
|
+
const isPreBuilt = isPreBuiltConfig(configPath);
|
|
39
31
|
let flowPath = null;
|
|
40
32
|
if (mode === 'collect') {
|
|
41
33
|
if (isPreBuilt) {
|
|
@@ -50,29 +42,10 @@ export async function runCommand(mode, options) {
|
|
|
50
42
|
if (!options.json && !options.silent) {
|
|
51
43
|
logger.info('🔨 Building flow bundle...');
|
|
52
44
|
}
|
|
53
|
-
|
|
54
|
-
const rawConfig = await loadJsonConfig(configPath);
|
|
55
|
-
const tempPath = path.join(os.tmpdir(), `walkeros-${Date.now()}-${Math.random().toString(36).slice(2, 9)}.mjs`);
|
|
56
|
-
// Ensure config has build.output set to temp path
|
|
57
|
-
const existingBuild = typeof rawConfig === 'object' &&
|
|
58
|
-
rawConfig !== null &&
|
|
59
|
-
'build' in rawConfig &&
|
|
60
|
-
typeof rawConfig.build === 'object'
|
|
61
|
-
? rawConfig.build
|
|
62
|
-
: {};
|
|
63
|
-
const configWithOutput = {
|
|
64
|
-
...rawConfig,
|
|
65
|
-
build: {
|
|
66
|
-
...existingBuild,
|
|
67
|
-
output: tempPath,
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
await bundle(configWithOutput, {
|
|
71
|
-
cache: true,
|
|
45
|
+
flowPath = await prepareBundleForRun(configPath, {
|
|
72
46
|
verbose: options.verbose,
|
|
73
47
|
silent: options.json || options.silent,
|
|
74
48
|
});
|
|
75
|
-
flowPath = tempPath;
|
|
76
49
|
if (!options.json && !options.silent) {
|
|
77
50
|
logger.success('✅ Bundle ready');
|
|
78
51
|
}
|
|
@@ -80,6 +53,16 @@ export async function runCommand(mode, options) {
|
|
|
80
53
|
}
|
|
81
54
|
// Step 3: Execute based on mode
|
|
82
55
|
const executionMode = getExecutionMode(options);
|
|
56
|
+
// Handle dry-run
|
|
57
|
+
if (options.dryRun) {
|
|
58
|
+
if (executionMode === 'docker') {
|
|
59
|
+
logger.info(`[DRY-RUN] Would execute in Docker: run ${mode} with runtime image`);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
logger.info(`[DRY-RUN] Would execute locally: run ${mode}`);
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
83
66
|
if (executionMode === 'docker') {
|
|
84
67
|
// Docker mode: Use production runtime image
|
|
85
68
|
const dockerAvailable = await isDockerAvailable();
|
|
@@ -103,38 +86,18 @@ export async function runCommand(mode, options) {
|
|
|
103
86
|
const modeLabel = mode === 'collect' ? 'Collector' : 'Server';
|
|
104
87
|
logger.info(`🖥️ Starting ${modeLabel} locally...`);
|
|
105
88
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
port: options.port,
|
|
113
|
-
host: options.host,
|
|
114
|
-
};
|
|
115
|
-
await runFlow(flowPath, config);
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
case 'serve': {
|
|
119
|
-
const config = {
|
|
120
|
-
port: options.port,
|
|
121
|
-
host: options.host,
|
|
122
|
-
serveName: options.serveName,
|
|
123
|
-
servePath: options.servePath,
|
|
124
|
-
filePath: flowPath || undefined,
|
|
125
|
-
};
|
|
126
|
-
await runServeMode(config);
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
default:
|
|
130
|
-
throw new Error(`Unknown mode: ${mode}`);
|
|
131
|
-
}
|
|
89
|
+
await executeRunLocal(mode, flowPath, {
|
|
90
|
+
port: options.port,
|
|
91
|
+
host: options.host,
|
|
92
|
+
serveName: options.serveName,
|
|
93
|
+
servePath: options.servePath,
|
|
94
|
+
});
|
|
132
95
|
}
|
|
133
96
|
// Note: Both Docker and local modes run forever, so we won't reach here unless they fail
|
|
134
97
|
}
|
|
135
98
|
catch (error) {
|
|
136
99
|
const duration = timer.getElapsed() / 1000;
|
|
137
|
-
const errorMessage =
|
|
100
|
+
const errorMessage = getErrorMessage(error);
|
|
138
101
|
if (options.json) {
|
|
139
102
|
const output = {
|
|
140
103
|
success: false,
|
|
@@ -190,62 +153,25 @@ export async function run(mode, options) {
|
|
|
190
153
|
validatePort(options.port);
|
|
191
154
|
}
|
|
192
155
|
// Determine if config is pre-built or needs bundling
|
|
193
|
-
const isPreBuilt = flowFile
|
|
194
|
-
flowFile.endsWith('.js') ||
|
|
195
|
-
flowFile.endsWith('.cjs');
|
|
156
|
+
const isPreBuilt = isPreBuiltConfig(flowFile);
|
|
196
157
|
let flowPath;
|
|
197
158
|
if (isPreBuilt) {
|
|
198
159
|
flowPath = path.resolve(flowFile);
|
|
199
160
|
}
|
|
200
161
|
else {
|
|
201
162
|
// Bundle JSON config
|
|
202
|
-
|
|
203
|
-
const tempPath = path.join(os.tmpdir(), `walkeros-${Date.now()}-${Math.random().toString(36).slice(2, 9)}.mjs`);
|
|
204
|
-
// Ensure config has build.output set to temp path
|
|
205
|
-
const existingBuild = typeof rawConfig === 'object' &&
|
|
206
|
-
rawConfig !== null &&
|
|
207
|
-
'build' in rawConfig &&
|
|
208
|
-
typeof rawConfig.build === 'object'
|
|
209
|
-
? rawConfig.build
|
|
210
|
-
: {};
|
|
211
|
-
const configWithOutput = {
|
|
212
|
-
...rawConfig,
|
|
213
|
-
build: {
|
|
214
|
-
...existingBuild,
|
|
215
|
-
output: tempPath,
|
|
216
|
-
},
|
|
217
|
-
};
|
|
218
|
-
await bundle(configWithOutput, {
|
|
219
|
-
cache: true,
|
|
163
|
+
flowPath = await prepareBundleForRun(flowFile, {
|
|
220
164
|
verbose: options.verbose,
|
|
221
165
|
silent: true,
|
|
222
166
|
});
|
|
223
|
-
flowPath = tempPath;
|
|
224
167
|
}
|
|
225
168
|
// Run the flow using Docker package
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
await runFlow(flowPath, config);
|
|
233
|
-
break;
|
|
234
|
-
}
|
|
235
|
-
case 'serve': {
|
|
236
|
-
const config = {
|
|
237
|
-
port: options.port,
|
|
238
|
-
host: options.host,
|
|
239
|
-
serveName: options.serveName,
|
|
240
|
-
servePath: options.servePath,
|
|
241
|
-
filePath: flowPath,
|
|
242
|
-
};
|
|
243
|
-
await runServeMode(config);
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
default:
|
|
247
|
-
throw new Error(`Unknown mode: ${mode}`);
|
|
248
|
-
}
|
|
169
|
+
await executeRunLocal(mode, flowPath, {
|
|
170
|
+
port: options.port,
|
|
171
|
+
host: options.host,
|
|
172
|
+
serveName: options.serveName,
|
|
173
|
+
servePath: options.servePath,
|
|
174
|
+
});
|
|
249
175
|
// Success (though runFlow runs forever, so we typically don't reach here)
|
|
250
176
|
return {
|
|
251
177
|
success: true,
|
|
@@ -258,7 +184,7 @@ export async function run(mode, options) {
|
|
|
258
184
|
success: false,
|
|
259
185
|
exitCode: 1,
|
|
260
186
|
duration: Date.now() - startTime,
|
|
261
|
-
error:
|
|
187
|
+
error: getErrorMessage(error),
|
|
262
188
|
};
|
|
263
189
|
}
|
|
264
190
|
}
|