mythix-cli 2.0.0 → 2.0.1

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 (3) hide show
  1. package/.nvmrc +1 -0
  2. package/bin/runner.mjs +20 -7
  3. package/package.json +9 -1
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 24.13.0
package/bin/runner.mjs CHANGED
@@ -429,22 +429,35 @@ function loadJSON(filePath, defaultValue) {
429
429
 
430
430
  let rootOptions;
431
431
  let mythixPath;
432
- let mythixCLIPath;
432
+ let mythixIndexPath;
433
433
  let mythixCLI;
434
434
  let config;
435
435
 
436
436
  try {
437
- rootOptions = { help, showHelp: customShowHelp, helpArgPattern: null };
438
- mythixCLIPath = Path.resolve(require.resolve('mythix', { paths: [ process.env.PWD, Path.resolve(process.env.PWD, 'node_modules') ] }));
439
- mythixPath = Path.dirname(mythixCLIPath);
440
- mythixCLI = (await import(mythixCLIPath)).CLI;
441
- config = await mythixCLI.loadMythixConfig(argOptions.config);
437
+ rootOptions = { help, showHelp: customShowHelp, helpArgPattern: null };
438
+ mythixIndexPath = Path.resolve(require.resolve('mythix', { paths: [ process.env.PWD, Path.resolve(process.env.PWD, 'node_modules') ] }));
439
+ mythixPath = Path.dirname(mythixIndexPath);
440
+ mythixCLI = (await import(mythixIndexPath)).CLI;
441
+ config = await mythixCLI.loadMythixConfig(argOptions.config);
442
442
  } catch (error) {
443
- console.error('THERE WAS AN ERROR: ', error);
444
443
  customShowHelp(help);
444
+
445
+ if (error.code !== 'MODULE_NOT_FOUND') {
446
+ console.error('\nError:', error.message || error);
447
+ } else {
448
+ console.log('\nNote: Run from within a mythix project to see additional commands.');
449
+ }
450
+
445
451
  process.exit(1);
446
452
  }
447
453
 
454
+ if (!config.applicationPath) {
455
+ customShowHelp(help);
456
+ console.error('\nNo mythix application found. Run this command from within a mythix project directory,');
457
+ console.error('or use "mythix-cli create <app-name>" to create a new project.');
458
+ return process.exit(1);
459
+ }
460
+
448
461
  let Application = await config.getApplicationClass(config);
449
462
  if (typeof Application !== 'function')
450
463
  throw new Error('Expected to find an Application class from "getApplicationClass", but none was returned.');
package/package.json CHANGED
@@ -3,7 +3,10 @@
3
3
  "mythix-cli": "./bin/mythix-cli.mjs"
4
4
  },
5
5
  "name": "mythix-cli",
6
- "version": "2.0.0",
6
+ "version": "2.0.1",
7
+ "engines": {
8
+ "node": ">=18.0.0"
9
+ },
7
10
  "description": "Mythix CLI utility",
8
11
  "main": "src/index.mjs",
9
12
  "type": "module",
@@ -30,6 +33,11 @@
30
33
  "peerDependencies": {
31
34
  "mythix": "^4.0.1"
32
35
  },
36
+ "peerDependenciesMeta": {
37
+ "mythix": {
38
+ "optional": true
39
+ }
40
+ },
33
41
  "dependencies": {
34
42
  "cmded": "^1.2.5",
35
43
  "nife": "^1.12.1"