@l10nmonster/cli 3.0.0-alpha.12 → 3.0.0-alpha.13
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/index.js +1 -2
- package/l10n.mjs +19 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
2
|
|
|
3
3
|
import { Command, Argument, Option, InvalidArgumentError } from 'commander';
|
|
4
|
-
import { getVerbosity } from '@l10nmonster/core';
|
|
5
4
|
|
|
6
5
|
import path from 'path';
|
|
7
6
|
import { readFileSync } from 'fs';
|
|
@@ -82,7 +81,7 @@ export default async function runMonsterCLI(monsterConfig, cliCommand) {
|
|
|
82
81
|
const argv = typeof cliCommand === 'string' ? cliCommand.split(' ') : cliCommand;
|
|
83
82
|
await monsterCLI.parseAsync(argv);
|
|
84
83
|
} catch(e) {
|
|
85
|
-
console.error(`Unable to run CLI: ${
|
|
84
|
+
console.error(`Unable to run the CLI: ${e.message ?? e}`);
|
|
86
85
|
process.exit(1);
|
|
87
86
|
}
|
|
88
87
|
}
|
package/l10n.mjs
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// Global unhandled promise rejection handler
|
|
4
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
5
|
+
console.error('🚨 Unhandled Promise Rejection detected:');
|
|
6
|
+
console.error('Promise:', promise);
|
|
7
|
+
console.error('Reason:', reason);
|
|
8
|
+
if (reason instanceof Error && reason.stack) {
|
|
9
|
+
console.error('Stack trace:', reason.stack);
|
|
10
|
+
}
|
|
11
|
+
// In CLI context, we should exit on unhandled rejections to prevent silent failures
|
|
12
|
+
console.error('Exiting due to unhandled promise rejection...');
|
|
13
|
+
process.exit(1);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Global uncaught exception handler (for completeness)
|
|
17
|
+
process.on('uncaughtException', (error) => {
|
|
18
|
+
console.error('🚨 Uncaught Exception:', error);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
});
|
|
21
|
+
|
|
3
22
|
import runMonsterCLI from './index.js';
|
|
4
23
|
import { resolve, dirname, join } from 'path';
|
|
5
24
|
import { existsSync } from 'fs';
|