@mono-labs/cli 0.0.19 → 0.0.21
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 +16 -1
- package/package.json +1 -1
package/lib/app.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
2
|
|
|
3
3
|
import { STAGING_URL } from './config.js'
|
|
4
|
-
import fs from 'fs'
|
|
5
4
|
import { join } from 'node:path';
|
|
6
5
|
const packageJSON = JSON.parse(fs.readFileSync(join('./', 'package.json'), 'utf8'));
|
|
7
6
|
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { dirname, join } from 'node:path';
|
|
10
|
+
|
|
11
|
+
// path to this file's folder inside node_modules
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
14
|
+
|
|
15
|
+
// package.json sitting next to this file (or one folder up as needed)
|
|
16
|
+
const pkgPath = join(__dirname, 'package.json'); // same folder
|
|
17
|
+
// const pkgPath = join(__dirname, '..', 'package.json'); // parent folder
|
|
18
|
+
|
|
19
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
20
|
+
|
|
8
21
|
const version = '0.0.1'
|
|
9
22
|
export const program = new Command()
|
|
10
23
|
|
|
@@ -19,6 +32,8 @@ const getBinFromPackageJSON = () => {
|
|
|
19
32
|
|
|
20
33
|
console.log('binfromjson', getBinFromPackageJSON());
|
|
21
34
|
|
|
35
|
+
console.log('pkg', pkg);
|
|
36
|
+
|
|
22
37
|
const programName = getBinFromPackageJSON();
|
|
23
38
|
console.log('description', packageJSON.description);
|
|
24
39
|
|