@mono-labs/cli 0.0.38 → 0.0.39

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.
@@ -24,10 +24,6 @@ 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
- };
31
27
  export function getHasteConfig() {
32
28
  const objHaste = getHasteFiles();
33
29
  const hasteFileConfig = {};
@@ -36,12 +32,10 @@ export function getHasteConfig() {
36
32
  const fileName = path.basename(file).replace('.json', '');
37
33
  if (fileName === 'config') {
38
34
  const raw = fs.readFileSync(file, 'utf-8');
39
- console.log('file content', file, raw);
40
35
  const data = JSON.parse(raw);
41
36
  if (data) configObject = data;
42
37
  } else {
43
38
  const raw = fs.readFileSync(file, 'utf-8');
44
- console.log('file content', file, raw);
45
39
  const data = JSON.parse(raw);
46
40
  hasteFileConfig[fileName] = data;
47
41
  }
package/lib/index.js CHANGED
@@ -1,55 +1,56 @@
1
- import 'dotenv/config'
1
+ import 'dotenv/config';
2
2
  import spawn from 'cross-spawn';
3
3
 
4
- import { program } from './app.js'
5
- import './commands/build/index.js'
6
- import './commands/deploy/index.js'
7
- import './commands/destroy.js'
8
- import './commands/dev/index.js'
9
- import './commands/generate/index.js'
10
- import './commands/init/index.js'
11
- import './commands/prune/index.js'
12
- import './commands/reset.js'
13
- import './commands/seed/index.js'
14
- import './commands/submit/index.js'
15
- import './commands/update/index.js'
16
- import './commands/build-process/index.js'
17
- import { getHasteConfig} from './commands/loadFromRoot.js'
4
+ import { program } from './app.js';
5
+ import './commands/build/index.js';
6
+ import './commands/deploy/index.js';
7
+ import './commands/destroy.js';
8
+ import './commands/dev/index.js';
9
+ import './commands/generate/index.js';
10
+ import './commands/init/index.js';
11
+ import './commands/prune/index.js';
12
+ import './commands/seed/index.js';
13
+ import './commands/submit/index.js';
14
+ import './commands/update/index.js';
15
+ import './commands/build-process/index.js';
16
+ import { getHasteConfig } from './commands/loadFromRoot.js';
18
17
 
19
- const {config} = getHasteConfig()
18
+ const { config } = getHasteConfig();
20
19
 
21
-
22
- const workspacemap = config.workspace || {}
20
+ const workspacemap = config.workspace || {};
23
21
 
24
22
  program.on('command:*', (operands) => {
25
- const [cmd] = operands; // e.g. "destroy3"
26
- const raw = program.rawArgs.slice(2); // after `node script.js`
27
- const i = raw.indexOf(cmd);
28
- const tokens = i >= 0 ? raw.slice(i) : operands;
29
-
30
- const workspace = workspacemap[tokens[0]] || tokens[0];
31
- let rest = tokens.slice(1);
32
- console.log('Workspace:', workspace);
33
- console.log('Rest:', rest);
34
-
35
- // If the “rest” is empty or starts with flags, insert a default script
36
- if (rest.length === 0 || rest[0].startsWith('--')) {
37
- console.log('Rest is empty or starts with flags, inserting DEFAULT_SCRIPT');
38
- // Prefer an explicit script name; if you want to always use `run`, do:
39
- // rest = ['run', DEFAULT_SCRIPT, ...rest];
40
- rest = [ ...rest]; // yarn workspace <ws> dev --flags
41
- console.log('Rest after inserting DEFAULT_SCRIPT:', rest);
42
- }
43
-
44
- const args = ['workspace', workspace, ...rest];
45
- console.log('Final args for yarn:', args);
46
-
47
- console.error(`Unknown command. Falling back to: yarn ${args.join(' ')}`);
48
-
49
- const child = spawn('yarn', args, { stdio: 'inherit', shell: process.platform === 'win32' });
50
- child.on('exit', (code) => {
51
- console.log('Child process exited with code:', code);
52
- process.exitCode = code ?? 1;
53
- });
23
+ const [cmd] = operands; // e.g. "destroy3"
24
+ const raw = program.rawArgs.slice(2); // after `node script.js`
25
+ const i = raw.indexOf(cmd);
26
+ const tokens = i >= 0 ? raw.slice(i) : operands;
27
+
28
+ const workspace = workspacemap[tokens[0]] || tokens[0];
29
+ let rest = tokens.slice(1);
30
+ console.log('Workspace:', workspace);
31
+ console.log('Rest:', rest);
32
+
33
+ // If the “rest” is empty or starts with flags, insert a default script
34
+ if (rest.length === 0 || rest[0].startsWith('--')) {
35
+ console.log('Rest is empty or starts with flags, inserting DEFAULT_SCRIPT');
36
+ // Prefer an explicit script name; if you want to always use `run`, do:
37
+ // rest = ['run', DEFAULT_SCRIPT, ...rest];
38
+ rest = [...rest]; // yarn workspace <ws> dev --flags
39
+ console.log('Rest after inserting DEFAULT_SCRIPT:', rest);
40
+ }
41
+
42
+ const args = ['workspace', workspace, ...rest];
43
+ console.log('Final args for yarn:', args);
44
+
45
+ console.error(`Unknown command. Falling back to: yarn ${args.join(' ')}`);
46
+
47
+ const child = spawn('yarn', args, {
48
+ stdio: 'inherit',
49
+ shell: process.platform === 'win32',
50
+ });
51
+ child.on('exit', (code) => {
52
+ console.log('Child process exited with code:', code);
53
+ process.exitCode = code ?? 1;
54
+ });
54
55
  });
55
- program.parse()
56
+ program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/cli",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "description": "A CLI tool for building and deploying projects",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,31 +0,0 @@
1
- import { spawn } from 'child_process'
2
-
3
- import { program } from '../app.js'
4
-
5
- function createChild(command) {
6
- const child = spawn(command, {
7
- stdio: ['inherit', 'pipe', 'pipe'], // Read from terminal, but capture output
8
- shell: true,
9
- env: {
10
- ...process.env,
11
- },
12
- })
13
-
14
- child.stdout.on('data', (data) => {
15
- process.stdout.write(data) // pipe to main stdout
16
- })
17
-
18
- child.stderr.on('data', (data) => {
19
- process.stderr.write(data) // pipe errors
20
- })
21
- child.on('message', (data) => {
22
- console.log(`Message from child process: ${data}`)
23
- })
24
- }
25
- program
26
- .command('reset')
27
- .description('Execute eas build command')
28
- .option('-s, --soft', 'Pull from live')
29
- .action(async (options) => {
30
- createChild(`git reset ${options.soft ? '--soft' : '--mixed '} HEAD~1`)
31
- })