mnemex 1.0.1 → 1.0.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.
- package/bin/mnemex +22 -0
- package/package.json +1 -1
- package/scripts/postinstall.js +4 -3
package/bin/mnemex
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execFileSync } = require('child_process');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
// Find the actual binary
|
|
7
|
+
const binDir = __dirname;
|
|
8
|
+
const platform = process.platform;
|
|
9
|
+
const binName = platform === 'win32' ? 'mnemex.exe' : 'mnemex-bin';
|
|
10
|
+
const binPath = path.join(binDir, binName);
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(binPath)) {
|
|
13
|
+
console.error('mnemex binary not found. Please reinstall: npm install -g mnemex');
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Execute the binary with all arguments
|
|
18
|
+
try {
|
|
19
|
+
execFileSync(binPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
20
|
+
} catch (err) {
|
|
21
|
+
process.exit(err.status || 1);
|
|
22
|
+
}
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -31,9 +31,10 @@ if (!pkgName) {
|
|
|
31
31
|
try {
|
|
32
32
|
const pkgPath = require.resolve(`${pkgName}/package.json`);
|
|
33
33
|
const pkgDir = path.dirname(pkgPath);
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
34
|
+
const srcBinName = PLATFORM === 'win32' ? 'mnemex.exe' : 'mnemex';
|
|
35
|
+
const destBinName = PLATFORM === 'win32' ? 'mnemex.exe' : 'mnemex-bin';
|
|
36
|
+
const srcBin = path.join(pkgDir, 'bin', srcBinName);
|
|
37
|
+
const destBin = path.join(__dirname, '..', 'bin', destBinName);
|
|
37
38
|
|
|
38
39
|
// Check if source binary exists
|
|
39
40
|
if (!fs.existsSync(srcBin)) {
|