@walkeros/cli 0.3.3 → 0.3.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/CHANGELOG.md +14 -0
- package/dist/__tests__/bundle/bundler.test.js +10 -14
- package/dist/__tests__/bundle/bundler.test.js.map +1 -1
- package/dist/__tests__/bundle/programmatic.test.js +5 -0
- package/dist/__tests__/bundle/programmatic.test.js.map +1 -1
- package/dist/__tests__/cli.test.js +4 -0
- package/dist/__tests__/cli.test.js.map +1 -1
- package/dist/__tests__/config-loader.test.js +3 -2
- package/dist/__tests__/config-loader.test.js.map +1 -1
- package/dist/commands/bundle/bundler.d.ts.map +1 -1
- package/dist/commands/bundle/bundler.js +3 -3
- package/dist/commands/bundle/bundler.js.map +1 -1
- package/dist/commands/bundle/template-engine.d.ts +2 -0
- package/dist/commands/bundle/template-engine.d.ts.map +1 -1
- package/dist/commands/bundle/template-engine.js +5 -2
- package/dist/commands/bundle/template-engine.js.map +1 -1
- 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 +4 -3
- package/dist/commands/run/validators.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +1 -4
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/parser.d.ts.map +1 -1
- package/dist/config/parser.js +5 -0
- package/dist/config/parser.js.map +1 -1
- package/dist/core/asset-resolver.d.ts +41 -0
- package/dist/core/asset-resolver.d.ts.map +1 -0
- package/dist/core/asset-resolver.js +69 -0
- package/dist/core/asset-resolver.js.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +75 -46
- package/dist/index.js.map +1 -1
- package/dist/types/bundle.d.ts +5 -2
- package/dist/types/bundle.d.ts.map +1 -1
- package/package.json +4 -3
- /package/templates/{base.hbs → web.hbs} +0 -0
package/dist/config/parser.js
CHANGED
|
@@ -117,6 +117,11 @@ export function normalizeConfigs(config, configPath) {
|
|
|
117
117
|
...buildDefaults,
|
|
118
118
|
...config.build,
|
|
119
119
|
};
|
|
120
|
+
// Auto-select default template based on platform if not specified
|
|
121
|
+
// Only auto-select if template is undefined (not explicitly set to empty string or false)
|
|
122
|
+
if (buildConfig.template === undefined) {
|
|
123
|
+
buildConfig.template = platform === 'server' ? 'server.hbs' : 'web.hbs';
|
|
124
|
+
}
|
|
120
125
|
// Resolve template path relative to config file directory if it starts with ./ or ../
|
|
121
126
|
if (configPath &&
|
|
122
127
|
buildConfig.template &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/config/parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAqB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAUhD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAa;IAC7C,sBAAsB;IACtB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,wCAAwC,OAAO,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,uCAAuC;IACvC,IAAI,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CACb,wCAAwC;YACtC,gFAAgF,CACnF,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC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;IAE/D,OAAO;QACL,UAAU;QACV,YAAY;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asset Resolver
|
|
3
|
+
*
|
|
4
|
+
* Unified path resolution for package assets (templates, examples) and user assets (configs, custom templates).
|
|
5
|
+
* Works identically in both local and Docker environments.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Get the package root directory
|
|
9
|
+
*
|
|
10
|
+
* Uses import.meta.url to find the package root, works in both environments:
|
|
11
|
+
* - Production (dist): /path/to/packages/cli/dist/index.js → /path/to/packages/cli
|
|
12
|
+
* - Test (src): /path/to/packages/cli/src/core/asset-resolver.ts → /path/to/packages/cli
|
|
13
|
+
* - Docker: /cli
|
|
14
|
+
*
|
|
15
|
+
* @returns Absolute path to package root
|
|
16
|
+
*/
|
|
17
|
+
export declare function getPackageRoot(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Asset type for resolution strategy
|
|
20
|
+
*/
|
|
21
|
+
export type AssetType = 'template' | 'config' | 'bundle';
|
|
22
|
+
/**
|
|
23
|
+
* Resolve asset path using unified strategy
|
|
24
|
+
*
|
|
25
|
+
* Resolution rules:
|
|
26
|
+
* 1. Bare names (no / or \) → Package asset
|
|
27
|
+
* - "web.hbs" → ${packageRoot}/templates/web.hbs
|
|
28
|
+
* - "server-collect.json" → ${packageRoot}/examples/server-collect.json
|
|
29
|
+
*
|
|
30
|
+
* 2. Relative paths (./ or ../) → User asset relative to base directory
|
|
31
|
+
* - "./my-template.hbs" → ${baseDir}/my-template.hbs
|
|
32
|
+
*
|
|
33
|
+
* 3. Absolute paths → Use as-is
|
|
34
|
+
*
|
|
35
|
+
* @param assetPath - Path to resolve
|
|
36
|
+
* @param assetType - Type of asset (determines package subdirectory)
|
|
37
|
+
* @param baseDir - Base directory for relative paths (defaults to cwd)
|
|
38
|
+
* @returns Absolute path to asset
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveAsset(assetPath: string, assetType: AssetType, baseDir?: string): string;
|
|
41
|
+
//# sourceMappingURL=asset-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-resolver.d.ts","sourceRoot":"","sources":["../../src/core/asset-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAevC;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAoBR"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asset Resolver
|
|
3
|
+
*
|
|
4
|
+
* Unified path resolution for package assets (templates, examples) and user assets (configs, custom templates).
|
|
5
|
+
* Works identically in both local and Docker environments.
|
|
6
|
+
*/
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
/**
|
|
10
|
+
* Get the package root directory
|
|
11
|
+
*
|
|
12
|
+
* Uses import.meta.url to find the package root, works in both environments:
|
|
13
|
+
* - Production (dist): /path/to/packages/cli/dist/index.js → /path/to/packages/cli
|
|
14
|
+
* - Test (src): /path/to/packages/cli/src/core/asset-resolver.ts → /path/to/packages/cli
|
|
15
|
+
* - Docker: /cli
|
|
16
|
+
*
|
|
17
|
+
* @returns Absolute path to package root
|
|
18
|
+
*/
|
|
19
|
+
export function getPackageRoot() {
|
|
20
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
21
|
+
// In test/dev mode: files are in src/ directory (e.g., src/core/asset-resolver.ts)
|
|
22
|
+
// In production: all code is bundled into dist/index.js
|
|
23
|
+
if (currentFile.includes('/src/')) {
|
|
24
|
+
// Running from source (tests): go up to package root
|
|
25
|
+
// e.g., /path/to/packages/cli/src/core/asset-resolver.ts -> /path/to/packages/cli
|
|
26
|
+
const srcIndex = currentFile.indexOf('/src/');
|
|
27
|
+
return currentFile.substring(0, srcIndex);
|
|
28
|
+
}
|
|
29
|
+
// Running from dist (production/bundled)
|
|
30
|
+
// e.g., /path/to/packages/cli/dist/index.js -> /path/to/packages/cli
|
|
31
|
+
return path.resolve(currentFile, '../..');
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve asset path using unified strategy
|
|
35
|
+
*
|
|
36
|
+
* Resolution rules:
|
|
37
|
+
* 1. Bare names (no / or \) → Package asset
|
|
38
|
+
* - "web.hbs" → ${packageRoot}/templates/web.hbs
|
|
39
|
+
* - "server-collect.json" → ${packageRoot}/examples/server-collect.json
|
|
40
|
+
*
|
|
41
|
+
* 2. Relative paths (./ or ../) → User asset relative to base directory
|
|
42
|
+
* - "./my-template.hbs" → ${baseDir}/my-template.hbs
|
|
43
|
+
*
|
|
44
|
+
* 3. Absolute paths → Use as-is
|
|
45
|
+
*
|
|
46
|
+
* @param assetPath - Path to resolve
|
|
47
|
+
* @param assetType - Type of asset (determines package subdirectory)
|
|
48
|
+
* @param baseDir - Base directory for relative paths (defaults to cwd)
|
|
49
|
+
* @returns Absolute path to asset
|
|
50
|
+
*/
|
|
51
|
+
export function resolveAsset(assetPath, assetType, baseDir) {
|
|
52
|
+
const packageRoot = getPackageRoot();
|
|
53
|
+
// Bare name → package asset
|
|
54
|
+
if (!assetPath.includes('/') && !assetPath.includes('\\')) {
|
|
55
|
+
if (assetType === 'template') {
|
|
56
|
+
return path.join(packageRoot, 'templates', assetPath);
|
|
57
|
+
}
|
|
58
|
+
// config or bundle → examples directory
|
|
59
|
+
return path.join(packageRoot, 'examples', assetPath);
|
|
60
|
+
}
|
|
61
|
+
// Absolute path → use as-is
|
|
62
|
+
if (path.isAbsolute(assetPath)) {
|
|
63
|
+
return assetPath;
|
|
64
|
+
}
|
|
65
|
+
// Relative path → resolve from base directory
|
|
66
|
+
const resolveBase = baseDir || process.cwd();
|
|
67
|
+
return path.resolve(resolveBase, assetPath);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=asset-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-resolver.js","sourceRoot":"","sources":["../../src/core/asset-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEnD,mFAAmF;IACnF,wDAAwD;IACxD,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,qDAAqD;QACrD,kFAAkF;QAClF,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAED,yCAAyC;IACzC,qEAAqE;IACrE,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAC1B,SAAiB,EACjB,SAAoB,EACpB,OAAgB;IAEhB,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,4BAA4B;IAC5B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1D,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QACxD,CAAC;QACD,wCAAwC;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACvD,CAAC;IAED,4BAA4B;IAC5B,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,8CAA8C;IAC9C,MAAM,WAAW,GAAG,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAC9C,CAAC"}
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
|
package/dist/core/index.js
CHANGED
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -48,15 +48,18 @@ interface BuildOptions extends Pick<BuildOptions$1, 'format' | 'target' | 'minif
|
|
|
48
48
|
* User code to include in bundle.
|
|
49
49
|
*
|
|
50
50
|
* @remarks
|
|
51
|
-
*
|
|
51
|
+
* Optional custom JavaScript/TypeScript code that will be included in the bundle.
|
|
52
52
|
* Can reference imported packages and will be executed when bundle loads.
|
|
53
|
+
* If omitted, the template's default behavior will be used.
|
|
54
|
+
*
|
|
55
|
+
* @default ""
|
|
53
56
|
*
|
|
54
57
|
* @example
|
|
55
58
|
* ```typescript
|
|
56
59
|
* "export default () => startFlow({ sources: {...}, destinations: {...} })"
|
|
57
60
|
* ```
|
|
58
61
|
*/
|
|
59
|
-
code
|
|
62
|
+
code?: string;
|
|
60
63
|
/**
|
|
61
64
|
* Output file path.
|
|
62
65
|
*
|
package/dist/index.js
CHANGED
|
@@ -164,7 +164,7 @@ async function executeInDocker(command, args, options = {}, configFile) {
|
|
|
164
164
|
options,
|
|
165
165
|
configFile
|
|
166
166
|
);
|
|
167
|
-
return new Promise((
|
|
167
|
+
return new Promise((resolve, reject) => {
|
|
168
168
|
const proc = spawn(dockerCmd[0], dockerCmd.slice(1), {
|
|
169
169
|
stdio: options.silent ? "ignore" : "inherit",
|
|
170
170
|
shell: false
|
|
@@ -174,7 +174,7 @@ async function executeInDocker(command, args, options = {}, configFile) {
|
|
|
174
174
|
});
|
|
175
175
|
proc.on("exit", (code) => {
|
|
176
176
|
if (code === 0) {
|
|
177
|
-
|
|
177
|
+
resolve();
|
|
178
178
|
} else {
|
|
179
179
|
reject(new Error(`Docker command exited with code ${code}`));
|
|
180
180
|
}
|
|
@@ -182,12 +182,12 @@ async function executeInDocker(command, args, options = {}, configFile) {
|
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
184
|
async function isDockerAvailable() {
|
|
185
|
-
return new Promise((
|
|
185
|
+
return new Promise((resolve) => {
|
|
186
186
|
const proc = spawn("docker", ["--version"], {
|
|
187
187
|
stdio: "ignore"
|
|
188
188
|
});
|
|
189
|
-
proc.on("error", () =>
|
|
190
|
-
proc.on("exit", (code) =>
|
|
189
|
+
proc.on("error", () => resolve(false));
|
|
190
|
+
proc.on("exit", (code) => resolve(code === 0));
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
function buildDockerRunCommand(mode, flowPath, options = {}) {
|
|
@@ -226,7 +226,7 @@ function buildDockerRunCommand(mode, flowPath, options = {}) {
|
|
|
226
226
|
}
|
|
227
227
|
async function executeRunInDocker(mode, flowPath, options = {}) {
|
|
228
228
|
const dockerCmd = buildDockerRunCommand(mode, flowPath, options);
|
|
229
|
-
return new Promise((
|
|
229
|
+
return new Promise((resolve, reject) => {
|
|
230
230
|
const proc = spawn(dockerCmd[0], dockerCmd.slice(1), {
|
|
231
231
|
stdio: options.silent ? "ignore" : "inherit",
|
|
232
232
|
shell: false
|
|
@@ -236,7 +236,7 @@ async function executeRunInDocker(mode, flowPath, options = {}) {
|
|
|
236
236
|
});
|
|
237
237
|
proc.on("exit", (code) => {
|
|
238
238
|
if (code === 0) {
|
|
239
|
-
|
|
239
|
+
resolve();
|
|
240
240
|
} else {
|
|
241
241
|
reject(new Error(`Docker command exited with code ${code}`));
|
|
242
242
|
}
|
|
@@ -283,6 +283,32 @@ async function executeCommand(localHandler, dockerCommand, dockerArgs, options,
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
// src/core/asset-resolver.ts
|
|
287
|
+
import { fileURLToPath } from "url";
|
|
288
|
+
import path2 from "path";
|
|
289
|
+
function getPackageRoot() {
|
|
290
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
291
|
+
if (currentFile.includes("/src/")) {
|
|
292
|
+
const srcIndex = currentFile.indexOf("/src/");
|
|
293
|
+
return currentFile.substring(0, srcIndex);
|
|
294
|
+
}
|
|
295
|
+
return path2.resolve(currentFile, "../..");
|
|
296
|
+
}
|
|
297
|
+
function resolveAsset(assetPath, assetType, baseDir) {
|
|
298
|
+
const packageRoot = getPackageRoot();
|
|
299
|
+
if (!assetPath.includes("/") && !assetPath.includes("\\")) {
|
|
300
|
+
if (assetType === "template") {
|
|
301
|
+
return path2.join(packageRoot, "templates", assetPath);
|
|
302
|
+
}
|
|
303
|
+
return path2.join(packageRoot, "examples", assetPath);
|
|
304
|
+
}
|
|
305
|
+
if (path2.isAbsolute(assetPath)) {
|
|
306
|
+
return assetPath;
|
|
307
|
+
}
|
|
308
|
+
const resolveBase = baseDir || process.cwd();
|
|
309
|
+
return path2.resolve(resolveBase, assetPath);
|
|
310
|
+
}
|
|
311
|
+
|
|
286
312
|
// src/config/validators.ts
|
|
287
313
|
function isObject(value) {
|
|
288
314
|
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value) === "[object Object]";
|
|
@@ -299,9 +325,9 @@ function isSingleEnvConfig(data) {
|
|
|
299
325
|
|
|
300
326
|
// src/config/utils.ts
|
|
301
327
|
import fs from "fs-extra";
|
|
302
|
-
import
|
|
328
|
+
import path3 from "path";
|
|
303
329
|
async function loadJsonConfig(configPath) {
|
|
304
|
-
const absolutePath =
|
|
330
|
+
const absolutePath = path3.resolve(configPath);
|
|
305
331
|
if (!await fs.pathExists(absolutePath)) {
|
|
306
332
|
throw new Error(`Configuration file not found: ${absolutePath}`);
|
|
307
333
|
}
|
|
@@ -316,8 +342,8 @@ async function loadJsonConfig(configPath) {
|
|
|
316
342
|
}
|
|
317
343
|
function getTempDir(tempDir = ".tmp") {
|
|
318
344
|
const randomId = Math.random().toString(36).substring(2, 11);
|
|
319
|
-
const basePath =
|
|
320
|
-
return
|
|
345
|
+
const basePath = path3.isAbsolute(tempDir) ? tempDir : path3.join(process.cwd(), tempDir);
|
|
346
|
+
return path3.join(basePath, `cli-${Date.now()}-${randomId}`);
|
|
321
347
|
}
|
|
322
348
|
|
|
323
349
|
// src/config/defaults.ts
|
|
@@ -353,23 +379,20 @@ function ensureBuildOptions(buildOptions, flowPlatform) {
|
|
|
353
379
|
buildOptions.code || "",
|
|
354
380
|
buildOptions.output
|
|
355
381
|
);
|
|
356
|
-
if (!buildOptions.code && !defaults.code) {
|
|
357
|
-
throw new Error("BuildOptions.code is required");
|
|
358
|
-
}
|
|
359
382
|
if (!buildOptions.output && !defaults.output) {
|
|
360
383
|
throw new Error("BuildOptions.output is required");
|
|
361
384
|
}
|
|
362
385
|
return {
|
|
363
386
|
...defaults,
|
|
364
387
|
...buildOptions,
|
|
365
|
-
code: buildOptions.code || defaults.code,
|
|
388
|
+
code: buildOptions.code || defaults.code || "",
|
|
366
389
|
output: buildOptions.output || defaults.output,
|
|
367
390
|
packages: buildOptions.packages || defaults.packages
|
|
368
391
|
};
|
|
369
392
|
}
|
|
370
393
|
|
|
371
394
|
// src/config/parser.ts
|
|
372
|
-
import
|
|
395
|
+
import path4 from "path";
|
|
373
396
|
function parseBundleConfig(data) {
|
|
374
397
|
if (!isObject(data)) {
|
|
375
398
|
throw new Error(`Invalid config: expected object, got ${typeof data}`);
|
|
@@ -428,10 +451,13 @@ function normalizeConfigs(config, configPath) {
|
|
|
428
451
|
...buildDefaults,
|
|
429
452
|
...config.build
|
|
430
453
|
};
|
|
431
|
-
if (
|
|
454
|
+
if (buildConfig.template === void 0) {
|
|
455
|
+
buildConfig.template = platform === "server" ? "server.hbs" : "web.hbs";
|
|
456
|
+
}
|
|
457
|
+
if (configPath && buildConfig.template && !path4.isAbsolute(buildConfig.template)) {
|
|
432
458
|
if (buildConfig.template.startsWith("./") || buildConfig.template.startsWith("../")) {
|
|
433
|
-
const configDir =
|
|
434
|
-
buildConfig.template =
|
|
459
|
+
const configDir = path4.dirname(configPath);
|
|
460
|
+
buildConfig.template = path4.resolve(configDir, buildConfig.template);
|
|
435
461
|
}
|
|
436
462
|
}
|
|
437
463
|
const buildOptions = ensureBuildOptions(buildConfig, platform);
|
|
@@ -538,15 +564,15 @@ import fs4 from "fs-extra";
|
|
|
538
564
|
|
|
539
565
|
// src/commands/bundle/package-manager.ts
|
|
540
566
|
import pacote from "pacote";
|
|
541
|
-
import
|
|
567
|
+
import path5 from "path";
|
|
542
568
|
import fs2 from "fs-extra";
|
|
543
569
|
function getPackageDirectory(baseDir, packageName, version) {
|
|
544
|
-
return
|
|
570
|
+
return path5.join(baseDir, "node_modules", packageName);
|
|
545
571
|
}
|
|
546
572
|
function getCachedPackagePath(pkg, tempDir) {
|
|
547
|
-
const cacheDir =
|
|
573
|
+
const cacheDir = path5.join(".tmp", "cache", "packages");
|
|
548
574
|
const safeName = pkg.name.replace(/\//g, "-").replace(/@/g, "");
|
|
549
|
-
return
|
|
575
|
+
return path5.join(cacheDir, `${safeName}-${pkg.version}`);
|
|
550
576
|
}
|
|
551
577
|
async function isPackageCached(pkg, tempDir) {
|
|
552
578
|
const cachedPath = getCachedPackagePath(pkg, tempDir);
|
|
@@ -584,7 +610,7 @@ async function resolveDependencies(pkg, packageDir, logger, visited = /* @__PURE
|
|
|
584
610
|
}
|
|
585
611
|
visited.add(pkgKey);
|
|
586
612
|
try {
|
|
587
|
-
const packageJsonPath =
|
|
613
|
+
const packageJsonPath = path5.join(packageDir, "package.json");
|
|
588
614
|
if (await fs2.pathExists(packageJsonPath)) {
|
|
589
615
|
const packageJson = await fs2.readJson(packageJsonPath);
|
|
590
616
|
const deps = {
|
|
@@ -621,7 +647,7 @@ async function downloadPackages(packages, targetDir, logger, useCache = true) {
|
|
|
621
647
|
if (useCache && await isPackageCached(pkg, targetDir)) {
|
|
622
648
|
logger.debug(`Using cached ${packageSpec}...`);
|
|
623
649
|
try {
|
|
624
|
-
await fs2.ensureDir(
|
|
650
|
+
await fs2.ensureDir(path5.dirname(packageDir));
|
|
625
651
|
await fs2.copy(cachedPath, packageDir);
|
|
626
652
|
packagePaths.set(pkg.name, packageDir);
|
|
627
653
|
const deps = await resolveDependencies(pkg, packageDir, logger);
|
|
@@ -640,8 +666,8 @@ async function downloadPackages(packages, targetDir, logger, useCache = true) {
|
|
|
640
666
|
}
|
|
641
667
|
logger.debug(`Downloading ${packageSpec}...`);
|
|
642
668
|
try {
|
|
643
|
-
await fs2.ensureDir(
|
|
644
|
-
const cacheDir = process.env.NPM_CACHE_DIR ||
|
|
669
|
+
await fs2.ensureDir(path5.dirname(packageDir));
|
|
670
|
+
const cacheDir = process.env.NPM_CACHE_DIR || path5.join(process.cwd(), ".npm-cache");
|
|
645
671
|
await pacote.extract(packageSpec, packageDir, {
|
|
646
672
|
// Force npm registry download, prevent workspace resolution
|
|
647
673
|
registry: "https://registry.npmjs.org",
|
|
@@ -654,7 +680,7 @@ async function downloadPackages(packages, targetDir, logger, useCache = true) {
|
|
|
654
680
|
});
|
|
655
681
|
if (useCache) {
|
|
656
682
|
try {
|
|
657
|
-
await fs2.ensureDir(
|
|
683
|
+
await fs2.ensureDir(path5.dirname(cachedPath));
|
|
658
684
|
await fs2.copy(packageDir, cachedPath);
|
|
659
685
|
logger.debug(`Cached ${packageSpec} for future use`);
|
|
660
686
|
} catch (cacheError) {
|
|
@@ -678,7 +704,6 @@ async function downloadPackages(packages, targetDir, logger, useCache = true) {
|
|
|
678
704
|
|
|
679
705
|
// src/commands/bundle/template-engine.ts
|
|
680
706
|
import fs3 from "fs-extra";
|
|
681
|
-
import path5 from "path";
|
|
682
707
|
import Handlebars from "handlebars";
|
|
683
708
|
|
|
684
709
|
// src/commands/bundle/serializer.ts
|
|
@@ -789,9 +814,11 @@ var TemplateEngine = class {
|
|
|
789
814
|
}
|
|
790
815
|
/**
|
|
791
816
|
* Load template content from file path
|
|
817
|
+
*
|
|
818
|
+
* @param templatePath - Template path (bare name, relative, or absolute)
|
|
792
819
|
*/
|
|
793
820
|
async loadTemplate(templatePath) {
|
|
794
|
-
const resolvedPath =
|
|
821
|
+
const resolvedPath = resolveAsset(templatePath, "template");
|
|
795
822
|
if (!await fs3.pathExists(resolvedPath)) {
|
|
796
823
|
throw new Error(`Template file not found: ${resolvedPath}`);
|
|
797
824
|
}
|
|
@@ -894,7 +921,10 @@ async function bundleCore(flowConfig, buildOptions, logger, showStats = false) {
|
|
|
894
921
|
try {
|
|
895
922
|
await esbuild.build(esbuildOptions);
|
|
896
923
|
} catch (buildError) {
|
|
897
|
-
throw createBuildError(
|
|
924
|
+
throw createBuildError(
|
|
925
|
+
buildError,
|
|
926
|
+
buildOptions.code || ""
|
|
927
|
+
);
|
|
898
928
|
}
|
|
899
929
|
logger.gray(`Output: ${outputPath}`);
|
|
900
930
|
let stats;
|
|
@@ -1110,8 +1140,8 @@ ${examplesMappings.join(",\n")}
|
|
|
1110
1140
|
const flowWithProps = flowConfig;
|
|
1111
1141
|
templatedCode = await templateEngine.process(
|
|
1112
1142
|
buildOptions.template,
|
|
1113
|
-
buildOptions.code,
|
|
1114
|
-
// Pass user code as parameter
|
|
1143
|
+
buildOptions.code || "",
|
|
1144
|
+
// Pass user code as parameter (empty if undefined)
|
|
1115
1145
|
flowWithProps.sources || {},
|
|
1116
1146
|
flowWithProps.destinations || {},
|
|
1117
1147
|
flowWithProps.collector || {},
|
|
@@ -1119,7 +1149,7 @@ ${examplesMappings.join(",\n")}
|
|
|
1119
1149
|
// Pass build config to template
|
|
1120
1150
|
);
|
|
1121
1151
|
} else {
|
|
1122
|
-
templatedCode = buildOptions.code;
|
|
1152
|
+
templatedCode = buildOptions.code || "";
|
|
1123
1153
|
}
|
|
1124
1154
|
let wrappedCode = templatedCode;
|
|
1125
1155
|
const hasExport = /^\s*export\s/m.test(templatedCode);
|
|
@@ -1702,7 +1732,6 @@ import {
|
|
|
1702
1732
|
|
|
1703
1733
|
// src/commands/run/validators.ts
|
|
1704
1734
|
import { existsSync } from "fs";
|
|
1705
|
-
import { resolve } from "path";
|
|
1706
1735
|
var VALID_MODES = ["collect", "serve"];
|
|
1707
1736
|
function validateMode(mode) {
|
|
1708
1737
|
if (!VALID_MODES.includes(mode)) {
|
|
@@ -1714,7 +1743,7 @@ function validateMode(mode) {
|
|
|
1714
1743
|
}
|
|
1715
1744
|
}
|
|
1716
1745
|
function validateFlowFile(filePath) {
|
|
1717
|
-
const absolutePath =
|
|
1746
|
+
const absolutePath = resolveAsset(filePath, "bundle");
|
|
1718
1747
|
if (!existsSync(absolutePath)) {
|
|
1719
1748
|
throw new Error(
|
|
1720
1749
|
`Flow file not found: ${filePath}
|
|
@@ -1925,9 +1954,8 @@ async function run(mode, options) {
|
|
|
1925
1954
|
}
|
|
1926
1955
|
|
|
1927
1956
|
// src/index.ts
|
|
1928
|
-
import { fileURLToPath } from "url";
|
|
1929
1957
|
var program = new Command();
|
|
1930
|
-
program.name("walkeros").description("walkerOS CLI - Bundle and deploy walkerOS components").version("0.
|
|
1958
|
+
program.name("walkeros").description("walkerOS CLI - Bundle and deploy walkerOS components").version("0.3.4");
|
|
1931
1959
|
program.command("bundle [file]").description("Bundle NPM packages with custom code").option(
|
|
1932
1960
|
"-e, --env <name>",
|
|
1933
1961
|
"environment to build (for multi-environment configs)"
|
|
@@ -1957,9 +1985,11 @@ program.command("simulate [file]").description("Simulate event processing and ca
|
|
|
1957
1985
|
});
|
|
1958
1986
|
});
|
|
1959
1987
|
var runCmd = program.command("run").description("Run walkerOS flows in collect or serve mode");
|
|
1960
|
-
runCmd.command("collect
|
|
1988
|
+
runCmd.command("collect [file]").description(
|
|
1989
|
+
"Run collector mode (event collection endpoint). Defaults to server-collect.mjs if no file specified."
|
|
1990
|
+
).option("-p, --port <number>", "Port to listen on (default: 8080)", parseInt).option("-h, --host <address>", "Host address (default: 0.0.0.0)").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) => {
|
|
1961
1991
|
await runCommand("collect", {
|
|
1962
|
-
config: file,
|
|
1992
|
+
config: file || "server-collect.mjs",
|
|
1963
1993
|
port: options.port,
|
|
1964
1994
|
host: options.host,
|
|
1965
1995
|
json: options.json,
|
|
@@ -1969,9 +1999,11 @@ runCmd.command("collect <file>").description("Run collector mode (event collecti
|
|
|
1969
1999
|
silent: options.silent
|
|
1970
2000
|
});
|
|
1971
2001
|
});
|
|
1972
|
-
runCmd.command("serve
|
|
2002
|
+
runCmd.command("serve [file]").description(
|
|
2003
|
+
"Run serve mode (static file server for browser bundles). Defaults to web-serve.mjs if no file specified."
|
|
2004
|
+
).option("-p, --port <number>", "Port to listen on (default: 8080)", parseInt).option("-h, --host <address>", "Host address (default: 0.0.0.0)").option("--static-dir <dir>", "Static directory for serve mode").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) => {
|
|
1973
2005
|
await runCommand("serve", {
|
|
1974
|
-
config: file,
|
|
2006
|
+
config: file || "web-serve.mjs",
|
|
1975
2007
|
port: options.port,
|
|
1976
2008
|
host: options.host,
|
|
1977
2009
|
staticDir: options.staticDir,
|
|
@@ -1982,10 +2014,7 @@ runCmd.command("serve <file>").description("Run serve mode (static file server f
|
|
|
1982
2014
|
silent: options.silent
|
|
1983
2015
|
});
|
|
1984
2016
|
});
|
|
1985
|
-
|
|
1986
|
-
if (isMainModule) {
|
|
1987
|
-
program.parse();
|
|
1988
|
-
}
|
|
2017
|
+
program.parse();
|
|
1989
2018
|
export {
|
|
1990
2019
|
bundle,
|
|
1991
2020
|
bundleCommand,
|