@mono-labs/cli 0.0.50 → 0.0.52

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.
@@ -3,6 +3,8 @@ import { getRootJson } from '../loadFromRoot.js';
3
3
 
4
4
  //Run Action List before all script actions
5
5
 
6
+ const WorkSpaceDirectory = '${dir}';
7
+
6
8
  export function executeCommandsIfWorkspaceAction(action, commands = []) {
7
9
  console.log('we here');
8
10
  const result = execSync('yarn workspaces list --json', { encoding: 'utf8' })
@@ -25,16 +27,18 @@ export function executeCommandsIfWorkspaceAction(action, commands = []) {
25
27
 
26
28
  console.log('workspacesList', workspacesList);
27
29
 
28
- const filteredResult = result.filter((obj) => obj.name === actualAction);
30
+ const filteredResult =
31
+ result.filter((obj) => obj.name === actualAction)[0] || {};
29
32
  console.log('filteredResult', filteredResult);
30
- const workingDirectory = './';
33
+ const workingDirectory = filteredResult.location || '';
31
34
  // Check if the action is a workspace action
32
35
  if (action) {
33
36
  // Execute each command in the context of the workspace
34
37
  commands.forEach((cmd) => {
35
- console.log(`Executing command in workspace: ${cmd}`);
38
+ const finalCommand = cmd.replace(WorkSpaceDirectory, workingDirectory);
39
+ console.log(`Executing command in workspace: ${finalCommand}`);
36
40
  // Here you would add the logic to execute the command
37
- execSync(cmd, { stdio: 'inherit', shell: true });
41
+ execSync(finalCommand, { stdio: 'inherit', shell: true });
38
42
  });
39
43
  }
40
44
  }
package/lib/index.js CHANGED
@@ -43,13 +43,13 @@ program.on('command:*', (operands) => {
43
43
  stdio: 'inherit',
44
44
  shell: process.platform === 'win32',
45
45
  });
46
- // const child = spawn('yarn', args, {
47
- // stdio: 'inherit',
48
- // shell: process.platform === 'win32',
49
- // });
50
- // child.on('exit', (code) => {
51
- // console.log('Child process exited with code:', code);
52
- // process.exitCode = code ?? 1;
53
- // });
46
+ const child = spawn('yarn', args, {
47
+ stdio: 'inherit',
48
+ shell: process.platform === 'win32',
49
+ });
50
+ child.on('exit', (code) => {
51
+ console.log('Child process exited with code:', code);
52
+ process.exitCode = code ?? 1;
53
+ });
54
54
  });
55
55
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/cli",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "description": "A CLI tool for building and deploying projects",
5
5
  "type": "module",
6
6
  "main": "index.js",