xgauntlet 0.5.2 → 0.7.0
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/xgauntlet.js +15 -4
- package/package.json +1 -1
package/bin/xgauntlet.js
CHANGED
|
@@ -17,9 +17,7 @@ const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
|
|
|
17
17
|
const VERSION = pkg.version;
|
|
18
18
|
const REPO = 'rolfmadsen/xgauntlet';
|
|
19
19
|
|
|
20
|
-
function getPlatformInfo() {
|
|
21
|
-
const platform = os.platform();
|
|
22
|
-
const arch = os.arch();
|
|
20
|
+
export function getPlatformInfo(platform = os.platform(), arch = os.arch()) {
|
|
23
21
|
const isWindows = platform === 'win32';
|
|
24
22
|
const binName = isWindows ? 'xgauntlet.exe' : 'xgauntlet';
|
|
25
23
|
|
|
@@ -188,4 +186,17 @@ async function main() {
|
|
|
188
186
|
});
|
|
189
187
|
}
|
|
190
188
|
|
|
191
|
-
|
|
189
|
+
function isMainModule() {
|
|
190
|
+
if (!process.argv[1]) return false;
|
|
191
|
+
try {
|
|
192
|
+
const scriptPath = fs.realpathSync(process.argv[1]);
|
|
193
|
+
const modulePath = fs.realpathSync(fileURLToPath(import.meta.url));
|
|
194
|
+
return scriptPath === modulePath;
|
|
195
|
+
} catch {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (isMainModule()) {
|
|
201
|
+
main();
|
|
202
|
+
}
|