@getmonoceros/workbench 1.14.0 → 1.14.1
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.
- package/dist/bin.js +34 -47
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -739,25 +739,20 @@ function resolveGitUserFields(user, vars) {
|
|
|
739
739
|
};
|
|
740
740
|
return { name: resolve(user.name), email: resolve(user.email) };
|
|
741
741
|
}
|
|
742
|
-
function
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
const
|
|
747
|
-
for (const [key, value] of Object.entries(options)) {
|
|
742
|
+
function interpolateFeatureOptions(features, vars) {
|
|
743
|
+
return features.map((f) => {
|
|
744
|
+
if (!f.options) return f;
|
|
745
|
+
const opts = {};
|
|
746
|
+
for (const [key, value] of Object.entries(f.options)) {
|
|
748
747
|
if (typeof value !== "string") {
|
|
749
|
-
|
|
748
|
+
opts[key] = value;
|
|
750
749
|
continue;
|
|
751
750
|
}
|
|
752
751
|
const r = interpolate(value, vars);
|
|
753
|
-
|
|
754
|
-
missing.push({ location: `features.${ref}.${key}`, name });
|
|
755
|
-
}
|
|
756
|
-
next[key] = r.value;
|
|
752
|
+
opts[key] = r.missing.length > 0 ? "" : r.value.trim();
|
|
757
753
|
}
|
|
758
|
-
|
|
759
|
-
}
|
|
760
|
-
return { features: out, missing };
|
|
754
|
+
return { ...f, options: opts };
|
|
755
|
+
});
|
|
761
756
|
}
|
|
762
757
|
function buildEnvStub(name) {
|
|
763
758
|
return `# Secrets and values for \${VAR} references in ${name}.yml.
|
|
@@ -3020,13 +3015,17 @@ function addInstallUrlToDoc(doc, url) {
|
|
|
3020
3015
|
function addFeatureToDoc(doc, ref, options = {}, displayName) {
|
|
3021
3016
|
const seq = ensureSeq(doc, "features");
|
|
3022
3017
|
const label = displayName ?? ref;
|
|
3018
|
+
const summary = loadFeatureManifestSummary(ref);
|
|
3019
|
+
const hints = featureOptionHints(summary, ref, Object.keys(options));
|
|
3020
|
+
const mergedOptions = { ...options };
|
|
3021
|
+
for (const h of hints) mergedOptions[h.key] = h.placeholder;
|
|
3023
3022
|
for (const item of seq.items) {
|
|
3024
3023
|
if (!isMap2(item)) continue;
|
|
3025
3024
|
const itemRef = item.get("ref");
|
|
3026
3025
|
if (itemRef !== ref) continue;
|
|
3027
3026
|
const itemJs = item.toJS(doc);
|
|
3028
3027
|
const existingJs = itemJs.options ?? {};
|
|
3029
|
-
if (JSON.stringify(existingJs) === JSON.stringify(
|
|
3028
|
+
if (JSON.stringify(existingJs) === JSON.stringify(mergedOptions)) {
|
|
3030
3029
|
return false;
|
|
3031
3030
|
}
|
|
3032
3031
|
throw new Error(
|
|
@@ -3035,10 +3034,9 @@ function addFeatureToDoc(doc, ref, options = {}, displayName) {
|
|
|
3035
3034
|
}
|
|
3036
3035
|
const entry2 = new YAMLMap2();
|
|
3037
3036
|
entry2.set("ref", ref);
|
|
3038
|
-
if (Object.keys(
|
|
3039
|
-
entry2.set("options",
|
|
3037
|
+
if (Object.keys(mergedOptions).length > 0) {
|
|
3038
|
+
entry2.set("options", mergedOptions);
|
|
3040
3039
|
}
|
|
3041
|
-
const summary = loadFeatureManifestSummary(ref);
|
|
3042
3040
|
const headerBefore = buildFeatureHeaderCommentBefore(
|
|
3043
3041
|
summary,
|
|
3044
3042
|
FEATURE_HEADER_WIDTH
|
|
@@ -3047,12 +3045,6 @@ function addFeatureToDoc(doc, ref, options = {}, displayName) {
|
|
|
3047
3045
|
entry2.commentBefore = headerBefore;
|
|
3048
3046
|
entry2.spaceBefore = true;
|
|
3049
3047
|
}
|
|
3050
|
-
const hints = featureOptionHints(summary, ref, Object.keys(options));
|
|
3051
|
-
if (hints.length > 0) {
|
|
3052
|
-
const commentLines = [" options:"];
|
|
3053
|
-
for (const h of hints) commentLines.push(` ${h.key}: ${h.placeholder}`);
|
|
3054
|
-
entry2.comment = commentLines.join("\n");
|
|
3055
|
-
}
|
|
3056
3048
|
seq.add(entry2);
|
|
3057
3049
|
return true;
|
|
3058
3050
|
}
|
|
@@ -5176,26 +5168,26 @@ ${sectionLine(label)}
|
|
|
5176
5168
|
const parsed = await readConfig(ymlPath);
|
|
5177
5169
|
const globalConfig = await readMonocerosConfig({ monocerosHome: home });
|
|
5178
5170
|
warnOnDeprecatedFeatureRefs(parsed.config.features, globalConfig, logger);
|
|
5171
|
+
const envPath = containerEnvPath(opts.name, home);
|
|
5172
|
+
await ensureEnvGitignored(containerConfigsDir(home));
|
|
5173
|
+
const envVars = readEnvFile(envPath);
|
|
5174
|
+
const resolvedFeatures = interpolateFeatureOptions(
|
|
5175
|
+
parsed.config.features,
|
|
5176
|
+
envVars
|
|
5177
|
+
);
|
|
5179
5178
|
const createOpts = normalizeOptions(
|
|
5180
5179
|
solutionConfigToCreateOptions(
|
|
5181
|
-
parsed.config,
|
|
5180
|
+
{ ...parsed.config, features: resolvedFeatures },
|
|
5182
5181
|
globalConfig?.defaults?.features ?? {}
|
|
5183
5182
|
)
|
|
5184
5183
|
);
|
|
5185
|
-
const envPath = containerEnvPath(opts.name, home);
|
|
5186
|
-
await ensureEnvGitignored(containerConfigsDir(home));
|
|
5187
|
-
const envVars = readEnvFile(envPath);
|
|
5188
5184
|
const interpServices = interpolateServices(createOpts.services, envVars);
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
const missingVars = [...interpServices.missing, ...interpFeatures.missing];
|
|
5194
|
-
if (missingVars.length > 0) {
|
|
5195
|
-
throw new Error(formatMissingVarsError(missingVars, prettyPath(envPath)));
|
|
5185
|
+
if (interpServices.missing.length > 0) {
|
|
5186
|
+
throw new Error(
|
|
5187
|
+
formatMissingVarsError(interpServices.missing, prettyPath(envPath))
|
|
5188
|
+
);
|
|
5196
5189
|
}
|
|
5197
5190
|
createOpts.services = interpServices.services;
|
|
5198
|
-
if (createOpts.features) createOpts.features = interpFeatures.features;
|
|
5199
5191
|
const gitUserErrors = [];
|
|
5200
5192
|
let containerGitOverride;
|
|
5201
5193
|
if (parsed.config.git?.user) {
|
|
@@ -5492,7 +5484,7 @@ async function persistPromptedIdentity(prompted, ymlPath, home, logger) {
|
|
|
5492
5484
|
}
|
|
5493
5485
|
|
|
5494
5486
|
// src/version.ts
|
|
5495
|
-
var CLI_VERSION = true ? "1.14.
|
|
5487
|
+
var CLI_VERSION = true ? "1.14.1" : "dev";
|
|
5496
5488
|
|
|
5497
5489
|
// src/commands/_dispatch.ts
|
|
5498
5490
|
import { consola as consola12 } from "consola";
|
|
@@ -6374,17 +6366,12 @@ function renderFeatureBlock(out, feature, summary, commented) {
|
|
|
6374
6366
|
}
|
|
6375
6367
|
return;
|
|
6376
6368
|
}
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
out.push(` ${key}: ${renderScalarValue(value)}`);
|
|
6381
|
-
}
|
|
6369
|
+
out.push(` options:`);
|
|
6370
|
+
for (const [key, value] of activeKeys) {
|
|
6371
|
+
out.push(` ${key}: ${renderScalarValue(value)}`);
|
|
6382
6372
|
}
|
|
6383
|
-
|
|
6384
|
-
out.push(`
|
|
6385
|
-
for (const hint of hints) {
|
|
6386
|
-
out.push(` # ${hint.key}: ${hint.placeholder}`);
|
|
6387
|
-
}
|
|
6373
|
+
for (const hint of hints) {
|
|
6374
|
+
out.push(` ${hint.key}: ${hint.placeholder}`);
|
|
6388
6375
|
}
|
|
6389
6376
|
}
|
|
6390
6377
|
function pushHeader(out, header, name) {
|