@l10nmonster/cli 3.0.0-alpha.2 → 3.0.0-alpha.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/README.md CHANGED
@@ -363,7 +363,7 @@ jobs:
363
363
 
364
364
  2. **Module import errors**
365
365
  ```bash
366
- # Verify Node.js version (requires >= 20.12.0)
366
+ # Verify Node.js version (requires >= 22.11.0)
367
367
  node --version
368
368
  ```
369
369
 
package/index.js CHANGED
@@ -59,7 +59,13 @@ export default async function runMonsterCLI(monsterConfig, cliCommand) {
59
59
  .option('-v, --verbose [level]', '0=error, 1=warning, 2=info, 3=verbose', intOptionParser)
60
60
  .option('--regression', 'keep variables constant during regression testing');
61
61
  try {
62
- const l10nRunner = async (cb) => await monsterConfig.run(monsterCLI.opts(), async l10n => await cb(l10n));
62
+ const l10nRunner = async (cb) => {
63
+ const { verbose, regression } = monsterCLI.opts();
64
+ await monsterConfig
65
+ .verbose(verbose)
66
+ .regression(regression)
67
+ .run(async mm => await cb(mm.l10n));
68
+ };
63
69
  monsterConfig.actions.forEach(Action => {
64
70
  const cmd = monsterCLI.command(Action.name);
65
71
  if (Action.subActions) {
@@ -72,7 +78,7 @@ export default async function runMonsterCLI(monsterConfig, cliCommand) {
72
78
  } else {
73
79
  configureCommand(cmd, Action, l10nRunner);
74
80
  }
75
- });
81
+ });
76
82
  const argv = typeof cliCommand === 'string' ? cliCommand.split(' ') : cliCommand;
77
83
  await monsterCLI.parseAsync(argv);
78
84
  } catch(e) {
package/l10n.mjs CHANGED
@@ -1,6 +1,49 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import runMonsterCLI from './index.js';
4
- import { resolve } from 'path';
4
+ import { resolve, dirname, join } from 'path';
5
+ import { existsSync } from 'fs';
5
6
 
6
- await runMonsterCLI((await import(resolve('.', 'l10nmonster.config.mjs'))).default);
7
+ function findConfigFile(startDir = process.cwd()) {
8
+ let currentDir = resolve(startDir);
9
+ const configFileName = 'l10nmonster.config.mjs';
10
+
11
+ while (true) {
12
+ const configPath = join(currentDir, configFileName);
13
+ if (existsSync(configPath)) {
14
+ return configPath;
15
+ }
16
+
17
+ const parentDir = dirname(currentDir);
18
+ if (parentDir === currentDir) {
19
+ // We've reached the root directory
20
+ break;
21
+ }
22
+ currentDir = parentDir;
23
+ }
24
+
25
+ return null;
26
+ }
27
+
28
+ try {
29
+ const configPath = findConfigFile();
30
+ if (!configPath) {
31
+ console.error('Error: Could not find l10nmonster.config.mjs in current directory or any parent directory.');
32
+ console.error('Please ensure the config file exists in your project root or current working directory.');
33
+ process.exit(1);
34
+ }
35
+
36
+ const config = await import(configPath);
37
+ await runMonsterCLI(config.default);
38
+ } catch (error) {
39
+ if (error.code === 'ERR_MODULE_NOT_FOUND') {
40
+ console.error('Error: Could not load l10nmonster.config.mjs - the file may have syntax errors or missing dependencies.');
41
+ console.error('Details:', error.message);
42
+ } else if (error.code === 'ENOENT') {
43
+ console.error('Error: Config file was found but could not be accessed. Please check file permissions.');
44
+ console.error('Details:', error.message);
45
+ } else {
46
+ console.error('Error running l10nmonster CLI:', error.message);
47
+ }
48
+ process.exit(1);
49
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@l10nmonster/cli",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0-alpha.3",
4
4
  "description": "Continuous localization for the rest of us",
5
5
  "bin": {
6
6
  "l10n": "l10n.mjs"
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/l10nmonster/l10nmonster#readme",
30
30
  "engines": {
31
- "node": ">=20"
31
+ "node": ">=22.11.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "commander": "^14",