@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/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import
|
|
2
|
+
import pc22 from 'picocolors';
|
|
3
3
|
import fs, { existsSync, readFileSync, unlinkSync, mkdirSync, writeFileSync, statSync } from 'fs';
|
|
4
4
|
import path13 from 'path';
|
|
5
5
|
import { spawnSync, spawn } from 'child_process';
|
|
@@ -159,7 +159,7 @@ function runStep(executable, args, projectDir, ctx) {
|
|
|
159
159
|
if (stderr) process.stderr.write(stderr);
|
|
160
160
|
if (result.error || result.status !== 0) {
|
|
161
161
|
console.error("\n" + "=".repeat(60));
|
|
162
|
-
console.error(
|
|
162
|
+
console.error(pc22.red(`\u{1F6A8} INFRASTRUCTURE CHECK FAILED \u{1F6A8}`));
|
|
163
163
|
console.error("=".repeat(60));
|
|
164
164
|
console.error(`Failed Step : ${ctx.stepName}`);
|
|
165
165
|
if (ctx.targetFile) {
|
|
@@ -197,12 +197,12 @@ function checkDockerfile(buildJson, projectDir) {
|
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
console.log(
|
|
200
|
-
|
|
200
|
+
pc22.yellow(`\u26A0\uFE0F No ${dockerfileRel} found in project directory. Skipping Dockerfile checks.`)
|
|
201
201
|
);
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
const content = readFileSync(dockerfilePath, "utf-8");
|
|
205
|
-
console.log(
|
|
205
|
+
console.log(pc22.cyan(`
|
|
206
206
|
\u{1F50D} Linting Dockerfile (${dockerfileRel})...`));
|
|
207
207
|
runStep(
|
|
208
208
|
"docker",
|
|
@@ -225,7 +225,7 @@ function checkDockerfileContract(buildJson, projectDir) {
|
|
|
225
225
|
if (!existsSync(dockerfilePath) || !existsSync(policyDir)) {
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
|
-
console.log(
|
|
228
|
+
console.log(pc22.cyan(`
|
|
229
229
|
\u{1F50D} Validating Dockerfile Contract (${policyRel})...`));
|
|
230
230
|
runStep(
|
|
231
231
|
"docker",
|
|
@@ -293,7 +293,7 @@ function checkYamlFiles(buildJson, projectDir) {
|
|
|
293
293
|
return;
|
|
294
294
|
}
|
|
295
295
|
console.log(
|
|
296
|
-
|
|
296
|
+
pc22.cyan(
|
|
297
297
|
`
|
|
298
298
|
\u{1F50D} Validating Declared YAML Files (${declaredFiles.length} file${declaredFiles.length === 1 ? "" : "s"})...`
|
|
299
299
|
)
|
|
@@ -350,7 +350,7 @@ function checkComposeContract(buildJson, projectDir) {
|
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
const relativePaths = existingFiles.map((f) => f.relativePath);
|
|
353
|
-
console.log(
|
|
353
|
+
console.log(pc22.cyan(`
|
|
354
354
|
\u{1F50D} Validating Compose Contract (${policyRel})...`));
|
|
355
355
|
runStep(
|
|
356
356
|
"docker",
|
|
@@ -386,7 +386,7 @@ function checkInfra(projectDir = process.cwd()) {
|
|
|
386
386
|
checkDockerfileContract(buildJson, absProjectDir);
|
|
387
387
|
checkYamlFiles(buildJson, absProjectDir);
|
|
388
388
|
checkComposeContract(buildJson, absProjectDir);
|
|
389
|
-
console.log(
|
|
389
|
+
console.log(pc22.green("\n\u2705 All infrastructure and contract checks passed.\n"));
|
|
390
390
|
}
|
|
391
391
|
function checkDependencies() {
|
|
392
392
|
const composeCheck = spawnSync(
|
|
@@ -428,7 +428,7 @@ function checkDependencies() {
|
|
|
428
428
|
const count = (networkCheck.stdout || "").trim().split("\n").filter(Boolean).length;
|
|
429
429
|
if (count > 25) {
|
|
430
430
|
console.warn(
|
|
431
|
-
|
|
431
|
+
pc22.yellow(
|
|
432
432
|
`
|
|
433
433
|
\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.
|
|
434
434
|
To resolve, run "builder prune" or "docker network prune -f", or configure default-address-pools in /etc/docker/daemon.json.
|
|
@@ -629,8 +629,8 @@ function checkMeshServices(mesh, meshDir = process.cwd()) {
|
|
|
629
629
|
const absMeshDir = resolveProjectDir(meshDir);
|
|
630
630
|
const serviceNames = Object.keys(mesh.services);
|
|
631
631
|
console.log(
|
|
632
|
-
|
|
633
|
-
|
|
632
|
+
pc22.bold(
|
|
633
|
+
pc22.cyan(
|
|
634
634
|
`
|
|
635
635
|
\u{1F50D} Checking Mesh Services (${serviceNames.length} service${serviceNames.length === 1 ? "" : "s"})...`
|
|
636
636
|
)
|
|
@@ -664,7 +664,7 @@ function checkMeshServices(mesh, meshDir = process.cwd()) {
|
|
|
664
664
|
);
|
|
665
665
|
}
|
|
666
666
|
console.log(
|
|
667
|
-
|
|
667
|
+
pc22.bold(pc22.blue(`
|
|
668
668
|
--- Validating Infrastructure for [${serviceName}] ---`))
|
|
669
669
|
);
|
|
670
670
|
checkInfra(serviceDir);
|
|
@@ -698,7 +698,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
|
|
|
698
698
|
);
|
|
699
699
|
}
|
|
700
700
|
console.log(
|
|
701
|
-
|
|
701
|
+
pc22.bold(pc22.cyan(`
|
|
702
702
|
\u{1F50D} Checking E2E Tester (${testerConfig.path})...`))
|
|
703
703
|
);
|
|
704
704
|
const composeRel = testerConfig.compose || "docker-compose.yml";
|
|
@@ -728,7 +728,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
|
|
|
728
728
|
);
|
|
729
729
|
}
|
|
730
730
|
const dockerfileContent = readFileSync(dockerfilePath, "utf-8");
|
|
731
|
-
console.log(
|
|
731
|
+
console.log(pc22.cyan(`
|
|
732
732
|
\u{1F50D} Linting E2E Tester Dockerfile (${dockerfileRel})...`));
|
|
733
733
|
runStep(
|
|
734
734
|
"docker",
|
|
@@ -744,7 +744,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
|
|
|
744
744
|
const dockerfilePolicyDir = path13.resolve(absTesterDir, dockerfilePolicyRel);
|
|
745
745
|
if (existsSync(dockerfilePolicyDir)) {
|
|
746
746
|
console.log(
|
|
747
|
-
|
|
747
|
+
pc22.cyan(
|
|
748
748
|
`
|
|
749
749
|
\u{1F50D} Validating Tester Dockerfile Contract (${dockerfilePolicyRel})...`
|
|
750
750
|
)
|
|
@@ -774,7 +774,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
|
|
|
774
774
|
const composePolicyDir = path13.resolve(absTesterDir, composePolicyRel);
|
|
775
775
|
if (existsSync(composePolicyDir)) {
|
|
776
776
|
console.log(
|
|
777
|
-
|
|
777
|
+
pc22.cyan(`
|
|
778
778
|
\u{1F50D} Validating Tester Compose Contract (${composePolicyRel})...`)
|
|
779
779
|
);
|
|
780
780
|
runStep(
|
|
@@ -799,7 +799,7 @@ function checkMeshTester(mesh, meshDir = process.cwd(), options = {}) {
|
|
|
799
799
|
{ stepName: "E2E Tester Compose Contract", targetFile: composeRel }
|
|
800
800
|
);
|
|
801
801
|
}
|
|
802
|
-
console.log(
|
|
802
|
+
console.log(pc22.green(`\u2705 E2E tester configuration and contracts verified.
|
|
803
803
|
`));
|
|
804
804
|
}
|
|
805
805
|
|
|
@@ -810,8 +810,8 @@ function checkMesh(meshDir = process.cwd(), options = {}) {
|
|
|
810
810
|
checkMeshServices(mesh, absMeshDir);
|
|
811
811
|
checkMeshTester(mesh, absMeshDir, { required: Boolean(options.requireTester) });
|
|
812
812
|
console.log(
|
|
813
|
-
|
|
814
|
-
|
|
813
|
+
pc22.bold(
|
|
814
|
+
pc22.green("\n\u{1F389} All mesh infrastructure, services, and contract checks passed!\n")
|
|
815
815
|
)
|
|
816
816
|
);
|
|
817
817
|
}
|
|
@@ -1179,6 +1179,13 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
|
|
|
1179
1179
|
if (typeof value !== "string") {
|
|
1180
1180
|
return value;
|
|
1181
1181
|
}
|
|
1182
|
+
if (!options.silenceWarnings && context.includes("Tester") && value.includes(".network_url")) {
|
|
1183
|
+
console.warn(
|
|
1184
|
+
pc22.yellow(`
|
|
1185
|
+
\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)
|
|
1186
|
+
`)
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1182
1189
|
let interpolated = value;
|
|
1183
1190
|
for (const [sName, urls] of serviceUrls.entries()) {
|
|
1184
1191
|
interpolated = interpolated.replace(
|
|
@@ -1509,11 +1516,8 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
|
|
|
1509
1516
|
);
|
|
1510
1517
|
delete resolvedTester.container_name;
|
|
1511
1518
|
normalizeDependsOn(resolvedTester);
|
|
1512
|
-
resolvedTester.
|
|
1513
|
-
|
|
1514
|
-
aliases: [tKey, ...tKey === firstKey ? ["tester"] : []]
|
|
1515
|
-
}
|
|
1516
|
-
};
|
|
1519
|
+
resolvedTester.network_mode = "host";
|
|
1520
|
+
delete resolvedTester.networks;
|
|
1517
1521
|
if (tKey === firstKey) {
|
|
1518
1522
|
resolvedTester.depends_on = resolvedTester.depends_on || {};
|
|
1519
1523
|
for (const sName of Object.keys(mesh.services)) {
|
|
@@ -1841,12 +1845,12 @@ async function teardownCompose(yamlConfig, projectDir, options = {}) {
|
|
|
1841
1845
|
if (result.error) {
|
|
1842
1846
|
if (!silent) {
|
|
1843
1847
|
console.error(
|
|
1844
|
-
|
|
1848
|
+
pc22.red(`Failed to run docker compose down: ${result.error.message}`)
|
|
1845
1849
|
);
|
|
1846
1850
|
}
|
|
1847
1851
|
} else if (result.status !== 0 && !silent) {
|
|
1848
1852
|
console.error(
|
|
1849
|
-
|
|
1853
|
+
pc22.red(
|
|
1850
1854
|
`Docker compose down exited with non-zero status code: ${result.status}`
|
|
1851
1855
|
)
|
|
1852
1856
|
);
|
|
@@ -1989,7 +1993,7 @@ async function handleMeshDown(rawStage = "dev", options = {}) {
|
|
|
1989
1993
|
);
|
|
1990
1994
|
}
|
|
1991
1995
|
console.log(
|
|
1992
|
-
|
|
1996
|
+
pc22.cyan(`
|
|
1993
1997
|
\u{1F9F9} Stopping and tearing down global mesh environment [${stage}]...`)
|
|
1994
1998
|
);
|
|
1995
1999
|
if (options.debug) {
|
|
@@ -1998,7 +2002,7 @@ async function handleMeshDown(rawStage = "dev", options = {}) {
|
|
|
1998
2002
|
const includeTester = stage === "test" || stage === "test-e2e";
|
|
1999
2003
|
const { yaml } = compileMeshEnvironment(mode, meshDir, { includeTester });
|
|
2000
2004
|
console.log(
|
|
2001
|
-
|
|
2005
|
+
pc22.yellow("\nFinal merged Mesh YAML configuration:\n"),
|
|
2002
2006
|
redactYamlSecrets(yaml)
|
|
2003
2007
|
);
|
|
2004
2008
|
} catch {
|
|
@@ -2018,7 +2022,7 @@ async function handleMeshDown(rawStage = "dev", options = {}) {
|
|
|
2018
2022
|
}
|
|
2019
2023
|
clearRunState(meshDir);
|
|
2020
2024
|
console.log(
|
|
2021
|
-
|
|
2025
|
+
pc22.green(`\u2705 Global mesh environment [${stage}] stopped and removed.
|
|
2022
2026
|
`)
|
|
2023
2027
|
);
|
|
2024
2028
|
return 0;
|
|
@@ -2101,7 +2105,7 @@ async function checkHostPortCollisions(ports) {
|
|
|
2101
2105
|
const inUse = await isPortInUse(port);
|
|
2102
2106
|
if (inUse) {
|
|
2103
2107
|
console.warn(
|
|
2104
|
-
|
|
2108
|
+
pc22.yellow(
|
|
2105
2109
|
`
|
|
2106
2110
|
\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.
|
|
2107
2111
|
`
|
|
@@ -2167,22 +2171,24 @@ async function runCompose(args, yamlConfig, projectDir, options = {}) {
|
|
|
2167
2171
|
// src/core/mesh/runners/runMeshDev.ts
|
|
2168
2172
|
async function runMeshDev(options = {}) {
|
|
2169
2173
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
2170
|
-
console.log(
|
|
2174
|
+
console.log(pc22.cyan(`
|
|
2171
2175
|
\u{1F680} Starting Global DEV Mesh Environment...`));
|
|
2172
2176
|
if (!options.skipChecks) {
|
|
2173
2177
|
checkMesh(meshDir, { requireTester: false });
|
|
2174
2178
|
}
|
|
2175
|
-
const { yaml } = compileMeshEnvironment("dev", meshDir
|
|
2179
|
+
const { yaml } = compileMeshEnvironment("dev", meshDir, {
|
|
2180
|
+
silenceWarnings: options.silenceWarnings
|
|
2181
|
+
});
|
|
2176
2182
|
const parsed = parse(yaml);
|
|
2177
2183
|
const projectName = parsed?.name || "mesh-dev";
|
|
2178
2184
|
if (options.debug) {
|
|
2179
2185
|
console.log(
|
|
2180
|
-
|
|
2186
|
+
pc22.yellow("\nFinal merged Mesh Dev YAML configuration:\n"),
|
|
2181
2187
|
redactYamlSecrets(yaml)
|
|
2182
2188
|
);
|
|
2183
2189
|
}
|
|
2184
2190
|
if (options.dryRun) {
|
|
2185
|
-
console.log(
|
|
2191
|
+
console.log(pc22.green("Dry run complete. Compose was not started."));
|
|
2186
2192
|
return 0;
|
|
2187
2193
|
}
|
|
2188
2194
|
const hostPorts = extractHostPorts(yaml);
|
|
@@ -2211,22 +2217,24 @@ async function runMeshDev(options = {}) {
|
|
|
2211
2217
|
}
|
|
2212
2218
|
async function runMeshProd(options = {}) {
|
|
2213
2219
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
2214
|
-
console.log(
|
|
2220
|
+
console.log(pc22.cyan(`
|
|
2215
2221
|
\u{1F3ED} Starting Global PROD Mesh Environment...`));
|
|
2216
2222
|
if (!options.skipChecks) {
|
|
2217
2223
|
checkMesh(meshDir, { requireTester: false });
|
|
2218
2224
|
}
|
|
2219
|
-
const { yaml } = compileMeshEnvironment("prod", meshDir
|
|
2225
|
+
const { yaml } = compileMeshEnvironment("prod", meshDir, {
|
|
2226
|
+
silenceWarnings: options.silenceWarnings
|
|
2227
|
+
});
|
|
2220
2228
|
const parsed = parse(yaml);
|
|
2221
2229
|
const projectName = parsed?.name || "mesh-prod";
|
|
2222
2230
|
if (options.debug) {
|
|
2223
2231
|
console.log(
|
|
2224
|
-
|
|
2232
|
+
pc22.yellow("\nFinal merged Mesh Prod YAML configuration:\n"),
|
|
2225
2233
|
redactYamlSecrets(yaml)
|
|
2226
2234
|
);
|
|
2227
2235
|
}
|
|
2228
2236
|
if (options.dryRun) {
|
|
2229
|
-
console.log(
|
|
2237
|
+
console.log(pc22.green("Dry run complete. Compose was not started."));
|
|
2230
2238
|
return 0;
|
|
2231
2239
|
}
|
|
2232
2240
|
const hostPorts = extractHostPorts(yaml);
|
|
@@ -2554,7 +2562,7 @@ function getDockerComposeTemplate(filename) {
|
|
|
2554
2562
|
}
|
|
2555
2563
|
|
|
2556
2564
|
// src/core/compileEnvironment.ts
|
|
2557
|
-
var compileEnvironment = (environment, projectDir = process.cwd()) => {
|
|
2565
|
+
var compileEnvironment = (environment, projectDir = process.cwd(), options = {}) => {
|
|
2558
2566
|
const absProjectDir = resolveProjectDir(projectDir);
|
|
2559
2567
|
const buildJson = getBuildJson(absProjectDir);
|
|
2560
2568
|
const overrides = extractOverrides(buildJson, absProjectDir);
|
|
@@ -2637,6 +2645,7 @@ var compileEnvironment = (environment, projectDir = process.cwd()) => {
|
|
|
2637
2645
|
case "e2e": {
|
|
2638
2646
|
const prodPath = getDockerComposeTemplate("docker-compose.prod.yml");
|
|
2639
2647
|
const e2ePath = getDockerComposeTemplate("docker-compose.e2e.yml");
|
|
2648
|
+
const standalonePath = getDockerComposeTemplate("docker-compose.standalone.yml");
|
|
2640
2649
|
composeFlags.push("-f", prodPath);
|
|
2641
2650
|
filesUsed.push(prodPath);
|
|
2642
2651
|
if (overrides.prod) {
|
|
@@ -2649,6 +2658,8 @@ var compileEnvironment = (environment, projectDir = process.cwd()) => {
|
|
|
2649
2658
|
filesUsed.push(dep.path);
|
|
2650
2659
|
}
|
|
2651
2660
|
}
|
|
2661
|
+
composeFlags.push("-f", standalonePath);
|
|
2662
|
+
filesUsed.push(standalonePath);
|
|
2652
2663
|
composeFlags.push("-f", e2ePath);
|
|
2653
2664
|
filesUsed.push(e2ePath);
|
|
2654
2665
|
if (overrides.e2e) {
|
|
@@ -2713,6 +2724,13 @@ ${explanation}`);
|
|
|
2713
2724
|
});
|
|
2714
2725
|
}
|
|
2715
2726
|
const interpolateEnv = (val, context) => {
|
|
2727
|
+
if (!options.silenceWarnings && context.includes("Tester") && val.includes(".network_url")) {
|
|
2728
|
+
console.warn(
|
|
2729
|
+
pc22.yellow(`
|
|
2730
|
+
\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)
|
|
2731
|
+
`)
|
|
2732
|
+
);
|
|
2733
|
+
}
|
|
2716
2734
|
let output = val;
|
|
2717
2735
|
for (const [sName, urls] of urlRegistry.entries()) {
|
|
2718
2736
|
const escaped = sName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -2729,9 +2747,20 @@ ${explanation}`);
|
|
|
2729
2747
|
}
|
|
2730
2748
|
const unresolvedMatch = output.match(/\$\{([^}]+?)\.(network_url|public_url)\}/);
|
|
2731
2749
|
if (unresolvedMatch) {
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2750
|
+
const variable = unresolvedMatch[0];
|
|
2751
|
+
const targetService = unresolvedMatch[1];
|
|
2752
|
+
const type = unresolvedMatch[2];
|
|
2753
|
+
if (!urlRegistry.has(targetService)) {
|
|
2754
|
+
throw new ScriptError(
|
|
2755
|
+
`[${context}] Unresolved template variable: ${variable}. Check build.json dependencies.`
|
|
2756
|
+
);
|
|
2757
|
+
} else if (type === "public_url") {
|
|
2758
|
+
throw new ScriptError(
|
|
2759
|
+
`[${context}] Unresolved template variable: ${variable}. Service "${targetService}" does not expose a public port (missing 'port' explicitly defined in build.json).`
|
|
2760
|
+
);
|
|
2761
|
+
} else {
|
|
2762
|
+
throw new ScriptError(`[${context}] Unresolved template variable: ${variable}.`);
|
|
2763
|
+
}
|
|
2735
2764
|
}
|
|
2736
2765
|
return output;
|
|
2737
2766
|
};
|
|
@@ -2773,23 +2802,25 @@ ${explanation}`);
|
|
|
2773
2802
|
// src/core/runners/runTestUnit.ts
|
|
2774
2803
|
var runTestUnit = async (options) => {
|
|
2775
2804
|
if (!options.skipBanner) {
|
|
2776
|
-
console.log(
|
|
2805
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2777
2806
|
========================================`)));
|
|
2778
|
-
console.log(
|
|
2779
|
-
console.log(
|
|
2807
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} STAGE: UNIT & ISOLATED TESTS`)));
|
|
2808
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2780
2809
|
`)));
|
|
2781
2810
|
}
|
|
2782
|
-
const finalYamlConfig = compileEnvironment("test", options.projectDir
|
|
2811
|
+
const finalYamlConfig = compileEnvironment("test", options.projectDir, {
|
|
2812
|
+
silenceWarnings: options.silenceWarnings
|
|
2813
|
+
});
|
|
2783
2814
|
const parsed = parse(finalYamlConfig);
|
|
2784
2815
|
const projectName = parsed?.name || "test";
|
|
2785
2816
|
if (options.debug) {
|
|
2786
2817
|
console.log(
|
|
2787
|
-
|
|
2818
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
2788
2819
|
redactYamlSecrets(finalYamlConfig)
|
|
2789
2820
|
);
|
|
2790
2821
|
}
|
|
2791
2822
|
if (options.dryRun) {
|
|
2792
|
-
console.log(
|
|
2823
|
+
console.log(pc22.green("[DRY-RUN] Unit tests simulated. Compose was not started."));
|
|
2793
2824
|
return 0;
|
|
2794
2825
|
}
|
|
2795
2826
|
await teardownCompose(finalYamlConfig, options.projectDir, {
|
|
@@ -2814,11 +2845,11 @@ var runTestUnit = async (options) => {
|
|
|
2814
2845
|
clearRunState(options.projectDir);
|
|
2815
2846
|
}
|
|
2816
2847
|
if (status === 0) {
|
|
2817
|
-
console.log(
|
|
2848
|
+
console.log(pc22.bold(pc22.green(`
|
|
2818
2849
|
\u2705 Unit tests passed successfully.
|
|
2819
2850
|
`)));
|
|
2820
2851
|
} else {
|
|
2821
|
-
console.error(
|
|
2852
|
+
console.error(pc22.red(`
|
|
2822
2853
|
\u274C Unit tests failed with exit code ${status}.
|
|
2823
2854
|
`));
|
|
2824
2855
|
}
|
|
@@ -2826,23 +2857,25 @@ var runTestUnit = async (options) => {
|
|
|
2826
2857
|
};
|
|
2827
2858
|
var runTestE2e = async (options) => {
|
|
2828
2859
|
if (!options.skipBanner) {
|
|
2829
|
-
console.log(
|
|
2860
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2830
2861
|
========================================`)));
|
|
2831
|
-
console.log(
|
|
2832
|
-
console.log(
|
|
2862
|
+
console.log(pc22.bold(pc22.blue(`\u{1F6A6} STAGE: INTEGRATED E2E TESTS`)));
|
|
2863
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2833
2864
|
`)));
|
|
2834
2865
|
}
|
|
2835
|
-
const finalYamlConfig = compileEnvironment("e2e", options.projectDir
|
|
2866
|
+
const finalYamlConfig = compileEnvironment("e2e", options.projectDir, {
|
|
2867
|
+
silenceWarnings: options.silenceWarnings
|
|
2868
|
+
});
|
|
2836
2869
|
const parsed = parse(finalYamlConfig);
|
|
2837
2870
|
const projectName = parsed?.name || "e2e";
|
|
2838
2871
|
if (options.debug) {
|
|
2839
2872
|
console.log(
|
|
2840
|
-
|
|
2873
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
2841
2874
|
redactYamlSecrets(finalYamlConfig)
|
|
2842
2875
|
);
|
|
2843
2876
|
}
|
|
2844
2877
|
if (options.dryRun) {
|
|
2845
|
-
console.log(
|
|
2878
|
+
console.log(pc22.green("[DRY-RUN] E2E tests simulated. Compose was not started."));
|
|
2846
2879
|
return 0;
|
|
2847
2880
|
}
|
|
2848
2881
|
await teardownCompose(finalYamlConfig, options.projectDir, {
|
|
@@ -2873,11 +2906,11 @@ var runTestE2e = async (options) => {
|
|
|
2873
2906
|
clearRunState(options.projectDir);
|
|
2874
2907
|
}
|
|
2875
2908
|
if (status === 0) {
|
|
2876
|
-
console.log(
|
|
2909
|
+
console.log(pc22.bold(pc22.green(`
|
|
2877
2910
|
\u2705 E2E tests passed successfully.
|
|
2878
2911
|
`)));
|
|
2879
2912
|
} else {
|
|
2880
|
-
console.error(
|
|
2913
|
+
console.error(pc22.red(`
|
|
2881
2914
|
\u274C E2E tests failed with exit code ${status}.
|
|
2882
2915
|
`));
|
|
2883
2916
|
}
|
|
@@ -2886,15 +2919,15 @@ var runTestE2e = async (options) => {
|
|
|
2886
2919
|
|
|
2887
2920
|
// src/core/runners/runTest.ts
|
|
2888
2921
|
var runTest = async (options) => {
|
|
2889
|
-
console.log(
|
|
2922
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2890
2923
|
========================================`)));
|
|
2891
|
-
console.log(
|
|
2892
|
-
console.log(
|
|
2924
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} [1/2] STAGE: UNIT & ISOLATED TESTS`)));
|
|
2925
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2893
2926
|
`)));
|
|
2894
2927
|
const unitStatus = await runTestUnit({ ...options, skipBanner: true });
|
|
2895
2928
|
if (unitStatus !== 0) {
|
|
2896
2929
|
console.error(
|
|
2897
|
-
|
|
2930
|
+
pc22.red(
|
|
2898
2931
|
`
|
|
2899
2932
|
\u274C [1/2] Unit tests failed with exit code ${unitStatus}. Aborting E2E tests.
|
|
2900
2933
|
`
|
|
@@ -2903,29 +2936,29 @@ var runTest = async (options) => {
|
|
|
2903
2936
|
return unitStatus;
|
|
2904
2937
|
}
|
|
2905
2938
|
console.log(
|
|
2906
|
-
|
|
2939
|
+
pc22.bold(pc22.green(`
|
|
2907
2940
|
\u2705 [1/2] Unit tests passed successfully.
|
|
2908
2941
|
`))
|
|
2909
2942
|
);
|
|
2910
|
-
console.log(
|
|
2911
|
-
console.log(
|
|
2912
|
-
console.log(
|
|
2943
|
+
console.log(pc22.bold(pc22.blue(`========================================`)));
|
|
2944
|
+
console.log(pc22.bold(pc22.blue(`\u{1F6A6} [2/2] STAGE: INTEGRATED E2E TESTS`)));
|
|
2945
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2913
2946
|
`)));
|
|
2914
2947
|
const e2eStatus = await runTestE2e({ ...options, skipBanner: true });
|
|
2915
2948
|
if (e2eStatus !== 0) {
|
|
2916
2949
|
console.error(
|
|
2917
|
-
|
|
2950
|
+
pc22.red(`
|
|
2918
2951
|
\u274C [2/2] E2E tests failed with exit code ${e2eStatus}.
|
|
2919
2952
|
`)
|
|
2920
2953
|
);
|
|
2921
2954
|
return e2eStatus;
|
|
2922
2955
|
}
|
|
2923
|
-
console.log(
|
|
2956
|
+
console.log(pc22.bold(pc22.green(`
|
|
2924
2957
|
\u2705 [2/2] E2E tests passed successfully.
|
|
2925
2958
|
`)));
|
|
2926
2959
|
console.log(
|
|
2927
|
-
|
|
2928
|
-
|
|
2960
|
+
pc22.bold(
|
|
2961
|
+
pc22.green(`\u{1F389} All test stages (unit + e2e) completed successfully!
|
|
2929
2962
|
`)
|
|
2930
2963
|
)
|
|
2931
2964
|
);
|
|
@@ -2933,16 +2966,17 @@ var runTest = async (options) => {
|
|
|
2933
2966
|
};
|
|
2934
2967
|
async function runMeshTestE2e(options = {}) {
|
|
2935
2968
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
2936
|
-
console.log(
|
|
2969
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2937
2970
|
========================================`)));
|
|
2938
|
-
console.log(
|
|
2939
|
-
console.log(
|
|
2971
|
+
console.log(pc22.bold(pc22.blue(`\u{1F6A6} [MESH] STAGE: GLOBAL INTEGRATED E2E TESTS`)));
|
|
2972
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2940
2973
|
`)));
|
|
2941
2974
|
if (!options.skipChecks) {
|
|
2942
2975
|
checkMesh(meshDir, { requireTester: true });
|
|
2943
2976
|
}
|
|
2944
2977
|
const { yaml, testerServiceName } = compileMeshEnvironment("prod", meshDir, {
|
|
2945
|
-
includeTester: true
|
|
2978
|
+
includeTester: true,
|
|
2979
|
+
silenceWarnings: options.silenceWarnings
|
|
2946
2980
|
});
|
|
2947
2981
|
if (!testerServiceName) {
|
|
2948
2982
|
throw new ScriptError(
|
|
@@ -2951,12 +2985,12 @@ async function runMeshTestE2e(options = {}) {
|
|
|
2951
2985
|
}
|
|
2952
2986
|
if (options.debug) {
|
|
2953
2987
|
console.log(
|
|
2954
|
-
|
|
2988
|
+
pc22.yellow("\nFinal merged Mesh E2E YAML configuration:\n"),
|
|
2955
2989
|
redactYamlSecrets(yaml)
|
|
2956
2990
|
);
|
|
2957
2991
|
}
|
|
2958
2992
|
if (options.dryRun) {
|
|
2959
|
-
console.log(
|
|
2993
|
+
console.log(pc22.green("[DRY-RUN] Global E2E test simulated. Compose was not started."));
|
|
2960
2994
|
return 0;
|
|
2961
2995
|
}
|
|
2962
2996
|
const parsed = parse(yaml);
|
|
@@ -2982,16 +3016,16 @@ async function runMeshTestE2e(options = {}) {
|
|
|
2982
3016
|
{ removeVolumes: true }
|
|
2983
3017
|
);
|
|
2984
3018
|
} finally {
|
|
2985
|
-
console.log(
|
|
3019
|
+
console.log(pc22.cyan("\n\u{1F9F9} Cleaning up global mesh containers and volumes..."));
|
|
2986
3020
|
await teardownCompose(yaml, meshDir, { removeVolumes: true });
|
|
2987
3021
|
clearRunState(meshDir);
|
|
2988
3022
|
}
|
|
2989
3023
|
if (status === 0) {
|
|
2990
|
-
console.log(
|
|
3024
|
+
console.log(pc22.bold(pc22.green(`
|
|
2991
3025
|
\u2705 Global E2E tests passed successfully.
|
|
2992
3026
|
`)));
|
|
2993
3027
|
} else {
|
|
2994
|
-
console.error(
|
|
3028
|
+
console.error(pc22.red(`
|
|
2995
3029
|
\u274C Global E2E tests failed with exit code ${status}.
|
|
2996
3030
|
`));
|
|
2997
3031
|
}
|
|
@@ -3001,44 +3035,45 @@ async function runMeshTestE2e(options = {}) {
|
|
|
3001
3035
|
// src/core/mesh/runners/runMeshTest.ts
|
|
3002
3036
|
async function runMeshTest(options = {}) {
|
|
3003
3037
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
3004
|
-
console.log(
|
|
3038
|
+
console.log(pc22.bold(pc22.blue(`
|
|
3005
3039
|
========================================`)));
|
|
3006
|
-
console.log(
|
|
3007
|
-
console.log(
|
|
3040
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} GLOBAL MESH TEST PIPELINE`)));
|
|
3041
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3008
3042
|
`)));
|
|
3009
3043
|
if (!options.skipChecks) {
|
|
3010
3044
|
checkMesh(meshDir, { requireTester: true });
|
|
3011
3045
|
}
|
|
3012
3046
|
const mesh = getMeshJson(meshDir);
|
|
3013
|
-
console.log(
|
|
3047
|
+
console.log(pc22.bold(pc22.blue(`
|
|
3014
3048
|
========================================`)));
|
|
3015
3049
|
console.log(
|
|
3016
|
-
|
|
3017
|
-
|
|
3050
|
+
pc22.bold(
|
|
3051
|
+
pc22.blue(`\u{1F9EA} [1/2] STAGE: LOCAL SUBMODULE TEST SUITES (Unit & Isolated E2E)`)
|
|
3018
3052
|
)
|
|
3019
3053
|
);
|
|
3020
|
-
console.log(
|
|
3054
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3021
3055
|
`)));
|
|
3022
3056
|
for (const [serviceName, serviceConfig] of Object.entries(mesh.services)) {
|
|
3023
3057
|
const serviceDir = path13.resolve(meshDir, serviceConfig.path);
|
|
3024
3058
|
console.log(
|
|
3025
|
-
|
|
3059
|
+
pc22.bold(pc22.cyan(`
|
|
3026
3060
|
-> Running full test suite for [${serviceName}] in isolation...`))
|
|
3027
3061
|
);
|
|
3028
3062
|
if (options.dryRun) {
|
|
3029
3063
|
console.log(
|
|
3030
|
-
|
|
3064
|
+
pc22.green(`[DRY-RUN] Full isolated tests for ${serviceName} simulated.`)
|
|
3031
3065
|
);
|
|
3032
3066
|
continue;
|
|
3033
3067
|
}
|
|
3034
3068
|
const serviceStatus = await runTest({
|
|
3035
3069
|
projectDir: serviceDir,
|
|
3036
3070
|
debug: Boolean(options.debug),
|
|
3037
|
-
detach: Boolean(options.detach)
|
|
3071
|
+
detach: Boolean(options.detach),
|
|
3072
|
+
silenceWarnings: options.silenceWarnings
|
|
3038
3073
|
});
|
|
3039
3074
|
if (serviceStatus !== 0) {
|
|
3040
3075
|
console.error(
|
|
3041
|
-
|
|
3076
|
+
pc22.red(
|
|
3042
3077
|
`
|
|
3043
3078
|
\u274C Isolated tests failed for service [${serviceName}] with exit code ${serviceStatus}. Aborting global E2E tests.
|
|
3044
3079
|
`
|
|
@@ -3047,27 +3082,27 @@ async function runMeshTest(options = {}) {
|
|
|
3047
3082
|
return serviceStatus;
|
|
3048
3083
|
}
|
|
3049
3084
|
console.log(
|
|
3050
|
-
|
|
3085
|
+
pc22.bold(pc22.green(`
|
|
3051
3086
|
\u2705 Isolated tests passed for service: [${serviceName}]
|
|
3052
3087
|
`))
|
|
3053
3088
|
);
|
|
3054
3089
|
}
|
|
3055
|
-
console.log(
|
|
3090
|
+
console.log(pc22.bold(pc22.blue(`
|
|
3056
3091
|
========================================`)));
|
|
3057
3092
|
console.log(
|
|
3058
|
-
|
|
3059
|
-
|
|
3093
|
+
pc22.bold(
|
|
3094
|
+
pc22.blue(`\u{1F6A6} [2/2] STAGE: INTEGRATED PRODUCTION MESH & GLOBAL E2E ASSERTIONS`)
|
|
3060
3095
|
)
|
|
3061
3096
|
);
|
|
3062
|
-
console.log(
|
|
3097
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3063
3098
|
`)));
|
|
3064
3099
|
const e2eStatus = await runMeshTestE2e({ ...options, skipChecks: true });
|
|
3065
3100
|
if (e2eStatus !== 0) {
|
|
3066
3101
|
return e2eStatus;
|
|
3067
3102
|
}
|
|
3068
3103
|
console.log(
|
|
3069
|
-
|
|
3070
|
-
|
|
3104
|
+
pc22.bold(
|
|
3105
|
+
pc22.green(`\u{1F389} Entire global mesh test pipeline (unit, local e2e, and global e2e) completed successfully!
|
|
3071
3106
|
`)
|
|
3072
3107
|
)
|
|
3073
3108
|
);
|
|
@@ -3075,10 +3110,10 @@ async function runMeshTest(options = {}) {
|
|
|
3075
3110
|
}
|
|
3076
3111
|
async function runMeshTestUnit(options = {}) {
|
|
3077
3112
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
3078
|
-
console.log(
|
|
3113
|
+
console.log(pc22.bold(pc22.blue(`
|
|
3079
3114
|
========================================`)));
|
|
3080
|
-
console.log(
|
|
3081
|
-
console.log(
|
|
3115
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} [MESH] STAGE: ISOLATED UNIT TESTS`)));
|
|
3116
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3082
3117
|
`)));
|
|
3083
3118
|
if (!options.skipChecks) {
|
|
3084
3119
|
checkMesh(meshDir, { requireTester: false });
|
|
@@ -3087,11 +3122,11 @@ async function runMeshTestUnit(options = {}) {
|
|
|
3087
3122
|
for (const [serviceName, serviceConfig] of Object.entries(mesh.services)) {
|
|
3088
3123
|
const serviceDir = path13.resolve(meshDir, serviceConfig.path);
|
|
3089
3124
|
console.log(
|
|
3090
|
-
|
|
3125
|
+
pc22.cyan(`
|
|
3091
3126
|
-> Running isolated unit tests for service: [${serviceName}]...`)
|
|
3092
3127
|
);
|
|
3093
3128
|
if (options.dryRun) {
|
|
3094
|
-
console.log(
|
|
3129
|
+
console.log(pc22.green(`[DRY-RUN] Unit tests for ${serviceName} simulated.`));
|
|
3095
3130
|
continue;
|
|
3096
3131
|
}
|
|
3097
3132
|
const unitStatus = await runTestUnit({
|
|
@@ -3102,20 +3137,20 @@ async function runMeshTestUnit(options = {}) {
|
|
|
3102
3137
|
});
|
|
3103
3138
|
if (unitStatus !== 0) {
|
|
3104
3139
|
console.error(
|
|
3105
|
-
|
|
3140
|
+
pc22.red(`
|
|
3106
3141
|
\u274C Unit tests failed for service [${serviceName}] with exit code ${unitStatus}.
|
|
3107
3142
|
`)
|
|
3108
3143
|
);
|
|
3109
3144
|
return unitStatus;
|
|
3110
3145
|
}
|
|
3111
3146
|
console.log(
|
|
3112
|
-
|
|
3147
|
+
pc22.bold(pc22.green(`
|
|
3113
3148
|
\u2705 Isolated unit tests passed for service: [${serviceName}]
|
|
3114
3149
|
`))
|
|
3115
3150
|
);
|
|
3116
3151
|
}
|
|
3117
3152
|
console.log(
|
|
3118
|
-
|
|
3153
|
+
pc22.bold(pc22.green(`\u{1F389} All mesh service unit tests completed successfully!
|
|
3119
3154
|
`))
|
|
3120
3155
|
);
|
|
3121
3156
|
return 0;
|
|
@@ -3157,6 +3192,9 @@ var registerMeshUpCommand = (cmd) => {
|
|
|
3157
3192
|
).option(
|
|
3158
3193
|
"--skip-checks",
|
|
3159
3194
|
"Skip hadolint and conftest pre-flight checks"
|
|
3195
|
+
).option(
|
|
3196
|
+
"--silence-warnings",
|
|
3197
|
+
"Silence non-critical warnings like URL templating hints"
|
|
3160
3198
|
).option(
|
|
3161
3199
|
"-C, --project-dir <dir>",
|
|
3162
3200
|
"Mesh project directory containing mesh.json (defaults to cwd)"
|
|
@@ -3176,7 +3214,8 @@ Examples:
|
|
|
3176
3214
|
debug: options.debug,
|
|
3177
3215
|
detach: options.detach,
|
|
3178
3216
|
dryRun: options.dryRun,
|
|
3179
|
-
skipChecks: options.skipChecks
|
|
3217
|
+
skipChecks: options.skipChecks,
|
|
3218
|
+
silenceWarnings: options.silenceWarnings
|
|
3180
3219
|
});
|
|
3181
3220
|
if (exitCode !== 0) {
|
|
3182
3221
|
process.exit(exitCode);
|
|
@@ -3196,7 +3235,7 @@ var registerMeshCommand = (program) => {
|
|
|
3196
3235
|
registerMeshCheckCommand(meshCmd);
|
|
3197
3236
|
};
|
|
3198
3237
|
async function handlePrune(options = {}) {
|
|
3199
|
-
console.log(
|
|
3238
|
+
console.log(pc22.cyan("\n\u{1F9F9} Pruning stopped Compose containers and unused networks..."));
|
|
3200
3239
|
const rmContainers = spawnSync("docker", ["container", "prune", "-f"], {
|
|
3201
3240
|
stdio: "inherit",
|
|
3202
3241
|
encoding: "utf-8"
|
|
@@ -3216,13 +3255,13 @@ async function handlePrune(options = {}) {
|
|
|
3216
3255
|
});
|
|
3217
3256
|
}
|
|
3218
3257
|
if (options.volumes) {
|
|
3219
|
-
console.log(
|
|
3258
|
+
console.log(pc22.cyan("\u{1F9F9} Pruning dangling volumes..."));
|
|
3220
3259
|
spawnSync("docker", ["volume", "prune", "-f"], {
|
|
3221
3260
|
stdio: "inherit",
|
|
3222
3261
|
encoding: "utf-8"
|
|
3223
3262
|
});
|
|
3224
3263
|
}
|
|
3225
|
-
console.log(
|
|
3264
|
+
console.log(pc22.green("\u2705 Docker environment pruned successfully.\n"));
|
|
3226
3265
|
return 0;
|
|
3227
3266
|
}
|
|
3228
3267
|
|
|
@@ -3247,7 +3286,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
|
|
|
3247
3286
|
);
|
|
3248
3287
|
}
|
|
3249
3288
|
console.log(
|
|
3250
|
-
|
|
3289
|
+
pc22.cyan(`
|
|
3251
3290
|
\u{1F9F9} Stopping and tearing down service environment [${stage}]...`)
|
|
3252
3291
|
);
|
|
3253
3292
|
if (options.debug) {
|
|
@@ -3258,7 +3297,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
|
|
|
3258
3297
|
else if (stage === "test-e2e") env = "e2e";
|
|
3259
3298
|
const finalYamlConfig = compileEnvironment(env, projectDir);
|
|
3260
3299
|
console.log(
|
|
3261
|
-
|
|
3300
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
3262
3301
|
redactYamlSecrets(finalYamlConfig)
|
|
3263
3302
|
);
|
|
3264
3303
|
} catch {
|
|
@@ -3278,7 +3317,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
|
|
|
3278
3317
|
}
|
|
3279
3318
|
clearRunState(projectDir);
|
|
3280
3319
|
console.log(
|
|
3281
|
-
|
|
3320
|
+
pc22.green(`\u2705 Service environment [${stage}] stopped and removed.
|
|
3282
3321
|
`)
|
|
3283
3322
|
);
|
|
3284
3323
|
return 0;
|
|
@@ -3316,18 +3355,20 @@ Examples:
|
|
|
3316
3355
|
);
|
|
3317
3356
|
};
|
|
3318
3357
|
var runDev = async (options) => {
|
|
3319
|
-
console.log(
|
|
3320
|
-
const finalYamlConfig = compileEnvironment("dev", options.projectDir
|
|
3358
|
+
console.log(pc22.cyan(`\u{1F680} Starting DEV environment...`));
|
|
3359
|
+
const finalYamlConfig = compileEnvironment("dev", options.projectDir, {
|
|
3360
|
+
silenceWarnings: options.silenceWarnings
|
|
3361
|
+
});
|
|
3321
3362
|
const parsed = parse(finalYamlConfig);
|
|
3322
3363
|
const projectName = parsed?.name || "dev";
|
|
3323
3364
|
if (options.debug) {
|
|
3324
3365
|
console.log(
|
|
3325
|
-
|
|
3366
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
3326
3367
|
redactYamlSecrets(finalYamlConfig)
|
|
3327
3368
|
);
|
|
3328
3369
|
}
|
|
3329
3370
|
if (options.dryRun) {
|
|
3330
|
-
console.log(
|
|
3371
|
+
console.log(pc22.green("Dry run complete. Compose was not started."));
|
|
3331
3372
|
return 0;
|
|
3332
3373
|
}
|
|
3333
3374
|
const hostPorts = extractHostPorts(finalYamlConfig);
|
|
@@ -3357,18 +3398,20 @@ var runDev = async (options) => {
|
|
|
3357
3398
|
return status;
|
|
3358
3399
|
};
|
|
3359
3400
|
var runProd = async (options) => {
|
|
3360
|
-
console.log(
|
|
3361
|
-
const finalYamlConfig = compileEnvironment("prod", options.projectDir
|
|
3401
|
+
console.log(pc22.cyan(`\u{1F3ED} Starting PROD environment...`));
|
|
3402
|
+
const finalYamlConfig = compileEnvironment("prod", options.projectDir, {
|
|
3403
|
+
silenceWarnings: options.silenceWarnings
|
|
3404
|
+
});
|
|
3362
3405
|
const parsed = parse(finalYamlConfig);
|
|
3363
3406
|
const projectName = parsed?.name || "prod";
|
|
3364
3407
|
if (options.debug) {
|
|
3365
3408
|
console.log(
|
|
3366
|
-
|
|
3409
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
3367
3410
|
redactYamlSecrets(finalYamlConfig)
|
|
3368
3411
|
);
|
|
3369
3412
|
}
|
|
3370
3413
|
if (options.dryRun) {
|
|
3371
|
-
console.log(
|
|
3414
|
+
console.log(pc22.green("Dry run complete. Compose was not started."));
|
|
3372
3415
|
return 0;
|
|
3373
3416
|
}
|
|
3374
3417
|
const hostPorts = extractHostPorts(finalYamlConfig);
|
|
@@ -3406,7 +3449,8 @@ async function handleServiceUp(rawStage, options = {}) {
|
|
|
3406
3449
|
projectDir,
|
|
3407
3450
|
debug: Boolean(options.debug),
|
|
3408
3451
|
detach: Boolean(options.detach),
|
|
3409
|
-
dryRun: Boolean(options.dryRun)
|
|
3452
|
+
dryRun: Boolean(options.dryRun),
|
|
3453
|
+
silenceWarnings: Boolean(options.silenceWarnings)
|
|
3410
3454
|
};
|
|
3411
3455
|
if (stage === "dev") {
|
|
3412
3456
|
return await runDev(runOptions);
|
|
@@ -3438,6 +3482,9 @@ var registerUpCommand = (cmd) => {
|
|
|
3438
3482
|
).option(
|
|
3439
3483
|
"--skip-checks",
|
|
3440
3484
|
"Skip hadolint and conftest pre-flight checks"
|
|
3485
|
+
).option(
|
|
3486
|
+
"--silence-warnings",
|
|
3487
|
+
"Silence non-critical warnings like URL templating hints"
|
|
3441
3488
|
).option(
|
|
3442
3489
|
"-C, --project-dir <dir>",
|
|
3443
3490
|
"Service project directory (defaults to cwd)"
|
|
@@ -3457,7 +3504,8 @@ Examples:
|
|
|
3457
3504
|
debug: options.debug,
|
|
3458
3505
|
detach: options.detach,
|
|
3459
3506
|
dryRun: options.dryRun,
|
|
3460
|
-
skipChecks: options.skipChecks
|
|
3507
|
+
skipChecks: options.skipChecks,
|
|
3508
|
+
silenceWarnings: options.silenceWarnings
|
|
3461
3509
|
});
|
|
3462
3510
|
if (exitCode !== 0) {
|
|
3463
3511
|
process.exit(exitCode);
|
|
@@ -3510,10 +3558,10 @@ async function runCli(argv = process.argv) {
|
|
|
3510
3558
|
(arg) => arg === "-h" || arg === "--help" || arg === "-V" || arg === "--version"
|
|
3511
3559
|
);
|
|
3512
3560
|
if (!isHelpOrVersion && argv.length > 2) {
|
|
3513
|
-
console.log(
|
|
3561
|
+
console.log(pc22.dim(`builder v${version}`));
|
|
3514
3562
|
}
|
|
3515
3563
|
if (argv.length <= 2) {
|
|
3516
|
-
console.log(
|
|
3564
|
+
console.log(pc22.dim(`builder v${version}
|
|
3517
3565
|
`));
|
|
3518
3566
|
cli.outputHelp();
|
|
3519
3567
|
return;
|
|
@@ -3536,20 +3584,20 @@ async function runCli(argv = process.argv) {
|
|
|
3536
3584
|
if (err instanceof ScriptError) {
|
|
3537
3585
|
exitCode = err.exitCode;
|
|
3538
3586
|
const formatted = err.message.startsWith("\u274C") ? err.message : `\u274C ${err.message}`;
|
|
3539
|
-
console.error(
|
|
3587
|
+
console.error(pc22.red(`
|
|
3540
3588
|
${formatted}
|
|
3541
3589
|
`));
|
|
3542
3590
|
if (isVerbose && err.stack) {
|
|
3543
|
-
console.error(
|
|
3591
|
+
console.error(pc22.dim(err.stack));
|
|
3544
3592
|
}
|
|
3545
3593
|
} else {
|
|
3546
3594
|
const message = errorMessage(err);
|
|
3547
3595
|
const formatted = message.startsWith("\u274C") ? message : `\u274C Error: ${message}`;
|
|
3548
|
-
console.error(
|
|
3596
|
+
console.error(pc22.red(`
|
|
3549
3597
|
${formatted}
|
|
3550
3598
|
`));
|
|
3551
3599
|
if (isVerbose && err instanceof Error && err.stack) {
|
|
3552
|
-
console.error(
|
|
3600
|
+
console.error(pc22.dim(err.stack));
|
|
3553
3601
|
}
|
|
3554
3602
|
}
|
|
3555
3603
|
if (process.env.VITEST) {
|