@getmonoceros/workbench 1.3.2 → 1.4.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 +51 -15
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/templates/monoceros-config.sample.yml +43 -0
package/dist/bin.js
CHANGED
|
@@ -1809,6 +1809,26 @@ function solutionConfigToCreateOptions(config, featureDefaults = {}) {
|
|
|
1809
1809
|
return result;
|
|
1810
1810
|
}
|
|
1811
1811
|
|
|
1812
|
+
// src/util/format.ts
|
|
1813
|
+
var ESC = "\x1B[";
|
|
1814
|
+
var ANSI_BOLD2 = `${ESC}1m`;
|
|
1815
|
+
var ANSI_UNDERLINE2 = `${ESC}4m`;
|
|
1816
|
+
var ANSI_CYAN2 = `${ESC}36m`;
|
|
1817
|
+
var ANSI_GREY2 = `${ESC}90m`;
|
|
1818
|
+
var ANSI_RESET2 = `${ESC}0m`;
|
|
1819
|
+
function isTty2() {
|
|
1820
|
+
return process.stderr.isTTY ?? false;
|
|
1821
|
+
}
|
|
1822
|
+
function wrap(s, ...codes) {
|
|
1823
|
+
if (!isTty2()) return s;
|
|
1824
|
+
return codes.join("") + s + ANSI_RESET2;
|
|
1825
|
+
}
|
|
1826
|
+
var cyan2 = (s) => wrap(s, ANSI_CYAN2);
|
|
1827
|
+
var dim = (s) => wrap(s, ANSI_GREY2);
|
|
1828
|
+
function sectionLine(label) {
|
|
1829
|
+
return wrap(`\u25B8 ${label}`, ANSI_BOLD2, ANSI_UNDERLINE2);
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1812
1832
|
// src/devcontainer/compose.ts
|
|
1813
1833
|
import { spawn as spawn2 } from "child_process";
|
|
1814
1834
|
import { existsSync as existsSync3 } from "fs";
|
|
@@ -2272,8 +2292,15 @@ async function runApply(opts) {
|
|
|
2272
2292
|
const logger = opts.logger ?? {
|
|
2273
2293
|
info: (msg) => consola10.info(msg),
|
|
2274
2294
|
success: (msg) => consola10.success(msg),
|
|
2275
|
-
warn: (msg) => consola10.warn(msg)
|
|
2295
|
+
warn: (msg) => consola10.warn(msg),
|
|
2296
|
+
// Default section renderer: empty line, bold-underlined "▸ Label",
|
|
2297
|
+
// empty line. Mirrors install.sh's section visuals.
|
|
2298
|
+
section: (label) => process.stderr.write(`
|
|
2299
|
+
${sectionLine(label)}
|
|
2300
|
+
|
|
2301
|
+
`)
|
|
2276
2302
|
};
|
|
2303
|
+
const section = (label) => logger.section?.(label);
|
|
2277
2304
|
if (!REGEX.solutionName.test(opts.name)) {
|
|
2278
2305
|
throw new Error(
|
|
2279
2306
|
`Invalid config name: ${JSON.stringify(opts.name)}. Use letters, digits, '.', '_' or '-'.`
|
|
@@ -2287,6 +2314,7 @@ async function runApply(opts) {
|
|
|
2287
2314
|
}
|
|
2288
2315
|
const targetDir = containerDir(opts.name, home);
|
|
2289
2316
|
await assertSafeTargetDir(targetDir, opts.name);
|
|
2317
|
+
section("Configuration");
|
|
2290
2318
|
const parsed = await readConfig(ymlPath);
|
|
2291
2319
|
const globalConfig = await readMonocerosConfig({ monocerosHome: home });
|
|
2292
2320
|
warnOnDeprecatedFeatureRefs(parsed.config.features, globalConfig, logger);
|
|
@@ -2297,16 +2325,7 @@ async function runApply(opts) {
|
|
|
2297
2325
|
)
|
|
2298
2326
|
);
|
|
2299
2327
|
validateOptions(createOpts);
|
|
2300
|
-
|
|
2301
|
-
await writeScaffold(createOpts, targetDir);
|
|
2302
|
-
await writeStateFile(
|
|
2303
|
-
targetDir,
|
|
2304
|
-
buildStateFile({
|
|
2305
|
-
origin: opts.name,
|
|
2306
|
-
cliVersion: opts.cliVersion,
|
|
2307
|
-
...opts.now ? { now: opts.now } : {}
|
|
2308
|
-
})
|
|
2309
|
-
);
|
|
2328
|
+
logger.success(`yml validated ${dim(`(${prettyPath(ymlPath)})`)}`);
|
|
2310
2329
|
const idLogger = {
|
|
2311
2330
|
info: logger.info,
|
|
2312
2331
|
warn: logger.warn ?? logger.info
|
|
@@ -2324,10 +2343,23 @@ async function runApply(opts) {
|
|
|
2324
2343
|
logger: idLogger
|
|
2325
2344
|
});
|
|
2326
2345
|
}
|
|
2327
|
-
|
|
2328
|
-
|
|
2346
|
+
section("Scaffold");
|
|
2347
|
+
await fs8.mkdir(targetDir, { recursive: true });
|
|
2348
|
+
await writeScaffold(createOpts, targetDir);
|
|
2349
|
+
await writeStateFile(
|
|
2350
|
+
targetDir,
|
|
2351
|
+
buildStateFile({
|
|
2352
|
+
origin: opts.name,
|
|
2353
|
+
cliVersion: opts.cliVersion,
|
|
2354
|
+
...opts.now ? { now: opts.now } : {}
|
|
2355
|
+
})
|
|
2329
2356
|
);
|
|
2330
|
-
|
|
2357
|
+
logger.success(`materialized into ${prettyPath(targetDir)}`);
|
|
2358
|
+
section("Container");
|
|
2359
|
+
const featureRefs = parsed.config.features.map((f) => f.ref);
|
|
2360
|
+
if (featureRefs.length > 0) {
|
|
2361
|
+
logger.info(`Features: ${featureRefs.map((r) => cyan2(r)).join(", ")}`);
|
|
2362
|
+
}
|
|
2331
2363
|
logger.info(
|
|
2332
2364
|
dim(
|
|
2333
2365
|
'Pulling runtime image and building feature layers. First apply takes ~1\u20132 min (Docker downloads the multi-arch base); subsequent applies are cached and fast. devcontainer-cli may log a "No manifest found" line \u2014 harmless, the pull continues.'
|
|
@@ -2339,6 +2371,10 @@ async function runApply(opts) {
|
|
|
2339
2371
|
...opts.devcontainerSpawn !== void 0 ? { devcontainerSpawn: opts.devcontainerSpawn } : {},
|
|
2340
2372
|
logger
|
|
2341
2373
|
});
|
|
2374
|
+
if (exitCode === 0) {
|
|
2375
|
+
section("Next steps");
|
|
2376
|
+
logger.info(` ${cyan2(`monoceros shell ${opts.name}`)}`);
|
|
2377
|
+
}
|
|
2342
2378
|
return { targetDir, configPath: ymlPath, containerExitCode: exitCode };
|
|
2343
2379
|
}
|
|
2344
2380
|
async function assertSafeTargetDir(targetDir, expectedOrigin) {
|
|
@@ -2382,7 +2418,7 @@ function warnOnDeprecatedFeatureRefs(containerFeatures, globalConfig, logger) {
|
|
|
2382
2418
|
}
|
|
2383
2419
|
|
|
2384
2420
|
// src/version.ts
|
|
2385
|
-
var CLI_VERSION = "1.
|
|
2421
|
+
var CLI_VERSION = "1.4.1";
|
|
2386
2422
|
|
|
2387
2423
|
// src/commands/_dispatch.ts
|
|
2388
2424
|
import { consola as consola11 } from "consola";
|