squad-station 0.8.17 → 0.8.18
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/run.js +27 -1
- package/package.json +1 -1
package/bin/run.js
CHANGED
|
@@ -45,7 +45,7 @@ function install() {
|
|
|
45
45
|
|
|
46
46
|
function installBinary() {
|
|
47
47
|
// Binary version — may differ from npm package version
|
|
48
|
-
var VERSION = '0.8.
|
|
48
|
+
var VERSION = '0.8.18';
|
|
49
49
|
var REPO = 'thientranhung/squad-station';
|
|
50
50
|
|
|
51
51
|
var isWindows = process.platform === 'win32';
|
|
@@ -75,6 +75,7 @@ function installBinary() {
|
|
|
75
75
|
var result = spawnSync(destPath, ['--version'], { encoding: 'utf8' });
|
|
76
76
|
if (result.stdout && result.stdout.includes(VERSION)) {
|
|
77
77
|
console.log(' \x1b[32m✓\x1b[0m squad-station v' + VERSION + ' already installed at ' + destPath);
|
|
78
|
+
checkDuplicateBinary(destPath);
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
} catch (_) {
|
|
@@ -118,6 +119,9 @@ function installBinary() {
|
|
|
118
119
|
|
|
119
120
|
// Verify the binary is actually callable via PATH
|
|
120
121
|
verifyInPath(destPath, installDir);
|
|
122
|
+
|
|
123
|
+
// Check for duplicate binaries at other locations
|
|
124
|
+
checkDuplicateBinary(destPath);
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
// Find the best install directory that is already in the user's PATH.
|
|
@@ -203,6 +207,28 @@ function verifyInPath(destPath, installDir) {
|
|
|
203
207
|
console.log('');
|
|
204
208
|
}
|
|
205
209
|
|
|
210
|
+
// Check if another squad-station binary exists at a different path than where we installed.
|
|
211
|
+
function checkDuplicateBinary(installedPath) {
|
|
212
|
+
var isWindows = process.platform === 'win32';
|
|
213
|
+
var checkCmd = isWindows ? 'where' : 'which';
|
|
214
|
+
var result = spawnSync(checkCmd, ['squad-station'], { encoding: 'utf8' });
|
|
215
|
+
|
|
216
|
+
if (result.status !== 0 || !result.stdout || !result.stdout.trim()) {
|
|
217
|
+
return; // not in PATH at all — verifyInPath already warned
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
var resolvedWhich = fs.realpathSync(result.stdout.trim());
|
|
221
|
+
var resolvedInstalled = fs.realpathSync(installedPath);
|
|
222
|
+
|
|
223
|
+
if (resolvedWhich !== resolvedInstalled) {
|
|
224
|
+
console.log('');
|
|
225
|
+
console.log(' \x1b[33m⚠ Another squad-station found at: ' + result.stdout.trim() + '\x1b[0m');
|
|
226
|
+
console.log(' This version will be used instead of the one just installed.');
|
|
227
|
+
console.log(' Remove it to avoid conflicts: \x1b[36mrm ' + result.stdout.trim() + '\x1b[0m');
|
|
228
|
+
console.log('');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
206
232
|
// ── Uninstall ───────────────────────────────────────────────────────
|
|
207
233
|
// Find and remove all squad-station binaries from known locations.
|
|
208
234
|
|