@akin01/mailgen 0.1.2 → 0.1.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/bin/mailgen.js +6 -3
- package/package.json +1 -1
package/bin/mailgen.js
CHANGED
|
@@ -5,11 +5,14 @@ const path = require('path');
|
|
|
5
5
|
const os = require('os');
|
|
6
6
|
const { spawnSync } = require('child_process');
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const primaryBinName = os.platform() === 'win32' ? 'mailgen.exe' : 'mailgen';
|
|
9
|
+
const legacyBinName = os.platform() === 'win32' ? 'emailgen.exe' : 'emailgen';
|
|
10
|
+
const primaryBinPath = path.join(__dirname, primaryBinName);
|
|
11
|
+
const legacyBinPath = path.join(__dirname, legacyBinName);
|
|
12
|
+
const binPath = fs.existsSync(primaryBinPath) ? primaryBinPath : legacyBinPath;
|
|
10
13
|
|
|
11
14
|
if (!fs.existsSync(binPath)) {
|
|
12
|
-
console.error(
|
|
15
|
+
console.error(`mailgen binary not found. Looked for ${primaryBinName} and ${legacyBinName}. Please reinstall the package.`);
|
|
13
16
|
process.exit(1);
|
|
14
17
|
}
|
|
15
18
|
|