mercury-agent 0.4.9 → 0.4.11
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/package.json +1 -1
- package/src/cli/mercury.ts +17 -5
package/package.json
CHANGED
package/src/cli/mercury.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
readdirSync,
|
|
11
11
|
readFileSync,
|
|
12
12
|
rmSync,
|
|
13
|
+
statSync,
|
|
13
14
|
unlinkSync,
|
|
14
15
|
writeFileSync,
|
|
15
16
|
} from "node:fs";
|
|
@@ -37,6 +38,19 @@ const TEMPLATES_DIR = join(PACKAGE_ROOT, "resources/templates");
|
|
|
37
38
|
const PROFILES_DIR = join(PACKAGE_ROOT, "resources/profiles");
|
|
38
39
|
const VALID_EXT_NAME_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
39
40
|
|
|
41
|
+
function copyDirRecursive(src: string, dest: string): void {
|
|
42
|
+
mkdirSync(dest, { recursive: true });
|
|
43
|
+
for (const entry of readdirSync(src)) {
|
|
44
|
+
const srcPath = join(src, entry);
|
|
45
|
+
const destPath = join(dest, entry);
|
|
46
|
+
if (statSync(srcPath).isDirectory()) {
|
|
47
|
+
copyDirRecursive(srcPath, destPath);
|
|
48
|
+
} else {
|
|
49
|
+
copyFileSync(srcPath, destPath);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
40
54
|
function isPortInUse(port: string): boolean {
|
|
41
55
|
if (process.platform === "win32") {
|
|
42
56
|
const result = spawnSync("netstat", ["-ano"], {
|
|
@@ -238,10 +252,8 @@ function buildAction(): void {
|
|
|
238
252
|
);
|
|
239
253
|
process.exit(1);
|
|
240
254
|
}
|
|
241
|
-
cpSync
|
|
242
|
-
|
|
243
|
-
filter: (src) => !src.split(/[\\/]/).includes("node_modules"),
|
|
244
|
-
});
|
|
255
|
+
// Bun's cpSync is broken on Windows — use manual recursive copy.
|
|
256
|
+
copyDirRecursive(resourcesSrc, resourcesDest);
|
|
245
257
|
if (!existsSync(resourcesDest)) {
|
|
246
258
|
console.error(`❌ Failed to copy resources/ into build context`);
|
|
247
259
|
console.error(` Source: ${resourcesSrc} (exists: ${existsSync(resourcesSrc)})`);
|
|
@@ -251,7 +263,7 @@ function buildAction(): void {
|
|
|
251
263
|
|
|
252
264
|
const examplesSrc = join(PACKAGE_ROOT, "examples", "extensions");
|
|
253
265
|
const examplesDest = join(tmpDir, "examples", "extensions");
|
|
254
|
-
|
|
266
|
+
copyDirRecursive(examplesSrc, examplesDest);
|
|
255
267
|
|
|
256
268
|
console.log(`📦 Building container image...`);
|
|
257
269
|
console.log(` Package root: ${PACKAGE_ROOT}`);
|