@mono-labs/cli 0.0.85 → 0.0.86
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { runForeground } from './runners/runForeground.js';
|
|
2
2
|
import { runBackground } from './runners/runBackground.js';
|
|
3
3
|
import { killAllBackground } from './runners/processManager.js';
|
|
4
|
+
import { getHasteConfig } from '../loadFromRoot.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Orchestrate execution of a single haste command definition.
|
|
@@ -10,12 +11,25 @@ import { killAllBackground } from './runners/processManager.js';
|
|
|
10
11
|
* Environment selection based on --stage flag and injection of AWS_PROFILE.
|
|
11
12
|
*/
|
|
12
13
|
export async function runHasteCommand(configObject, options = {}) {
|
|
14
|
+
const { config } = getHasteConfig();
|
|
13
15
|
console.log('runHasteCommand options:', options);
|
|
14
16
|
const devConfig = configObject.environments?.dev ?? {};
|
|
15
17
|
const stageConfig = configObject.environments?.stage ?? {};
|
|
16
18
|
const awsProfile = process.env.CDK_DEPLOY_PROFILE || 'default';
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
+
const envObjBase = options.stage ? { ...stageConfig } : { ...devConfig };
|
|
20
|
+
envObjBase.AWS_PROFILE = awsProfile;
|
|
21
|
+
|
|
22
|
+
const envKeys = Object.keys(process.env).filter((k) => k.startsWith('MONO_'));
|
|
23
|
+
const envMapList = config.envMap ?? ['FAILURE'];
|
|
24
|
+
let envMapVals = {};
|
|
25
|
+
|
|
26
|
+
envKeys.map((k) => {
|
|
27
|
+
envMapList.map((item) => {
|
|
28
|
+
envMapVals[k.replace('MONO', item)] = process.env[k];
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const envObj = { ...envObjBase, ...envMapVals };
|
|
19
33
|
|
|
20
34
|
const preactions = configObject.preactions ?? [];
|
|
21
35
|
const actions = configObject.actions ?? [];
|