@agentfare/forge 0.2.2 → 0.2.4
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/install.js +14 -8
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -57,7 +57,12 @@ async function main() {
|
|
|
57
57
|
|
|
58
58
|
const { goos, goarch } = getPlatform();
|
|
59
59
|
const archiveName = `forge_${VERSION}_${goos}_${goarch}.tar.gz`;
|
|
60
|
-
|
|
60
|
+
|
|
61
|
+
// Support custom binary host for regions with poor GitHub connectivity.
|
|
62
|
+
// Usage: FORGE_BINARY_HOST=https://mirror.example.com npm install -g @agentfare/forge
|
|
63
|
+
const baseUrl = process.env.FORGE_BINARY_HOST
|
|
64
|
+
|| "https://github.com/MjxUpUp/forge/releases/download";
|
|
65
|
+
const url = `${baseUrl}/v${VERSION}/${archiveName}`;
|
|
61
66
|
|
|
62
67
|
const archivePath = path.join(binDir, archiveName);
|
|
63
68
|
console.log(`Downloading forge v${VERSION} for ${goos}/${goarch}...`);
|
|
@@ -65,12 +70,9 @@ async function main() {
|
|
|
65
70
|
await download(url, archivePath);
|
|
66
71
|
console.log(`Downloaded to ${archivePath}`);
|
|
67
72
|
|
|
68
|
-
// Extract
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
const normArchivePath = archivePath.replace(/\\/g, "/");
|
|
72
|
-
const normBinDir = binDir.replace(/\\/g, "/");
|
|
73
|
-
execSync(`tar xzf "${normArchivePath}" -C "${normBinDir}" --force-local`, { stdio: "inherit" });
|
|
73
|
+
// Extract using relative path (cwd=binDir) to avoid Windows tar
|
|
74
|
+
// interpreting "X:/path" as a remote host connection.
|
|
75
|
+
execSync(`tar xzf "${archiveName}"`, { cwd: binDir, stdio: "inherit" });
|
|
74
76
|
|
|
75
77
|
// Make executable
|
|
76
78
|
const binaryName = getBinaryName();
|
|
@@ -87,6 +89,10 @@ async function main() {
|
|
|
87
89
|
|
|
88
90
|
main().catch((err) => {
|
|
89
91
|
console.error("Installation failed:", err.message);
|
|
90
|
-
console.error("
|
|
92
|
+
console.error("");
|
|
93
|
+
console.error("If GitHub is unreachable, set a mirror:");
|
|
94
|
+
console.error(" FORGE_BINARY_HOST=https://your-mirror.com npm install -g @agentfare/forge");
|
|
95
|
+
console.error("");
|
|
96
|
+
console.error("Or download manually: https://github.com/MjxUpUp/forge/releases");
|
|
91
97
|
process.exit(1);
|
|
92
98
|
});
|