drft-cli 0.1.0 → 0.1.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/bin/drft +2 -2
- package/install.js +8 -5
- package/package.json +1 -1
package/bin/drft
CHANGED
|
@@ -7,11 +7,11 @@ const path = require("path");
|
|
|
7
7
|
const fs = require("fs");
|
|
8
8
|
|
|
9
9
|
const ext = process.platform === "win32" ? ".exe" : "";
|
|
10
|
-
const binPath = path.join(__dirname, `drft${ext}`);
|
|
10
|
+
const binPath = path.join(__dirname, "..", "native", `drft${ext}`);
|
|
11
11
|
|
|
12
12
|
if (!fs.existsSync(binPath)) {
|
|
13
13
|
console.error(
|
|
14
|
-
"drft: binary not found. Run `npm rebuild drft` or install from source: cargo install drft-cli"
|
|
14
|
+
"drft: binary not found. Run `npm rebuild drft-cli` or install from source: cargo install drft-cli"
|
|
15
15
|
);
|
|
16
16
|
process.exit(2);
|
|
17
17
|
}
|
package/install.js
CHANGED
|
@@ -64,14 +64,17 @@ async function main() {
|
|
|
64
64
|
process.exit(0); // Don't fail the install — just won't have the binary
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
const
|
|
68
|
-
const
|
|
67
|
+
const nativeDir = path.join(__dirname, "native");
|
|
68
|
+
const binaryName = process.platform === "win32" ? "drft.exe" : "drft";
|
|
69
|
+
const binPath = path.join(nativeDir, binaryName);
|
|
69
70
|
|
|
70
71
|
// Skip if binary already exists (e.g., reinstall)
|
|
71
72
|
if (fs.existsSync(binPath)) {
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
fs.mkdirSync(nativeDir, { recursive: true });
|
|
77
|
+
|
|
75
78
|
const url = getDownloadUrl(assetName);
|
|
76
79
|
console.log(`drft: downloading ${platformKey} binary...`);
|
|
77
80
|
|
|
@@ -79,14 +82,14 @@ async function main() {
|
|
|
79
82
|
const data = await download(url);
|
|
80
83
|
|
|
81
84
|
// Write archive to temp file
|
|
82
|
-
const tmpFile = path.join(
|
|
85
|
+
const tmpFile = path.join(nativeDir, assetName);
|
|
83
86
|
fs.writeFileSync(tmpFile, data);
|
|
84
87
|
|
|
85
88
|
// Extract
|
|
86
89
|
if (assetName.endsWith(".tar.xz")) {
|
|
87
|
-
execSync(`tar xf "${tmpFile}" -C "${
|
|
90
|
+
execSync(`tar xf "${tmpFile}" -C "${nativeDir}" --strip-components=1`, { stdio: "pipe" });
|
|
88
91
|
} else if (assetName.endsWith(".zip")) {
|
|
89
|
-
execSync(`unzip -o "${tmpFile}" -d "${
|
|
92
|
+
execSync(`unzip -o "${tmpFile}" -d "${nativeDir}"`, { stdio: "pipe" });
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
// Clean up archive
|