@mono-labs/cli 0.0.145 → 0.0.147
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.
|
@@ -22,28 +22,25 @@ export function hasData(key) {
|
|
|
22
22
|
|
|
23
23
|
export function replaceTokens(str, env) {
|
|
24
24
|
if (typeof str !== 'string') return str;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
if (hasData(k)) {
|
|
31
|
-
const val = getData(k);
|
|
32
|
-
return String(val);
|
|
25
|
+
|
|
26
|
+
return str.replace(/\$\{([^}]+)\}|\$([A-Z0-9_]+)/g, (m, k1, k2) => {
|
|
27
|
+
const k = k1 || k2;
|
|
28
|
+
|
|
29
|
+
// existing data layer takes priority (guarded in case not defined)
|
|
30
|
+
if (typeof hasData === 'function' && hasData(k)) {
|
|
31
|
+
const val = typeof getData === 'function' ? getData(k) : undefined;
|
|
32
|
+
return val == null ? '' : String(val);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// environment variables
|
|
36
36
|
if (env && Object.prototype.hasOwnProperty.call(env, k)) {
|
|
37
37
|
const val = env[k];
|
|
38
|
-
return
|
|
38
|
+
return val == null ? '' : String(val);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
//
|
|
41
|
+
// fallback
|
|
42
42
|
return '';
|
|
43
43
|
});
|
|
44
|
-
console.log('rVal:', rVal);
|
|
45
|
-
|
|
46
|
-
return rVal;
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
export default dataLayer;
|
|
@@ -22,7 +22,6 @@ export function runForeground(cmd, envObj = {}, options = {}) {
|
|
|
22
22
|
let lastLine = '';
|
|
23
23
|
let buffer = '';
|
|
24
24
|
|
|
25
|
-
console.log(`→ Running env values: ${JSON.stringify(newEnv, null, 2)}`);
|
|
26
25
|
const child = spawn(newCmd, {
|
|
27
26
|
shell: true,
|
|
28
27
|
env: { ...newEnv, PATH },
|