@mono-labs/cli 0.0.37 → 0.0.38
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/commands/loadFromRoot.js +41 -33
- package/lib/index.js +0 -5
- package/package.json +2 -1
|
@@ -1,49 +1,57 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import path from 'path'
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
3
|
|
|
4
4
|
export function getRootDirectory() {
|
|
5
|
-
|
|
5
|
+
return path.join(process.cwd(), 'myfile.json');
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export function getRootJson() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const jsonPath = path.join(process.cwd(), 'package.json'); // cwd + file
|
|
10
|
+
const raw = fs.readFileSync(jsonPath, 'utf-8');
|
|
11
|
+
const data = JSON.parse(raw);
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
return data;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function getHasteFiles() {
|
|
17
|
-
|
|
17
|
+
const dir = path.join(process.cwd(), '.mono');
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (!fs.existsSync(dir)) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const files = fs.readdirSync(dir); // names only
|
|
24
|
+
return files.map((f) => path.join(dir, f));
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const workspaceMap = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
28
|
+
web: 'next-app',
|
|
29
|
+
app: 'expo-app',
|
|
30
|
+
};
|
|
31
31
|
export function getHasteConfig() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
const objHaste = getHasteFiles();
|
|
33
|
+
const hasteFileConfig = {};
|
|
34
|
+
let configObject = {};
|
|
35
|
+
for (const file of objHaste) {
|
|
36
|
+
const fileName = path.basename(file).replace('.json', '');
|
|
37
|
+
if (fileName === 'config') {
|
|
38
|
+
const raw = fs.readFileSync(file, 'utf-8');
|
|
39
|
+
console.log('file content', file, raw);
|
|
40
|
+
const data = JSON.parse(raw);
|
|
41
|
+
if (data) configObject = data;
|
|
42
|
+
} else {
|
|
43
|
+
const raw = fs.readFileSync(file, 'utf-8');
|
|
44
|
+
console.log('file content', file, raw);
|
|
45
|
+
const data = JSON.parse(raw);
|
|
46
|
+
hasteFileConfig[fileName] = data;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
files: hasteFileConfig,
|
|
52
|
+
// config: {
|
|
53
|
+
// workspace: workspaceMap,
|
|
54
|
+
// },
|
|
55
|
+
config: configObject,
|
|
56
|
+
};
|
|
49
57
|
}
|
package/lib/index.js
CHANGED
|
@@ -15,11 +15,6 @@ import './commands/submit/index.js'
|
|
|
15
15
|
import './commands/update/index.js'
|
|
16
16
|
import './commands/build-process/index.js'
|
|
17
17
|
import { getHasteConfig} from './commands/loadFromRoot.js'
|
|
18
|
-
const workspaceMap = {
|
|
19
|
-
"web": "next-app",
|
|
20
|
-
"app": "expo-app"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
18
|
|
|
24
19
|
const {config} = getHasteConfig()
|
|
25
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mono-labs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"description": "A CLI tool for building and deploying projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"cross-spawn": "^7.0.6",
|
|
36
36
|
"dotenv": "^17.2.0",
|
|
37
37
|
"inquirer": "^12.8.2",
|
|
38
|
+
"prettier": "^3.6.2",
|
|
38
39
|
"tree-kill": "^1.2.2"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|