@potstackhub/poka 2.0.3 → 2.0.6

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.
Files changed (2) hide show
  1. package/npm/cli.js +14 -12
  2. package/package.json +4 -4
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
- // Find binary path
30
- // __dirname is .../node_modules/@potstackhub/poka/npm
31
- // Need to go up to package root, then into node_modules
32
- const packageRoot = path.dirname(__dirname); // .../node_modules/@potstackhub/poka
33
- const platformPkgPath = path.join(packageRoot, 'node_modules', platformPackage, 'npm');
34
- const binaryName = platform === 'win32' ? 'poka.exe' : 'poka';
35
- const binaryPath = path.join(platformPkgPath, binaryName);
36
-
37
- if (!fs.existsSync(binaryPath)) {
38
- console.error(`Error: Binary not found for ${targetPlatform}-${targetArch}`);
39
- console.error(`Expected path: ${binaryPath}`);
40
- console.error(`Platform package: ${platformPackage}`);
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);
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@potstackhub/poka",
3
- "version": "2.0.3",
3
+ "version": "2.0.6",
4
4
  "description": "Tools for potstack software develop",
5
5
  "main": "npm/index.js",
6
6
  "bin": {
7
7
  "poka": "npm/cli.js"
8
8
  },
9
9
  "optionalDependencies": {
10
- "@potstackhub/poka-linux-x64": "1.0.0",
11
- "@potstackhub/poka-linux-arm64": "1.0.0",
12
- "@potstackhub/poka-darwin-x64": "1.0.0",
13
10
  "@potstackhub/poka-darwin-arm64": "1.0.0",
11
+ "@potstackhub/poka-darwin-x64": "1.0.0",
12
+ "@potstackhub/poka-linux-arm64": "1.0.0",
13
+ "@potstackhub/poka-linux-x64": "1.0.3",
14
14
  "@potstackhub/poka-win32-x64": "1.0.0"
15
15
  },
16
16
  "keywords": [