@potstackhub/poka 2.0.3 → 2.0.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/npm/cli.js +14 -12
- package/package.json +1 -1
package/npm/cli.js
CHANGED
|
@@ -26,18 +26,20 @@ const targetArch = archMap[arch] || 'x64';
|
|
|
26
26
|
// Platform package name: @potstackhub/poka-linux-x64
|
|
27
27
|
const platformPackage = `@potstackhub/poka-${targetPlatform}-${targetArch}`;
|
|
28
28
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
console.error(`Platform package
|
|
29
|
+
// Try to find platform package using require.resolve
|
|
30
|
+
let binaryPath;
|
|
31
|
+
try {
|
|
32
|
+
// This resolves to the platform package's directory
|
|
33
|
+
const platformPkgDir = path.dirname(require.resolve(`${platformPackage}/package.json`));
|
|
34
|
+
binaryPath = path.join(platformPkgDir, 'npm', platform === 'win32' ? 'poka.exe' : 'poka');
|
|
35
|
+
|
|
36
|
+
if (!fs.existsSync(binaryPath)) {
|
|
37
|
+
throw new Error(`Binary not found at ${binaryPath}`);
|
|
38
|
+
}
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.error(`Error: Platform package not found for ${targetPlatform}-${targetArch}`);
|
|
41
|
+
console.error(`Expected package: ${platformPackage}`);
|
|
42
|
+
console.error(`Details: ${err.message}`);
|
|
41
43
|
console.error('');
|
|
42
44
|
console.error('Please report this issue at: https://github.com/potstackhub/poka/issues');
|
|
43
45
|
process.exit(1);
|