@mono-labs/cli 0.0.34 → 0.0.36

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.
@@ -4,11 +4,10 @@ import { program } from '../../app.js'
4
4
  import { generateEnvValues } from '../../app.js'
5
5
  import { STAGING_URL } from '../../config.js'
6
6
  import { getHasteConfig, getHasteFiles, getRootDirectory, getRootJson } from '../loadFromRoot.js'
7
- import { config } from 'process'
8
7
 
9
8
  console.log('getRootDirectory', getRootDirectory())
10
9
  console.log('rootJson', getRootJson())
11
- const files = getHasteConfig()
10
+ const {files, config} = getHasteConfig()
12
11
 
13
12
  console.log('Haste files', files)
14
13
 
@@ -24,15 +24,26 @@ export function getHasteFiles() {
24
24
  return files.map((f) => path.join(dir, f))
25
25
  }
26
26
 
27
+ const workspaceMap = {
28
+ "web": "next-app",
29
+ "app": "expo-app"
30
+ }
27
31
  export function getHasteConfig() {
28
32
  const objHaste = getHasteFiles()
29
- const hasteConfig = {}
33
+ const hasteFileConfig = {}
30
34
  for (const file of objHaste) {
31
35
  const fileName = path.basename(file).replace('.json', '')
36
+ if(fileName === 'config') {
37
+ continue
38
+ } else {
32
39
  const raw = fs.readFileSync(file, 'utf-8')
33
40
  console.log('file content', file, raw)
34
41
  const data = JSON.parse(raw)
35
- hasteConfig[fileName] = data
42
+ hasteFileConfig[fileName] = data
43
+ }
36
44
  }
37
- return hasteConfig
45
+
46
+ return {files:hasteFileConfig, config: {
47
+ workspace: workspaceMap
48
+ }}
38
49
  }
package/lib/index.js CHANGED
@@ -14,22 +14,25 @@ import './commands/seed/index.js'
14
14
  import './commands/submit/index.js'
15
15
  import './commands/update/index.js'
16
16
  import './commands/build-process/index.js'
17
+ import { getHasteConfig} from '../loadFromRoot.js'
18
+ const workspaceMap = {
19
+ "web": "next-app",
20
+ "app": "expo-app"
21
+ }
17
22
 
18
23
 
24
+ const {config} = getHasteConfig()
25
+
26
+
27
+ const workspacemap = config.workspace || {}
28
+
19
29
  program.on('command:*', (operands) => {
20
- console.log('Received unknown command event');
21
- console.log('Operands:', operands);
22
30
  const [cmd] = operands; // e.g. "destroy3"
23
- console.log('Command:', cmd);
24
31
  const raw = program.rawArgs.slice(2); // after `node script.js`
25
- console.log('Raw args:', raw);
26
32
  const i = raw.indexOf(cmd);
27
- console.log('Index of command in raw args:', i);
28
33
  const tokens = i >= 0 ? raw.slice(i) : operands;
29
- console.log('Tokens:', tokens);
30
34
 
31
- // tokens = ["destroy3", "--test", "--lot", "test"]
32
- const workspace = tokens[0];
35
+ const workspace = workspacemap[tokens[0]] || tokens[0];
33
36
  let rest = tokens.slice(1);
34
37
  console.log('Workspace:', workspace);
35
38
  console.log('Rest:', rest);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/cli",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "A CLI tool for building and deploying projects",
5
5
  "type": "module",
6
6
  "main": "index.js",