@mono-labs/cli 0.0.86 → 0.0.87

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.
@@ -5,7 +5,11 @@ import { getRootJson, getHasteConfig } from '../loadFromRoot.js';
5
5
 
6
6
  const WorkSpaceDirectory = '${dir}';
7
7
 
8
- export function executeCommandsIfWorkspaceAction(action, commands = []) {
8
+ export function executeCommandsIfWorkspaceAction(
9
+ action,
10
+ commands = [],
11
+ fullEnv
12
+ ) {
9
13
  console.log('commands', commands);
10
14
  const { config } = getHasteConfig();
11
15
  const workspacemap = config.workspace?.packageMaps || {};
@@ -45,8 +49,13 @@ export function executeCommandsIfWorkspaceAction(action, commands = []) {
45
49
  commands.forEach((cmd) => {
46
50
  const finalCommand = cmd.replace(WorkSpaceDirectory, workingDirectory);
47
51
  console.log(`Executing command in workspace: ${finalCommand}`);
52
+ console.log('fullEnv:', fullEnv);
48
53
  // Here you would add the logic to execute the command
49
- execSync(finalCommand, { stdio: 'inherit', shell: true });
54
+ execSync(finalCommand, {
55
+ stdio: 'inherit',
56
+ shell: true,
57
+ env: { ...fullEnv },
58
+ });
50
59
  });
51
60
  }
52
61
  }
package/lib/index.js CHANGED
@@ -20,6 +20,7 @@ const { config } = getHasteConfig();
20
20
 
21
21
  const workspacemap = config.workspace?.packageMaps || {};
22
22
  const preactions = config.workspace?.preactions || [];
23
+ const envMapList = config.envMap ?? ['FAILURE'];
23
24
 
24
25
  program.on('command:*', (operands) => {
25
26
  console.log('operands command:', operands.join(' '));
@@ -33,13 +34,23 @@ program.on('command:*', (operands) => {
33
34
  console.log('Workspace:', workspace);
34
35
  console.log('Rest:', rest);
35
36
 
37
+ const envKeys = Object.keys(process.env).filter((k) => k.startsWith('MONO_'));
38
+
39
+ let envObj = {};
40
+
41
+ envKeys.map((k) => {
42
+ envMapList.map((item) => {
43
+ envObj[k.replace('MONO', item)] = process.env[k];
44
+ });
45
+ });
46
+
36
47
  // If the “rest” is empty or starts with flags, insert a default script
37
48
 
38
49
  const args = ['workspace', workspace, ...rest];
39
50
  console.log('Final args for yarn:', args);
40
51
 
41
52
  console.error(`Unknown command. Falling back to: yarn ${args.join(' ')}`);
42
- executeCommandsIfWorkspaceAction(args, preactions);
53
+ executeCommandsIfWorkspaceAction(args, preactions, envObj);
43
54
  console.log('yarn', args, {
44
55
  stdio: 'inherit',
45
56
  shell: process.platform === 'win32',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/cli",
3
- "version": "0.0.86",
3
+ "version": "0.0.87",
4
4
  "description": "A CLI tool for building and deploying projects",
5
5
  "type": "module",
6
6
  "main": "index.js",