@mono-labs/cli 0.0.25 → 0.0.27
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/lib/app.js +2 -10
- package/lib/index.js +9 -0
- package/package.json +1 -1
package/lib/app.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
2
|
|
|
3
3
|
import { STAGING_URL } from './config.js'
|
|
4
|
-
const packageJSON = JSON.parse(fs.readFileSync(join('./', 'package.json'), 'utf8'));
|
|
5
4
|
|
|
6
5
|
import fs from 'node:fs';
|
|
7
6
|
import { fileURLToPath } from 'node:url';
|
|
8
7
|
import { dirname, join } from 'node:path';
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
|
|
11
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
11
|
const __dirname = dirname(__filename);
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
const pkgPath = join(__dirname, '../', 'package.json'); // same folder
|
|
16
|
-
// const pkgPath = join(__dirname, '..', 'package.json'); // parent folder
|
|
17
|
-
|
|
13
|
+
const pkgPath = join(__dirname, '../', 'package.json');
|
|
18
14
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
19
15
|
|
|
20
16
|
const version = pkg.version || '0.0.1'
|
|
@@ -29,10 +25,6 @@ const getBinFromPackageJSON = () => {
|
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
|
|
32
|
-
console.log('binfromjson', getBinFromPackageJSON());
|
|
33
|
-
|
|
34
|
-
console.log('pkg', pkg);
|
|
35
|
-
|
|
36
28
|
const programName = getBinFromPackageJSON();
|
|
37
29
|
console.log('description', pkg.description);
|
|
38
30
|
|
package/lib/index.js
CHANGED
|
@@ -14,4 +14,13 @@ import './commands/submit/index.js'
|
|
|
14
14
|
import './commands/update/index.js'
|
|
15
15
|
import './commands/build-process/index.js'
|
|
16
16
|
|
|
17
|
+
|
|
18
|
+
program.on('command:*', (operands) => {
|
|
19
|
+
const [cmd, ...args] = operands;
|
|
20
|
+
// your fallback logic
|
|
21
|
+
console.error(`Unknown command: ${cmd}`);
|
|
22
|
+
// e.g. route to a generic handler:
|
|
23
|
+
// runFallback(cmd, args)
|
|
24
|
+
process.exitCode = 1; // don’t exit immediately if you prefer
|
|
25
|
+
});
|
|
17
26
|
program.parse()
|