@solid-stack/builder 1.1.2 → 1.1.3
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 +176 -128
- package/dist/bin.js.map +1 -1
- package/dist/commands/mesh/commands/up/command.d.ts.map +1 -1
- package/dist/commands/service/commands/up/command.d.ts.map +1 -1
- package/dist/commands/service/commands/up/handler.d.ts.map +1 -1
- package/dist/core/RunOptions.d.ts +3 -2
- package/dist/core/RunOptions.d.ts.map +1 -1
- package/dist/core/compileEnvironment.d.ts +3 -1
- package/dist/core/compileEnvironment.d.ts.map +1 -1
- package/dist/core/mesh/MeshRunOptions.d.ts +1 -0
- package/dist/core/mesh/MeshRunOptions.d.ts.map +1 -1
- package/dist/core/mesh/compileMeshEnvironment.d.ts +1 -0
- package/dist/core/mesh/compileMeshEnvironment.d.ts.map +1 -1
- package/dist/core/mesh/runners/runMeshDev.d.ts.map +1 -1
- package/dist/core/mesh/runners/runMeshProd.d.ts.map +1 -1
- package/dist/core/mesh/runners/runMeshTest.d.ts.map +1 -1
- package/dist/core/mesh/runners/runMeshTestE2e.d.ts.map +1 -1
- package/dist/core/runners/runDev.d.ts.map +1 -1
- package/dist/core/runners/runProd.d.ts.map +1 -1
- package/dist/core/runners/runTestE2e.d.ts.map +1 -1
- package/dist/core/runners/runTestUnit.d.ts.map +1 -1
- package/dist/index.js +176 -128
- package/dist/index.js.map +1 -1
- package/dist/templates/docker/docker-compose.e2e.yml +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/templates/docker/docker-compose.e2e.yml +2 -2
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import
|
|
3
|
+
import pc22 from 'picocolors';
|
|
4
4
|
import fs, { existsSync, readFileSync, unlinkSync, mkdirSync, writeFileSync, statSync } from 'fs';
|
|
5
5
|
import path13 from 'path';
|
|
6
6
|
import { spawnSync, spawn } from 'child_process';
|
|
@@ -151,7 +151,7 @@ function runStep(executable, args, projectDir, ctx) {
|
|
|
151
151
|
if (stderr) process.stderr.write(stderr);
|
|
152
152
|
if (result.error || result.status !== 0) {
|
|
153
153
|
console.error("\n" + "=".repeat(60));
|
|
154
|
-
console.error(
|
|
154
|
+
console.error(pc22.red(`\u{1F6A8} INFRASTRUCTURE CHECK FAILED \u{1F6A8}`));
|
|
155
155
|
console.error("=".repeat(60));
|
|
156
156
|
console.error(`Failed Step : ${ctx.stepName}`);
|
|
157
157
|
if (ctx.targetFile) {
|
|
@@ -189,12 +189,12 @@ function checkDockerfile(buildJson, projectDir) {
|
|
|
189
189
|
);
|
|
190
190
|
}
|
|
191
191
|
console.log(
|
|
192
|
-
|
|
192
|
+
pc22.yellow(`\u26A0\uFE0F No ${dockerfileRel} found in project directory. Skipping Dockerfile checks.`)
|
|
193
193
|
);
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
196
|
const content = readFileSync(dockerfilePath, "utf-8");
|
|
197
|
-
console.log(
|
|
197
|
+
console.log(pc22.cyan(`
|
|
198
198
|
\u{1F50D} Linting Dockerfile (${dockerfileRel})...`));
|
|
199
199
|
runStep(
|
|
200
200
|
"docker",
|
|
@@ -217,7 +217,7 @@ function checkDockerfileContract(buildJson, projectDir) {
|
|
|
217
217
|
if (!existsSync(dockerfilePath) || !existsSync(policyDir)) {
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
|
-
console.log(
|
|
220
|
+
console.log(pc22.cyan(`
|
|
221
221
|
\u{1F50D} Validating Dockerfile Contract (${policyRel})...`));
|
|
222
222
|
runStep(
|
|
223
223
|
"docker",
|
|
@@ -285,7 +285,7 @@ function checkYamlFiles(buildJson, projectDir) {
|
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
287
|
console.log(
|
|
288
|
-
|
|
288
|
+
pc22.cyan(
|
|
289
289
|
`
|
|
290
290
|
\u{1F50D} Validating Declared YAML Files (${declaredFiles.length} file${declaredFiles.length === 1 ? "" : "s"})...`
|
|
291
291
|
)
|
|
@@ -342,7 +342,7 @@ function checkComposeContract(buildJson, projectDir) {
|
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
const relativePaths = existingFiles.map((f) => f.relativePath);
|
|
345
|
-
console.log(
|
|
345
|
+
console.log(pc22.cyan(`
|
|
346
346
|
\u{1F50D} Validating Compose Contract (${policyRel})...`));
|
|
347
347
|
runStep(
|
|
348
348
|
"docker",
|
|
@@ -378,7 +378,7 @@ function checkInfra(projectDir = process.cwd()) {
|
|
|
378
378
|
checkDockerfileContract(buildJson, absProjectDir);
|
|
379
379
|
checkYamlFiles(buildJson, absProjectDir);
|
|
380
380
|
checkComposeContract(buildJson, absProjectDir);
|
|
381
|
-
console.log(
|
|
381
|
+
console.log(pc22.green("\n\u2705 All infrastructure and contract checks passed.\n"));
|
|
382
382
|
}
|
|
383
383
|
function checkDependencies() {
|
|
384
384
|
const composeCheck = spawnSync(
|
|
@@ -420,7 +420,7 @@ function checkDependencies() {
|
|
|
420
420
|
const count = (networkCheck.stdout || "").trim().split("\n").filter(Boolean).length;
|
|
421
421
|
if (count > 25) {
|
|
422
422
|
console.warn(
|
|
423
|
-
|
|
423
|
+
pc22.yellow(
|
|
424
424
|
`
|
|
425
425
|
\u26A0\uFE0F High Docker Network Count Warning: Detected ${count} networks. Docker's default address pool can become exhausted, resulting in "could not find an available, non-overlapping IPv4 address pool" errors.
|
|
426
426
|
To resolve, run "builder prune" or "docker network prune -f", or configure default-address-pools in /etc/docker/daemon.json.
|
|
@@ -621,8 +621,8 @@ function checkMeshServices(mesh, meshDir = process.cwd()) {
|
|
|
621
621
|
const absMeshDir = resolveProjectDir(meshDir);
|
|
622
622
|
const serviceNames = Object.keys(mesh.services);
|
|
623
623
|
console.log(
|
|
624
|
-
|
|
625
|
-
|
|
624
|
+
pc22.bold(
|
|
625
|
+
pc22.cyan(
|
|
626
626
|
`
|
|
627
627
|
\u{1F50D} Checking Mesh Services (${serviceNames.length} service${serviceNames.length === 1 ? "" : "s"})...`
|
|
628
628
|
)
|
|
@@ -656,7 +656,7 @@ function checkMeshServices(mesh, meshDir = process.cwd()) {
|
|
|
656
656
|
);
|
|
657
657
|
}
|
|
658
658
|
console.log(
|
|
659
|
-
|
|
659
|
+
pc22.bold(pc22.blue(`
|
|
660
660
|
--- Validating Infrastructure for [${serviceName}] ---`))
|
|
661
661
|
);
|
|
662
662
|
checkInfra(serviceDir);
|
|
@@ -690,7 +690,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
|
|
|
690
690
|
);
|
|
691
691
|
}
|
|
692
692
|
console.log(
|
|
693
|
-
|
|
693
|
+
pc22.bold(pc22.cyan(`
|
|
694
694
|
\u{1F50D} Checking E2E Tester (${testerConfig.path})...`))
|
|
695
695
|
);
|
|
696
696
|
const composeRel = testerConfig.compose || "docker-compose.yml";
|
|
@@ -720,7 +720,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
|
|
|
720
720
|
);
|
|
721
721
|
}
|
|
722
722
|
const dockerfileContent = readFileSync(dockerfilePath, "utf-8");
|
|
723
|
-
console.log(
|
|
723
|
+
console.log(pc22.cyan(`
|
|
724
724
|
\u{1F50D} Linting E2E Tester Dockerfile (${dockerfileRel})...`));
|
|
725
725
|
runStep(
|
|
726
726
|
"docker",
|
|
@@ -736,7 +736,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
|
|
|
736
736
|
const dockerfilePolicyDir = path13.resolve(absTesterDir, dockerfilePolicyRel);
|
|
737
737
|
if (existsSync(dockerfilePolicyDir)) {
|
|
738
738
|
console.log(
|
|
739
|
-
|
|
739
|
+
pc22.cyan(
|
|
740
740
|
`
|
|
741
741
|
\u{1F50D} Validating Tester Dockerfile Contract (${dockerfilePolicyRel})...`
|
|
742
742
|
)
|
|
@@ -766,7 +766,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
|
|
|
766
766
|
const composePolicyDir = path13.resolve(absTesterDir, composePolicyRel);
|
|
767
767
|
if (existsSync(composePolicyDir)) {
|
|
768
768
|
console.log(
|
|
769
|
-
|
|
769
|
+
pc22.cyan(`
|
|
770
770
|
\u{1F50D} Validating Tester Compose Contract (${composePolicyRel})...`)
|
|
771
771
|
);
|
|
772
772
|
runStep(
|
|
@@ -791,7 +791,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
|
|
|
791
791
|
{ stepName: "E2E Tester Compose Contract", targetFile: composeRel }
|
|
792
792
|
);
|
|
793
793
|
}
|
|
794
|
-
console.log(
|
|
794
|
+
console.log(pc22.green(`\u2705 E2E tester configuration and contracts verified.
|
|
795
795
|
`));
|
|
796
796
|
}
|
|
797
797
|
|
|
@@ -802,8 +802,8 @@ function checkMesh(meshDir = process.cwd(), options = {}) {
|
|
|
802
802
|
checkMeshServices(mesh, absMeshDir);
|
|
803
803
|
checkMeshTester(mesh, absMeshDir, { required: Boolean(options.requireTester) });
|
|
804
804
|
console.log(
|
|
805
|
-
|
|
806
|
-
|
|
805
|
+
pc22.bold(
|
|
806
|
+
pc22.green("\n\u{1F389} All mesh infrastructure, services, and contract checks passed!\n")
|
|
807
807
|
)
|
|
808
808
|
);
|
|
809
809
|
}
|
|
@@ -1171,6 +1171,13 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
|
|
|
1171
1171
|
if (typeof value !== "string") {
|
|
1172
1172
|
return value;
|
|
1173
1173
|
}
|
|
1174
|
+
if (!options.silenceWarnings && context.includes("Tester") && value.includes(".network_url")) {
|
|
1175
|
+
console.warn(
|
|
1176
|
+
pc22.yellow(`
|
|
1177
|
+
\u26A0\uFE0F WARNING: You are passing a '.network_url' template to the E2E tester ("${value}"). Since the tester runs in 'network_mode: host', it cannot resolve internal Docker DNS. Use '.public_url' instead. (Mute with --silence-warnings)
|
|
1178
|
+
`)
|
|
1179
|
+
);
|
|
1180
|
+
}
|
|
1174
1181
|
let interpolated = value;
|
|
1175
1182
|
for (const [sName, urls] of serviceUrls.entries()) {
|
|
1176
1183
|
interpolated = interpolated.replace(
|
|
@@ -1501,11 +1508,8 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
|
|
|
1501
1508
|
);
|
|
1502
1509
|
delete resolvedTester.container_name;
|
|
1503
1510
|
normalizeDependsOn(resolvedTester);
|
|
1504
|
-
resolvedTester.
|
|
1505
|
-
|
|
1506
|
-
aliases: [tKey, ...tKey === firstKey ? ["tester"] : []]
|
|
1507
|
-
}
|
|
1508
|
-
};
|
|
1511
|
+
resolvedTester.network_mode = "host";
|
|
1512
|
+
delete resolvedTester.networks;
|
|
1509
1513
|
if (tKey === firstKey) {
|
|
1510
1514
|
resolvedTester.depends_on = resolvedTester.depends_on || {};
|
|
1511
1515
|
for (const sName of Object.keys(mesh.services)) {
|
|
@@ -1833,12 +1837,12 @@ async function teardownCompose(yamlConfig, projectDir, options = {}) {
|
|
|
1833
1837
|
if (result.error) {
|
|
1834
1838
|
if (!silent) {
|
|
1835
1839
|
console.error(
|
|
1836
|
-
|
|
1840
|
+
pc22.red(`Failed to run docker compose down: ${result.error.message}`)
|
|
1837
1841
|
);
|
|
1838
1842
|
}
|
|
1839
1843
|
} else if (result.status !== 0 && !silent) {
|
|
1840
1844
|
console.error(
|
|
1841
|
-
|
|
1845
|
+
pc22.red(
|
|
1842
1846
|
`Docker compose down exited with non-zero status code: ${result.status}`
|
|
1843
1847
|
)
|
|
1844
1848
|
);
|
|
@@ -1981,7 +1985,7 @@ async function handleMeshDown(rawStage = "dev", options = {}) {
|
|
|
1981
1985
|
);
|
|
1982
1986
|
}
|
|
1983
1987
|
console.log(
|
|
1984
|
-
|
|
1988
|
+
pc22.cyan(`
|
|
1985
1989
|
\u{1F9F9} Stopping and tearing down global mesh environment [${stage}]...`)
|
|
1986
1990
|
);
|
|
1987
1991
|
if (options.debug) {
|
|
@@ -1990,7 +1994,7 @@ async function handleMeshDown(rawStage = "dev", options = {}) {
|
|
|
1990
1994
|
const includeTester = stage === "test" || stage === "test-e2e";
|
|
1991
1995
|
const { yaml } = compileMeshEnvironment(mode, meshDir, { includeTester });
|
|
1992
1996
|
console.log(
|
|
1993
|
-
|
|
1997
|
+
pc22.yellow("\nFinal merged Mesh YAML configuration:\n"),
|
|
1994
1998
|
redactYamlSecrets(yaml)
|
|
1995
1999
|
);
|
|
1996
2000
|
} catch {
|
|
@@ -2010,7 +2014,7 @@ async function handleMeshDown(rawStage = "dev", options = {}) {
|
|
|
2010
2014
|
}
|
|
2011
2015
|
clearRunState(meshDir);
|
|
2012
2016
|
console.log(
|
|
2013
|
-
|
|
2017
|
+
pc22.green(`\u2705 Global mesh environment [${stage}] stopped and removed.
|
|
2014
2018
|
`)
|
|
2015
2019
|
);
|
|
2016
2020
|
return 0;
|
|
@@ -2093,7 +2097,7 @@ async function checkHostPortCollisions(ports) {
|
|
|
2093
2097
|
const inUse = await isPortInUse(port);
|
|
2094
2098
|
if (inUse) {
|
|
2095
2099
|
console.warn(
|
|
2096
|
-
|
|
2100
|
+
pc22.yellow(
|
|
2097
2101
|
`
|
|
2098
2102
|
\u26A0\uFE0F Host Port Conflict Warning: Port ${port} is already in use on the host (e.g. by another running stage or process). Docker Compose may fail to bind to this port.
|
|
2099
2103
|
`
|
|
@@ -2159,22 +2163,24 @@ async function runCompose(args, yamlConfig, projectDir, options = {}) {
|
|
|
2159
2163
|
// src/core/mesh/runners/runMeshDev.ts
|
|
2160
2164
|
async function runMeshDev(options = {}) {
|
|
2161
2165
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
2162
|
-
console.log(
|
|
2166
|
+
console.log(pc22.cyan(`
|
|
2163
2167
|
\u{1F680} Starting Global DEV Mesh Environment...`));
|
|
2164
2168
|
if (!options.skipChecks) {
|
|
2165
2169
|
checkMesh(meshDir, { requireTester: false });
|
|
2166
2170
|
}
|
|
2167
|
-
const { yaml } = compileMeshEnvironment("dev", meshDir
|
|
2171
|
+
const { yaml } = compileMeshEnvironment("dev", meshDir, {
|
|
2172
|
+
silenceWarnings: options.silenceWarnings
|
|
2173
|
+
});
|
|
2168
2174
|
const parsed = parse(yaml);
|
|
2169
2175
|
const projectName = parsed?.name || "mesh-dev";
|
|
2170
2176
|
if (options.debug) {
|
|
2171
2177
|
console.log(
|
|
2172
|
-
|
|
2178
|
+
pc22.yellow("\nFinal merged Mesh Dev YAML configuration:\n"),
|
|
2173
2179
|
redactYamlSecrets(yaml)
|
|
2174
2180
|
);
|
|
2175
2181
|
}
|
|
2176
2182
|
if (options.dryRun) {
|
|
2177
|
-
console.log(
|
|
2183
|
+
console.log(pc22.green("Dry run complete. Compose was not started."));
|
|
2178
2184
|
return 0;
|
|
2179
2185
|
}
|
|
2180
2186
|
const hostPorts = extractHostPorts(yaml);
|
|
@@ -2203,22 +2209,24 @@ async function runMeshDev(options = {}) {
|
|
|
2203
2209
|
}
|
|
2204
2210
|
async function runMeshProd(options = {}) {
|
|
2205
2211
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
2206
|
-
console.log(
|
|
2212
|
+
console.log(pc22.cyan(`
|
|
2207
2213
|
\u{1F3ED} Starting Global PROD Mesh Environment...`));
|
|
2208
2214
|
if (!options.skipChecks) {
|
|
2209
2215
|
checkMesh(meshDir, { requireTester: false });
|
|
2210
2216
|
}
|
|
2211
|
-
const { yaml } = compileMeshEnvironment("prod", meshDir
|
|
2217
|
+
const { yaml } = compileMeshEnvironment("prod", meshDir, {
|
|
2218
|
+
silenceWarnings: options.silenceWarnings
|
|
2219
|
+
});
|
|
2212
2220
|
const parsed = parse(yaml);
|
|
2213
2221
|
const projectName = parsed?.name || "mesh-prod";
|
|
2214
2222
|
if (options.debug) {
|
|
2215
2223
|
console.log(
|
|
2216
|
-
|
|
2224
|
+
pc22.yellow("\nFinal merged Mesh Prod YAML configuration:\n"),
|
|
2217
2225
|
redactYamlSecrets(yaml)
|
|
2218
2226
|
);
|
|
2219
2227
|
}
|
|
2220
2228
|
if (options.dryRun) {
|
|
2221
|
-
console.log(
|
|
2229
|
+
console.log(pc22.green("Dry run complete. Compose was not started."));
|
|
2222
2230
|
return 0;
|
|
2223
2231
|
}
|
|
2224
2232
|
const hostPorts = extractHostPorts(yaml);
|
|
@@ -2546,7 +2554,7 @@ function getDockerComposeTemplate(filename) {
|
|
|
2546
2554
|
}
|
|
2547
2555
|
|
|
2548
2556
|
// src/core/compileEnvironment.ts
|
|
2549
|
-
var compileEnvironment = (environment, projectDir = process.cwd()) => {
|
|
2557
|
+
var compileEnvironment = (environment, projectDir = process.cwd(), options = {}) => {
|
|
2550
2558
|
const absProjectDir = resolveProjectDir(projectDir);
|
|
2551
2559
|
const buildJson = getBuildJson(absProjectDir);
|
|
2552
2560
|
const overrides = extractOverrides(buildJson, absProjectDir);
|
|
@@ -2629,6 +2637,7 @@ var compileEnvironment = (environment, projectDir = process.cwd()) => {
|
|
|
2629
2637
|
case "e2e": {
|
|
2630
2638
|
const prodPath = getDockerComposeTemplate("docker-compose.prod.yml");
|
|
2631
2639
|
const e2ePath = getDockerComposeTemplate("docker-compose.e2e.yml");
|
|
2640
|
+
const standalonePath = getDockerComposeTemplate("docker-compose.standalone.yml");
|
|
2632
2641
|
composeFlags.push("-f", prodPath);
|
|
2633
2642
|
filesUsed.push(prodPath);
|
|
2634
2643
|
if (overrides.prod) {
|
|
@@ -2641,6 +2650,8 @@ var compileEnvironment = (environment, projectDir = process.cwd()) => {
|
|
|
2641
2650
|
filesUsed.push(dep.path);
|
|
2642
2651
|
}
|
|
2643
2652
|
}
|
|
2653
|
+
composeFlags.push("-f", standalonePath);
|
|
2654
|
+
filesUsed.push(standalonePath);
|
|
2644
2655
|
composeFlags.push("-f", e2ePath);
|
|
2645
2656
|
filesUsed.push(e2ePath);
|
|
2646
2657
|
if (overrides.e2e) {
|
|
@@ -2705,6 +2716,13 @@ ${explanation}`);
|
|
|
2705
2716
|
});
|
|
2706
2717
|
}
|
|
2707
2718
|
const interpolateEnv = (val, context) => {
|
|
2719
|
+
if (!options.silenceWarnings && context.includes("Tester") && val.includes(".network_url")) {
|
|
2720
|
+
console.warn(
|
|
2721
|
+
pc22.yellow(`
|
|
2722
|
+
\u26A0\uFE0F WARNING: You are passing a '.network_url' template to the E2E tester ("${val}"). Since the tester runs in 'network_mode: host', it cannot resolve internal Docker DNS. Use '.public_url' instead. (Mute with --silence-warnings)
|
|
2723
|
+
`)
|
|
2724
|
+
);
|
|
2725
|
+
}
|
|
2708
2726
|
let output = val;
|
|
2709
2727
|
for (const [sName, urls] of urlRegistry.entries()) {
|
|
2710
2728
|
const escaped = sName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -2721,9 +2739,20 @@ ${explanation}`);
|
|
|
2721
2739
|
}
|
|
2722
2740
|
const unresolvedMatch = output.match(/\$\{([^}]+?)\.(network_url|public_url)\}/);
|
|
2723
2741
|
if (unresolvedMatch) {
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2742
|
+
const variable = unresolvedMatch[0];
|
|
2743
|
+
const targetService = unresolvedMatch[1];
|
|
2744
|
+
const type = unresolvedMatch[2];
|
|
2745
|
+
if (!urlRegistry.has(targetService)) {
|
|
2746
|
+
throw new ScriptError(
|
|
2747
|
+
`[${context}] Unresolved template variable: ${variable}. Check build.json dependencies.`
|
|
2748
|
+
);
|
|
2749
|
+
} else if (type === "public_url") {
|
|
2750
|
+
throw new ScriptError(
|
|
2751
|
+
`[${context}] Unresolved template variable: ${variable}. Service "${targetService}" does not expose a public port (missing 'port' explicitly defined in build.json).`
|
|
2752
|
+
);
|
|
2753
|
+
} else {
|
|
2754
|
+
throw new ScriptError(`[${context}] Unresolved template variable: ${variable}.`);
|
|
2755
|
+
}
|
|
2727
2756
|
}
|
|
2728
2757
|
return output;
|
|
2729
2758
|
};
|
|
@@ -2765,23 +2794,25 @@ ${explanation}`);
|
|
|
2765
2794
|
// src/core/runners/runTestUnit.ts
|
|
2766
2795
|
var runTestUnit = async (options) => {
|
|
2767
2796
|
if (!options.skipBanner) {
|
|
2768
|
-
console.log(
|
|
2797
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2769
2798
|
========================================`)));
|
|
2770
|
-
console.log(
|
|
2771
|
-
console.log(
|
|
2799
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} STAGE: UNIT & ISOLATED TESTS`)));
|
|
2800
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2772
2801
|
`)));
|
|
2773
2802
|
}
|
|
2774
|
-
const finalYamlConfig = compileEnvironment("test", options.projectDir
|
|
2803
|
+
const finalYamlConfig = compileEnvironment("test", options.projectDir, {
|
|
2804
|
+
silenceWarnings: options.silenceWarnings
|
|
2805
|
+
});
|
|
2775
2806
|
const parsed = parse(finalYamlConfig);
|
|
2776
2807
|
const projectName = parsed?.name || "test";
|
|
2777
2808
|
if (options.debug) {
|
|
2778
2809
|
console.log(
|
|
2779
|
-
|
|
2810
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
2780
2811
|
redactYamlSecrets(finalYamlConfig)
|
|
2781
2812
|
);
|
|
2782
2813
|
}
|
|
2783
2814
|
if (options.dryRun) {
|
|
2784
|
-
console.log(
|
|
2815
|
+
console.log(pc22.green("[DRY-RUN] Unit tests simulated. Compose was not started."));
|
|
2785
2816
|
return 0;
|
|
2786
2817
|
}
|
|
2787
2818
|
await teardownCompose(finalYamlConfig, options.projectDir, {
|
|
@@ -2806,11 +2837,11 @@ var runTestUnit = async (options) => {
|
|
|
2806
2837
|
clearRunState(options.projectDir);
|
|
2807
2838
|
}
|
|
2808
2839
|
if (status === 0) {
|
|
2809
|
-
console.log(
|
|
2840
|
+
console.log(pc22.bold(pc22.green(`
|
|
2810
2841
|
\u2705 Unit tests passed successfully.
|
|
2811
2842
|
`)));
|
|
2812
2843
|
} else {
|
|
2813
|
-
console.error(
|
|
2844
|
+
console.error(pc22.red(`
|
|
2814
2845
|
\u274C Unit tests failed with exit code ${status}.
|
|
2815
2846
|
`));
|
|
2816
2847
|
}
|
|
@@ -2818,23 +2849,25 @@ var runTestUnit = async (options) => {
|
|
|
2818
2849
|
};
|
|
2819
2850
|
var runTestE2e = async (options) => {
|
|
2820
2851
|
if (!options.skipBanner) {
|
|
2821
|
-
console.log(
|
|
2852
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2822
2853
|
========================================`)));
|
|
2823
|
-
console.log(
|
|
2824
|
-
console.log(
|
|
2854
|
+
console.log(pc22.bold(pc22.blue(`\u{1F6A6} STAGE: INTEGRATED E2E TESTS`)));
|
|
2855
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2825
2856
|
`)));
|
|
2826
2857
|
}
|
|
2827
|
-
const finalYamlConfig = compileEnvironment("e2e", options.projectDir
|
|
2858
|
+
const finalYamlConfig = compileEnvironment("e2e", options.projectDir, {
|
|
2859
|
+
silenceWarnings: options.silenceWarnings
|
|
2860
|
+
});
|
|
2828
2861
|
const parsed = parse(finalYamlConfig);
|
|
2829
2862
|
const projectName = parsed?.name || "e2e";
|
|
2830
2863
|
if (options.debug) {
|
|
2831
2864
|
console.log(
|
|
2832
|
-
|
|
2865
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
2833
2866
|
redactYamlSecrets(finalYamlConfig)
|
|
2834
2867
|
);
|
|
2835
2868
|
}
|
|
2836
2869
|
if (options.dryRun) {
|
|
2837
|
-
console.log(
|
|
2870
|
+
console.log(pc22.green("[DRY-RUN] E2E tests simulated. Compose was not started."));
|
|
2838
2871
|
return 0;
|
|
2839
2872
|
}
|
|
2840
2873
|
await teardownCompose(finalYamlConfig, options.projectDir, {
|
|
@@ -2865,11 +2898,11 @@ var runTestE2e = async (options) => {
|
|
|
2865
2898
|
clearRunState(options.projectDir);
|
|
2866
2899
|
}
|
|
2867
2900
|
if (status === 0) {
|
|
2868
|
-
console.log(
|
|
2901
|
+
console.log(pc22.bold(pc22.green(`
|
|
2869
2902
|
\u2705 E2E tests passed successfully.
|
|
2870
2903
|
`)));
|
|
2871
2904
|
} else {
|
|
2872
|
-
console.error(
|
|
2905
|
+
console.error(pc22.red(`
|
|
2873
2906
|
\u274C E2E tests failed with exit code ${status}.
|
|
2874
2907
|
`));
|
|
2875
2908
|
}
|
|
@@ -2878,15 +2911,15 @@ var runTestE2e = async (options) => {
|
|
|
2878
2911
|
|
|
2879
2912
|
// src/core/runners/runTest.ts
|
|
2880
2913
|
var runTest = async (options) => {
|
|
2881
|
-
console.log(
|
|
2914
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2882
2915
|
========================================`)));
|
|
2883
|
-
console.log(
|
|
2884
|
-
console.log(
|
|
2916
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} [1/2] STAGE: UNIT & ISOLATED TESTS`)));
|
|
2917
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2885
2918
|
`)));
|
|
2886
2919
|
const unitStatus = await runTestUnit({ ...options, skipBanner: true });
|
|
2887
2920
|
if (unitStatus !== 0) {
|
|
2888
2921
|
console.error(
|
|
2889
|
-
|
|
2922
|
+
pc22.red(
|
|
2890
2923
|
`
|
|
2891
2924
|
\u274C [1/2] Unit tests failed with exit code ${unitStatus}. Aborting E2E tests.
|
|
2892
2925
|
`
|
|
@@ -2895,29 +2928,29 @@ var runTest = async (options) => {
|
|
|
2895
2928
|
return unitStatus;
|
|
2896
2929
|
}
|
|
2897
2930
|
console.log(
|
|
2898
|
-
|
|
2931
|
+
pc22.bold(pc22.green(`
|
|
2899
2932
|
\u2705 [1/2] Unit tests passed successfully.
|
|
2900
2933
|
`))
|
|
2901
2934
|
);
|
|
2902
|
-
console.log(
|
|
2903
|
-
console.log(
|
|
2904
|
-
console.log(
|
|
2935
|
+
console.log(pc22.bold(pc22.blue(`========================================`)));
|
|
2936
|
+
console.log(pc22.bold(pc22.blue(`\u{1F6A6} [2/2] STAGE: INTEGRATED E2E TESTS`)));
|
|
2937
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2905
2938
|
`)));
|
|
2906
2939
|
const e2eStatus = await runTestE2e({ ...options, skipBanner: true });
|
|
2907
2940
|
if (e2eStatus !== 0) {
|
|
2908
2941
|
console.error(
|
|
2909
|
-
|
|
2942
|
+
pc22.red(`
|
|
2910
2943
|
\u274C [2/2] E2E tests failed with exit code ${e2eStatus}.
|
|
2911
2944
|
`)
|
|
2912
2945
|
);
|
|
2913
2946
|
return e2eStatus;
|
|
2914
2947
|
}
|
|
2915
|
-
console.log(
|
|
2948
|
+
console.log(pc22.bold(pc22.green(`
|
|
2916
2949
|
\u2705 [2/2] E2E tests passed successfully.
|
|
2917
2950
|
`)));
|
|
2918
2951
|
console.log(
|
|
2919
|
-
|
|
2920
|
-
|
|
2952
|
+
pc22.bold(
|
|
2953
|
+
pc22.green(`\u{1F389} All test stages (unit + e2e) completed successfully!
|
|
2921
2954
|
`)
|
|
2922
2955
|
)
|
|
2923
2956
|
);
|
|
@@ -2925,16 +2958,17 @@ var runTest = async (options) => {
|
|
|
2925
2958
|
};
|
|
2926
2959
|
async function runMeshTestE2e(options = {}) {
|
|
2927
2960
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
2928
|
-
console.log(
|
|
2961
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2929
2962
|
========================================`)));
|
|
2930
|
-
console.log(
|
|
2931
|
-
console.log(
|
|
2963
|
+
console.log(pc22.bold(pc22.blue(`\u{1F6A6} [MESH] STAGE: GLOBAL INTEGRATED E2E TESTS`)));
|
|
2964
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2932
2965
|
`)));
|
|
2933
2966
|
if (!options.skipChecks) {
|
|
2934
2967
|
checkMesh(meshDir, { requireTester: true });
|
|
2935
2968
|
}
|
|
2936
2969
|
const { yaml, testerServiceName } = compileMeshEnvironment("prod", meshDir, {
|
|
2937
|
-
includeTester: true
|
|
2970
|
+
includeTester: true,
|
|
2971
|
+
silenceWarnings: options.silenceWarnings
|
|
2938
2972
|
});
|
|
2939
2973
|
if (!testerServiceName) {
|
|
2940
2974
|
throw new ScriptError(
|
|
@@ -2943,12 +2977,12 @@ async function runMeshTestE2e(options = {}) {
|
|
|
2943
2977
|
}
|
|
2944
2978
|
if (options.debug) {
|
|
2945
2979
|
console.log(
|
|
2946
|
-
|
|
2980
|
+
pc22.yellow("\nFinal merged Mesh E2E YAML configuration:\n"),
|
|
2947
2981
|
redactYamlSecrets(yaml)
|
|
2948
2982
|
);
|
|
2949
2983
|
}
|
|
2950
2984
|
if (options.dryRun) {
|
|
2951
|
-
console.log(
|
|
2985
|
+
console.log(pc22.green("[DRY-RUN] Global E2E test simulated. Compose was not started."));
|
|
2952
2986
|
return 0;
|
|
2953
2987
|
}
|
|
2954
2988
|
const parsed = parse(yaml);
|
|
@@ -2974,16 +3008,16 @@ async function runMeshTestE2e(options = {}) {
|
|
|
2974
3008
|
{ removeVolumes: true }
|
|
2975
3009
|
);
|
|
2976
3010
|
} finally {
|
|
2977
|
-
console.log(
|
|
3011
|
+
console.log(pc22.cyan("\n\u{1F9F9} Cleaning up global mesh containers and volumes..."));
|
|
2978
3012
|
await teardownCompose(yaml, meshDir, { removeVolumes: true });
|
|
2979
3013
|
clearRunState(meshDir);
|
|
2980
3014
|
}
|
|
2981
3015
|
if (status === 0) {
|
|
2982
|
-
console.log(
|
|
3016
|
+
console.log(pc22.bold(pc22.green(`
|
|
2983
3017
|
\u2705 Global E2E tests passed successfully.
|
|
2984
3018
|
`)));
|
|
2985
3019
|
} else {
|
|
2986
|
-
console.error(
|
|
3020
|
+
console.error(pc22.red(`
|
|
2987
3021
|
\u274C Global E2E tests failed with exit code ${status}.
|
|
2988
3022
|
`));
|
|
2989
3023
|
}
|
|
@@ -2993,44 +3027,45 @@ async function runMeshTestE2e(options = {}) {
|
|
|
2993
3027
|
// src/core/mesh/runners/runMeshTest.ts
|
|
2994
3028
|
async function runMeshTest(options = {}) {
|
|
2995
3029
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
2996
|
-
console.log(
|
|
3030
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2997
3031
|
========================================`)));
|
|
2998
|
-
console.log(
|
|
2999
|
-
console.log(
|
|
3032
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} GLOBAL MESH TEST PIPELINE`)));
|
|
3033
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3000
3034
|
`)));
|
|
3001
3035
|
if (!options.skipChecks) {
|
|
3002
3036
|
checkMesh(meshDir, { requireTester: true });
|
|
3003
3037
|
}
|
|
3004
3038
|
const mesh = getMeshJson(meshDir);
|
|
3005
|
-
console.log(
|
|
3039
|
+
console.log(pc22.bold(pc22.blue(`
|
|
3006
3040
|
========================================`)));
|
|
3007
3041
|
console.log(
|
|
3008
|
-
|
|
3009
|
-
|
|
3042
|
+
pc22.bold(
|
|
3043
|
+
pc22.blue(`\u{1F9EA} [1/2] STAGE: LOCAL SUBMODULE TEST SUITES (Unit & Isolated E2E)`)
|
|
3010
3044
|
)
|
|
3011
3045
|
);
|
|
3012
|
-
console.log(
|
|
3046
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3013
3047
|
`)));
|
|
3014
3048
|
for (const [serviceName, serviceConfig] of Object.entries(mesh.services)) {
|
|
3015
3049
|
const serviceDir = path13.resolve(meshDir, serviceConfig.path);
|
|
3016
3050
|
console.log(
|
|
3017
|
-
|
|
3051
|
+
pc22.bold(pc22.cyan(`
|
|
3018
3052
|
-> Running full test suite for [${serviceName}] in isolation...`))
|
|
3019
3053
|
);
|
|
3020
3054
|
if (options.dryRun) {
|
|
3021
3055
|
console.log(
|
|
3022
|
-
|
|
3056
|
+
pc22.green(`[DRY-RUN] Full isolated tests for ${serviceName} simulated.`)
|
|
3023
3057
|
);
|
|
3024
3058
|
continue;
|
|
3025
3059
|
}
|
|
3026
3060
|
const serviceStatus = await runTest({
|
|
3027
3061
|
projectDir: serviceDir,
|
|
3028
3062
|
debug: Boolean(options.debug),
|
|
3029
|
-
detach: Boolean(options.detach)
|
|
3063
|
+
detach: Boolean(options.detach),
|
|
3064
|
+
silenceWarnings: options.silenceWarnings
|
|
3030
3065
|
});
|
|
3031
3066
|
if (serviceStatus !== 0) {
|
|
3032
3067
|
console.error(
|
|
3033
|
-
|
|
3068
|
+
pc22.red(
|
|
3034
3069
|
`
|
|
3035
3070
|
\u274C Isolated tests failed for service [${serviceName}] with exit code ${serviceStatus}. Aborting global E2E tests.
|
|
3036
3071
|
`
|
|
@@ -3039,27 +3074,27 @@ async function runMeshTest(options = {}) {
|
|
|
3039
3074
|
return serviceStatus;
|
|
3040
3075
|
}
|
|
3041
3076
|
console.log(
|
|
3042
|
-
|
|
3077
|
+
pc22.bold(pc22.green(`
|
|
3043
3078
|
\u2705 Isolated tests passed for service: [${serviceName}]
|
|
3044
3079
|
`))
|
|
3045
3080
|
);
|
|
3046
3081
|
}
|
|
3047
|
-
console.log(
|
|
3082
|
+
console.log(pc22.bold(pc22.blue(`
|
|
3048
3083
|
========================================`)));
|
|
3049
3084
|
console.log(
|
|
3050
|
-
|
|
3051
|
-
|
|
3085
|
+
pc22.bold(
|
|
3086
|
+
pc22.blue(`\u{1F6A6} [2/2] STAGE: INTEGRATED PRODUCTION MESH & GLOBAL E2E ASSERTIONS`)
|
|
3052
3087
|
)
|
|
3053
3088
|
);
|
|
3054
|
-
console.log(
|
|
3089
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3055
3090
|
`)));
|
|
3056
3091
|
const e2eStatus = await runMeshTestE2e({ ...options, skipChecks: true });
|
|
3057
3092
|
if (e2eStatus !== 0) {
|
|
3058
3093
|
return e2eStatus;
|
|
3059
3094
|
}
|
|
3060
3095
|
console.log(
|
|
3061
|
-
|
|
3062
|
-
|
|
3096
|
+
pc22.bold(
|
|
3097
|
+
pc22.green(`\u{1F389} Entire global mesh test pipeline (unit, local e2e, and global e2e) completed successfully!
|
|
3063
3098
|
`)
|
|
3064
3099
|
)
|
|
3065
3100
|
);
|
|
@@ -3067,10 +3102,10 @@ async function runMeshTest(options = {}) {
|
|
|
3067
3102
|
}
|
|
3068
3103
|
async function runMeshTestUnit(options = {}) {
|
|
3069
3104
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
3070
|
-
console.log(
|
|
3105
|
+
console.log(pc22.bold(pc22.blue(`
|
|
3071
3106
|
========================================`)));
|
|
3072
|
-
console.log(
|
|
3073
|
-
console.log(
|
|
3107
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} [MESH] STAGE: ISOLATED UNIT TESTS`)));
|
|
3108
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3074
3109
|
`)));
|
|
3075
3110
|
if (!options.skipChecks) {
|
|
3076
3111
|
checkMesh(meshDir, { requireTester: false });
|
|
@@ -3079,11 +3114,11 @@ async function runMeshTestUnit(options = {}) {
|
|
|
3079
3114
|
for (const [serviceName, serviceConfig] of Object.entries(mesh.services)) {
|
|
3080
3115
|
const serviceDir = path13.resolve(meshDir, serviceConfig.path);
|
|
3081
3116
|
console.log(
|
|
3082
|
-
|
|
3117
|
+
pc22.cyan(`
|
|
3083
3118
|
-> Running isolated unit tests for service: [${serviceName}]...`)
|
|
3084
3119
|
);
|
|
3085
3120
|
if (options.dryRun) {
|
|
3086
|
-
console.log(
|
|
3121
|
+
console.log(pc22.green(`[DRY-RUN] Unit tests for ${serviceName} simulated.`));
|
|
3087
3122
|
continue;
|
|
3088
3123
|
}
|
|
3089
3124
|
const unitStatus = await runTestUnit({
|
|
@@ -3094,20 +3129,20 @@ async function runMeshTestUnit(options = {}) {
|
|
|
3094
3129
|
});
|
|
3095
3130
|
if (unitStatus !== 0) {
|
|
3096
3131
|
console.error(
|
|
3097
|
-
|
|
3132
|
+
pc22.red(`
|
|
3098
3133
|
\u274C Unit tests failed for service [${serviceName}] with exit code ${unitStatus}.
|
|
3099
3134
|
`)
|
|
3100
3135
|
);
|
|
3101
3136
|
return unitStatus;
|
|
3102
3137
|
}
|
|
3103
3138
|
console.log(
|
|
3104
|
-
|
|
3139
|
+
pc22.bold(pc22.green(`
|
|
3105
3140
|
\u2705 Isolated unit tests passed for service: [${serviceName}]
|
|
3106
3141
|
`))
|
|
3107
3142
|
);
|
|
3108
3143
|
}
|
|
3109
3144
|
console.log(
|
|
3110
|
-
|
|
3145
|
+
pc22.bold(pc22.green(`\u{1F389} All mesh service unit tests completed successfully!
|
|
3111
3146
|
`))
|
|
3112
3147
|
);
|
|
3113
3148
|
return 0;
|
|
@@ -3149,6 +3184,9 @@ var registerMeshUpCommand = (cmd) => {
|
|
|
3149
3184
|
).option(
|
|
3150
3185
|
"--skip-checks",
|
|
3151
3186
|
"Skip hadolint and conftest pre-flight checks"
|
|
3187
|
+
).option(
|
|
3188
|
+
"--silence-warnings",
|
|
3189
|
+
"Silence non-critical warnings like URL templating hints"
|
|
3152
3190
|
).option(
|
|
3153
3191
|
"-C, --project-dir <dir>",
|
|
3154
3192
|
"Mesh project directory containing mesh.json (defaults to cwd)"
|
|
@@ -3168,7 +3206,8 @@ Examples:
|
|
|
3168
3206
|
debug: options.debug,
|
|
3169
3207
|
detach: options.detach,
|
|
3170
3208
|
dryRun: options.dryRun,
|
|
3171
|
-
skipChecks: options.skipChecks
|
|
3209
|
+
skipChecks: options.skipChecks,
|
|
3210
|
+
silenceWarnings: options.silenceWarnings
|
|
3172
3211
|
});
|
|
3173
3212
|
if (exitCode !== 0) {
|
|
3174
3213
|
process.exit(exitCode);
|
|
@@ -3188,7 +3227,7 @@ var registerMeshCommand = (program) => {
|
|
|
3188
3227
|
registerMeshCheckCommand(meshCmd);
|
|
3189
3228
|
};
|
|
3190
3229
|
async function handlePrune(options = {}) {
|
|
3191
|
-
console.log(
|
|
3230
|
+
console.log(pc22.cyan("\n\u{1F9F9} Pruning stopped Compose containers and unused networks..."));
|
|
3192
3231
|
const rmContainers = spawnSync("docker", ["container", "prune", "-f"], {
|
|
3193
3232
|
stdio: "inherit",
|
|
3194
3233
|
encoding: "utf-8"
|
|
@@ -3208,13 +3247,13 @@ async function handlePrune(options = {}) {
|
|
|
3208
3247
|
});
|
|
3209
3248
|
}
|
|
3210
3249
|
if (options.volumes) {
|
|
3211
|
-
console.log(
|
|
3250
|
+
console.log(pc22.cyan("\u{1F9F9} Pruning dangling volumes..."));
|
|
3212
3251
|
spawnSync("docker", ["volume", "prune", "-f"], {
|
|
3213
3252
|
stdio: "inherit",
|
|
3214
3253
|
encoding: "utf-8"
|
|
3215
3254
|
});
|
|
3216
3255
|
}
|
|
3217
|
-
console.log(
|
|
3256
|
+
console.log(pc22.green("\u2705 Docker environment pruned successfully.\n"));
|
|
3218
3257
|
return 0;
|
|
3219
3258
|
}
|
|
3220
3259
|
|
|
@@ -3248,7 +3287,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
|
|
|
3248
3287
|
);
|
|
3249
3288
|
}
|
|
3250
3289
|
console.log(
|
|
3251
|
-
|
|
3290
|
+
pc22.cyan(`
|
|
3252
3291
|
\u{1F9F9} Stopping and tearing down service environment [${stage}]...`)
|
|
3253
3292
|
);
|
|
3254
3293
|
if (options.debug) {
|
|
@@ -3259,7 +3298,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
|
|
|
3259
3298
|
else if (stage === "test-e2e") env = "e2e";
|
|
3260
3299
|
const finalYamlConfig = compileEnvironment(env, projectDir);
|
|
3261
3300
|
console.log(
|
|
3262
|
-
|
|
3301
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
3263
3302
|
redactYamlSecrets(finalYamlConfig)
|
|
3264
3303
|
);
|
|
3265
3304
|
} catch {
|
|
@@ -3279,7 +3318,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
|
|
|
3279
3318
|
}
|
|
3280
3319
|
clearRunState(projectDir);
|
|
3281
3320
|
console.log(
|
|
3282
|
-
|
|
3321
|
+
pc22.green(`\u2705 Service environment [${stage}] stopped and removed.
|
|
3283
3322
|
`)
|
|
3284
3323
|
);
|
|
3285
3324
|
return 0;
|
|
@@ -3317,18 +3356,20 @@ Examples:
|
|
|
3317
3356
|
);
|
|
3318
3357
|
};
|
|
3319
3358
|
var runDev = async (options) => {
|
|
3320
|
-
console.log(
|
|
3321
|
-
const finalYamlConfig = compileEnvironment("dev", options.projectDir
|
|
3359
|
+
console.log(pc22.cyan(`\u{1F680} Starting DEV environment...`));
|
|
3360
|
+
const finalYamlConfig = compileEnvironment("dev", options.projectDir, {
|
|
3361
|
+
silenceWarnings: options.silenceWarnings
|
|
3362
|
+
});
|
|
3322
3363
|
const parsed = parse(finalYamlConfig);
|
|
3323
3364
|
const projectName = parsed?.name || "dev";
|
|
3324
3365
|
if (options.debug) {
|
|
3325
3366
|
console.log(
|
|
3326
|
-
|
|
3367
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
3327
3368
|
redactYamlSecrets(finalYamlConfig)
|
|
3328
3369
|
);
|
|
3329
3370
|
}
|
|
3330
3371
|
if (options.dryRun) {
|
|
3331
|
-
console.log(
|
|
3372
|
+
console.log(pc22.green("Dry run complete. Compose was not started."));
|
|
3332
3373
|
return 0;
|
|
3333
3374
|
}
|
|
3334
3375
|
const hostPorts = extractHostPorts(finalYamlConfig);
|
|
@@ -3358,18 +3399,20 @@ var runDev = async (options) => {
|
|
|
3358
3399
|
return status;
|
|
3359
3400
|
};
|
|
3360
3401
|
var runProd = async (options) => {
|
|
3361
|
-
console.log(
|
|
3362
|
-
const finalYamlConfig = compileEnvironment("prod", options.projectDir
|
|
3402
|
+
console.log(pc22.cyan(`\u{1F3ED} Starting PROD environment...`));
|
|
3403
|
+
const finalYamlConfig = compileEnvironment("prod", options.projectDir, {
|
|
3404
|
+
silenceWarnings: options.silenceWarnings
|
|
3405
|
+
});
|
|
3363
3406
|
const parsed = parse(finalYamlConfig);
|
|
3364
3407
|
const projectName = parsed?.name || "prod";
|
|
3365
3408
|
if (options.debug) {
|
|
3366
3409
|
console.log(
|
|
3367
|
-
|
|
3410
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
3368
3411
|
redactYamlSecrets(finalYamlConfig)
|
|
3369
3412
|
);
|
|
3370
3413
|
}
|
|
3371
3414
|
if (options.dryRun) {
|
|
3372
|
-
console.log(
|
|
3415
|
+
console.log(pc22.green("Dry run complete. Compose was not started."));
|
|
3373
3416
|
return 0;
|
|
3374
3417
|
}
|
|
3375
3418
|
const hostPorts = extractHostPorts(finalYamlConfig);
|
|
@@ -3407,7 +3450,8 @@ async function handleServiceUp(rawStage, options = {}) {
|
|
|
3407
3450
|
projectDir,
|
|
3408
3451
|
debug: Boolean(options.debug),
|
|
3409
3452
|
detach: Boolean(options.detach),
|
|
3410
|
-
dryRun: Boolean(options.dryRun)
|
|
3453
|
+
dryRun: Boolean(options.dryRun),
|
|
3454
|
+
silenceWarnings: Boolean(options.silenceWarnings)
|
|
3411
3455
|
};
|
|
3412
3456
|
if (stage === "dev") {
|
|
3413
3457
|
return await runDev(runOptions);
|
|
@@ -3439,6 +3483,9 @@ var registerUpCommand = (cmd) => {
|
|
|
3439
3483
|
).option(
|
|
3440
3484
|
"--skip-checks",
|
|
3441
3485
|
"Skip hadolint and conftest pre-flight checks"
|
|
3486
|
+
).option(
|
|
3487
|
+
"--silence-warnings",
|
|
3488
|
+
"Silence non-critical warnings like URL templating hints"
|
|
3442
3489
|
).option(
|
|
3443
3490
|
"-C, --project-dir <dir>",
|
|
3444
3491
|
"Service project directory (defaults to cwd)"
|
|
@@ -3458,7 +3505,8 @@ Examples:
|
|
|
3458
3505
|
debug: options.debug,
|
|
3459
3506
|
detach: options.detach,
|
|
3460
3507
|
dryRun: options.dryRun,
|
|
3461
|
-
skipChecks: options.skipChecks
|
|
3508
|
+
skipChecks: options.skipChecks,
|
|
3509
|
+
silenceWarnings: options.silenceWarnings
|
|
3462
3510
|
});
|
|
3463
3511
|
if (exitCode !== 0) {
|
|
3464
3512
|
process.exit(exitCode);
|
|
@@ -3511,10 +3559,10 @@ async function runCli(argv = process.argv) {
|
|
|
3511
3559
|
(arg) => arg === "-h" || arg === "--help" || arg === "-V" || arg === "--version"
|
|
3512
3560
|
);
|
|
3513
3561
|
if (!isHelpOrVersion && argv.length > 2) {
|
|
3514
|
-
console.log(
|
|
3562
|
+
console.log(pc22.dim(`builder v${version}`));
|
|
3515
3563
|
}
|
|
3516
3564
|
if (argv.length <= 2) {
|
|
3517
|
-
console.log(
|
|
3565
|
+
console.log(pc22.dim(`builder v${version}
|
|
3518
3566
|
`));
|
|
3519
3567
|
cli.outputHelp();
|
|
3520
3568
|
return;
|
|
@@ -3537,20 +3585,20 @@ async function runCli(argv = process.argv) {
|
|
|
3537
3585
|
if (err instanceof ScriptError) {
|
|
3538
3586
|
exitCode = err.exitCode;
|
|
3539
3587
|
const formatted = err.message.startsWith("\u274C") ? err.message : `\u274C ${err.message}`;
|
|
3540
|
-
console.error(
|
|
3588
|
+
console.error(pc22.red(`
|
|
3541
3589
|
${formatted}
|
|
3542
3590
|
`));
|
|
3543
3591
|
if (isVerbose && err.stack) {
|
|
3544
|
-
console.error(
|
|
3592
|
+
console.error(pc22.dim(err.stack));
|
|
3545
3593
|
}
|
|
3546
3594
|
} else {
|
|
3547
3595
|
const message = errorMessage(err);
|
|
3548
3596
|
const formatted = message.startsWith("\u274C") ? message : `\u274C Error: ${message}`;
|
|
3549
|
-
console.error(
|
|
3597
|
+
console.error(pc22.red(`
|
|
3550
3598
|
${formatted}
|
|
3551
3599
|
`));
|
|
3552
3600
|
if (isVerbose && err instanceof Error && err.stack) {
|
|
3553
|
-
console.error(
|
|
3601
|
+
console.error(pc22.dim(err.stack));
|
|
3554
3602
|
}
|
|
3555
3603
|
}
|
|
3556
3604
|
if (process.env.VITEST) {
|