@mono-labs/cli 0.0.50 → 0.0.51
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 =
|
|
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
|
-
|
|
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(
|
|
41
|
+
execSync(finalCommand, { stdio: 'inherit', shell: true });
|
|
38
42
|
});
|
|
39
43
|
}
|
|
40
44
|
}
|