@omnidist/omnidist 0.1.1 → 0.1.3

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/omnidist.js +11 -8
  2. package/package.json +6 -6
package/omnidist.js CHANGED
@@ -23,24 +23,27 @@ if (!platformKey) {
23
23
  process.exit(1);
24
24
  }
25
25
 
26
- // Extract just the package name without scope for the directory path
27
- // @scope/name -> name, unscoped-name -> unscoped-name
28
- const metaParts = '@omnidist/omnidist'.split('/');
29
- const pkgBase = metaParts.length > 1 ? metaParts[1] : metaParts[0];
30
- const platformPkgName = pkgBase + '-' + platformKey;
31
- const binDir = path.join(__dirname, '..', platformPkgName, 'bin');
26
+ const platformPkgName = '@omnidist/omnidist-' + platformKey;
32
27
  const binaryName = platform === 'win32' ? 'omnidist.exe' : 'omnidist';
33
- const binaryPath = path.join(binDir, binaryName);
34
28
 
35
29
  try {
36
30
  const { execFileSync } = require('child_process');
31
+ const platformPkgJSON = require.resolve(platformPkgName + '/package.json', { paths: [__dirname] });
32
+ const platformPkgDir = path.dirname(platformPkgJSON);
33
+ const binaryPath = path.join(platformPkgDir, 'bin', binaryName);
37
34
  process.exit(execFileSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' }));
38
35
  } catch (e) {
39
36
  if (e.code === 'ENOENT') {
40
- console.error('Binary not found: ' + binaryPath);
37
+ console.error('Binary not found in package: ' + platformPkgName);
41
38
  console.error('Expected platform package: ' + '@omnidist/omnidist-' + platformKey);
42
39
  console.error('This may be an unsupported platform or installation issue.');
43
40
  process.exit(1);
44
41
  }
42
+ if (e.code === 'MODULE_NOT_FOUND') {
43
+ console.error('Platform package not installed: ' + platformPkgName);
44
+ console.error('Expected platform package: ' + '@omnidist/omnidist-' + platformKey);
45
+ console.error('Try reinstalling the package, and ensure optional dependencies are enabled.');
46
+ process.exit(1);
47
+ }
45
48
  process.exit(e.status || 1);
46
49
  }
package/package.json CHANGED
@@ -11,11 +11,11 @@
11
11
  ],
12
12
  "name": "@omnidist/omnidist",
13
13
  "optionalDependencies": {
14
- "@omnidist/omnidist-darwin-arm64": "0.1.1",
15
- "@omnidist/omnidist-darwin-x64": "0.1.1",
16
- "@omnidist/omnidist-linux-arm64": "0.1.1",
17
- "@omnidist/omnidist-linux-x64": "0.1.1",
18
- "@omnidist/omnidist-win32-x64": "0.1.1"
14
+ "@omnidist/omnidist-darwin-arm64": "0.1.3",
15
+ "@omnidist/omnidist-darwin-x64": "0.1.3",
16
+ "@omnidist/omnidist-linux-arm64": "0.1.3",
17
+ "@omnidist/omnidist-linux-x64": "0.1.3",
18
+ "@omnidist/omnidist-win32-x64": "0.1.3"
19
19
  },
20
- "version": "0.1.1"
20
+ "version": "0.1.3"
21
21
  }