@rtorr/nah 1.0.12 → 1.0.13
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/npm-bin/nah +1 -1
- package/npm-scripts/install.js +10 -4
- package/package.json +1 -1
package/npm-bin/nah
CHANGED
|
@@ -4,7 +4,7 @@ const { spawn } = require("child_process");
|
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
|
|
7
|
-
const binaryName = process.platform === "win32" ? "nah.exe" : "nah";
|
|
7
|
+
const binaryName = process.platform === "win32" ? "nah-bin.exe" : "nah-bin";
|
|
8
8
|
const binaryPath = path.join(__dirname, binaryName);
|
|
9
9
|
|
|
10
10
|
if (!fs.existsSync(binaryPath)) {
|
package/npm-scripts/install.js
CHANGED
|
@@ -23,7 +23,7 @@ function getPlatformKey() {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function getBinaryName() {
|
|
26
|
-
return process.platform === "win32" ? "nah.exe" : "nah";
|
|
26
|
+
return process.platform === "win32" ? "nah-bin.exe" : "nah-bin";
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function getDownloadUrl(platformKey) {
|
|
@@ -123,13 +123,19 @@ function extractTar(tarData, destDir) {
|
|
|
123
123
|
|
|
124
124
|
// Type: '0' or '\0' = regular file, '5' = directory
|
|
125
125
|
if (typeFlag === 48 || typeFlag === 0) {
|
|
126
|
-
// Regular file
|
|
127
|
-
|
|
126
|
+
// Regular file - rename nah to nah-bin to avoid conflict with wrapper script
|
|
127
|
+
let fileName = path.basename(name);
|
|
128
|
+
if (fileName === "nah") {
|
|
129
|
+
fileName = "nah-bin";
|
|
130
|
+
} else if (fileName === "nah.exe") {
|
|
131
|
+
fileName = "nah-bin.exe";
|
|
132
|
+
}
|
|
133
|
+
const filePath = path.join(destDir, fileName);
|
|
128
134
|
const fileData = tarData.slice(offset, offset + size);
|
|
129
135
|
fs.writeFileSync(filePath, fileData);
|
|
130
136
|
|
|
131
137
|
// Make executable if it's the nah binary
|
|
132
|
-
if (
|
|
138
|
+
if (fileName === "nah-bin") {
|
|
133
139
|
fs.chmodSync(filePath, 0o755);
|
|
134
140
|
}
|
|
135
141
|
}
|