mercury-agent 0.4.10 → 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 -4
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,9 +252,8 @@ function buildAction(): void {
|
|
|
238
252
|
);
|
|
239
253
|
process.exit(1);
|
|
240
254
|
}
|
|
241
|
-
// Bun's cpSync
|
|
242
|
-
|
|
243
|
-
cpSync(resourcesSrc, resourcesDest, { recursive: true });
|
|
255
|
+
// Bun's cpSync is broken on Windows — use manual recursive copy.
|
|
256
|
+
copyDirRecursive(resourcesSrc, resourcesDest);
|
|
244
257
|
if (!existsSync(resourcesDest)) {
|
|
245
258
|
console.error(`❌ Failed to copy resources/ into build context`);
|
|
246
259
|
console.error(` Source: ${resourcesSrc} (exists: ${existsSync(resourcesSrc)})`);
|
|
@@ -250,7 +263,7 @@ function buildAction(): void {
|
|
|
250
263
|
|
|
251
264
|
const examplesSrc = join(PACKAGE_ROOT, "examples", "extensions");
|
|
252
265
|
const examplesDest = join(tmpDir, "examples", "extensions");
|
|
253
|
-
|
|
266
|
+
copyDirRecursive(examplesSrc, examplesDest);
|
|
254
267
|
|
|
255
268
|
console.log(`📦 Building container image...`);
|
|
256
269
|
console.log(` Package root: ${PACKAGE_ROOT}`);
|