@solid-stack/builder 1.1.1 → 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 +220 -163
- 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/buildSchema.d.ts +3 -0
- package/dist/core/buildSchema.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 +221 -163
- package/dist/index.js.map +1 -1
- package/dist/templates/docker/docker-compose.e2e.yml +2 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/build-schema.json +7 -0
- 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) {
|
|
@@ -2696,49 +2707,67 @@ ${explanation}`);
|
|
|
2696
2707
|
if (environment === "e2e") {
|
|
2697
2708
|
makeE2eDependOnApp(yml);
|
|
2698
2709
|
}
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2710
|
+
const INTERNAL_PORT = 3e3;
|
|
2711
|
+
const urlRegistry = /* @__PURE__ */ new Map();
|
|
2712
|
+
const appPublicPort = buildJson.port ? Number(buildJson.port) : null;
|
|
2713
|
+
urlRegistry.set("app", {
|
|
2714
|
+
networkUrl: `http://app:${INTERNAL_PORT}`,
|
|
2715
|
+
publicUrl: appPublicPort ? `http://localhost:${appPublicPort}` : null
|
|
2716
|
+
});
|
|
2717
|
+
if (buildJson.name && buildJson.name !== "app") {
|
|
2718
|
+
urlRegistry.set(buildJson.name, urlRegistry.get("app"));
|
|
2719
|
+
}
|
|
2720
|
+
for (const dep of dependencies) {
|
|
2721
|
+
urlRegistry.set(dep.name, {
|
|
2722
|
+
networkUrl: `http://${dep.name}:${INTERNAL_PORT}`,
|
|
2723
|
+
publicUrl: null
|
|
2706
2724
|
});
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2725
|
+
}
|
|
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
|
+
);
|
|
2715
2733
|
}
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2734
|
+
let output = val;
|
|
2735
|
+
for (const [sName, urls] of urlRegistry.entries()) {
|
|
2736
|
+
const escaped = sName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2737
|
+
output = output.replace(
|
|
2738
|
+
new RegExp(`\\$\\{${escaped}\\.network_url\\}`, "g"),
|
|
2739
|
+
urls.networkUrl
|
|
2740
|
+
);
|
|
2741
|
+
if (urls.publicUrl) {
|
|
2720
2742
|
output = output.replace(
|
|
2721
|
-
new RegExp(`\\$\\{${escaped}\\.
|
|
2722
|
-
urls.
|
|
2743
|
+
new RegExp(`\\$\\{${escaped}\\.public_url\\}`, "g"),
|
|
2744
|
+
urls.publicUrl
|
|
2723
2745
|
);
|
|
2724
|
-
if (urls.publicUrl) {
|
|
2725
|
-
output = output.replace(
|
|
2726
|
-
new RegExp(`\\$\\{${escaped}\\.public_url\\}`, "g"),
|
|
2727
|
-
urls.publicUrl
|
|
2728
|
-
);
|
|
2729
|
-
}
|
|
2730
2746
|
}
|
|
2731
|
-
|
|
2732
|
-
|
|
2747
|
+
}
|
|
2748
|
+
const unresolvedMatch = output.match(/\$\{([^}]+?)\.(network_url|public_url)\}/);
|
|
2749
|
+
if (unresolvedMatch) {
|
|
2750
|
+
const variable = unresolvedMatch[0];
|
|
2751
|
+
const targetService = unresolvedMatch[1];
|
|
2752
|
+
const type = unresolvedMatch[2];
|
|
2753
|
+
if (!urlRegistry.has(targetService)) {
|
|
2733
2754
|
throw new ScriptError(
|
|
2734
|
-
`[
|
|
2755
|
+
`[${context}] Unresolved template variable: ${variable}. Check build.json dependencies.`
|
|
2735
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}.`);
|
|
2736
2763
|
}
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2764
|
+
}
|
|
2765
|
+
return output;
|
|
2766
|
+
};
|
|
2767
|
+
const normalizeEnvironment = (serviceConfig) => {
|
|
2768
|
+
if (Array.isArray(serviceConfig.environment)) {
|
|
2740
2769
|
const envObj = {};
|
|
2741
|
-
for (const item of
|
|
2770
|
+
for (const item of serviceConfig.environment) {
|
|
2742
2771
|
if (typeof item === "string") {
|
|
2743
2772
|
const eqIdx = item.indexOf("=");
|
|
2744
2773
|
if (eqIdx !== -1) {
|
|
@@ -2748,12 +2777,21 @@ ${explanation}`);
|
|
|
2748
2777
|
}
|
|
2749
2778
|
}
|
|
2750
2779
|
}
|
|
2751
|
-
|
|
2752
|
-
} else if (!
|
|
2753
|
-
|
|
2780
|
+
serviceConfig.environment = envObj;
|
|
2781
|
+
} else if (!serviceConfig.environment || typeof serviceConfig.environment !== "object") {
|
|
2782
|
+
serviceConfig.environment = {};
|
|
2783
|
+
}
|
|
2784
|
+
};
|
|
2785
|
+
if (buildJson.envOverrides && yml.services && yml.services.app) {
|
|
2786
|
+
normalizeEnvironment(yml.services.app);
|
|
2787
|
+
for (const [k, v] of Object.entries(buildJson.envOverrides)) {
|
|
2788
|
+
yml.services.app.environment[k] = interpolateEnv(v, "App EnvOverrides");
|
|
2754
2789
|
}
|
|
2790
|
+
}
|
|
2791
|
+
if (buildJson.tester?.envOverrides && yml.services && yml.services.tester) {
|
|
2792
|
+
normalizeEnvironment(yml.services.tester);
|
|
2755
2793
|
for (const [k, v] of Object.entries(buildJson.tester.envOverrides)) {
|
|
2756
|
-
yml.services.tester.environment[k] = interpolateEnv(v);
|
|
2794
|
+
yml.services.tester.environment[k] = interpolateEnv(v, "Tester EnvOverrides");
|
|
2757
2795
|
}
|
|
2758
2796
|
}
|
|
2759
2797
|
attachName(yml, projectName);
|
|
@@ -2764,23 +2802,25 @@ ${explanation}`);
|
|
|
2764
2802
|
// src/core/runners/runTestUnit.ts
|
|
2765
2803
|
var runTestUnit = async (options) => {
|
|
2766
2804
|
if (!options.skipBanner) {
|
|
2767
|
-
console.log(
|
|
2805
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2768
2806
|
========================================`)));
|
|
2769
|
-
console.log(
|
|
2770
|
-
console.log(
|
|
2807
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} STAGE: UNIT & ISOLATED TESTS`)));
|
|
2808
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2771
2809
|
`)));
|
|
2772
2810
|
}
|
|
2773
|
-
const finalYamlConfig = compileEnvironment("test", options.projectDir
|
|
2811
|
+
const finalYamlConfig = compileEnvironment("test", options.projectDir, {
|
|
2812
|
+
silenceWarnings: options.silenceWarnings
|
|
2813
|
+
});
|
|
2774
2814
|
const parsed = parse(finalYamlConfig);
|
|
2775
2815
|
const projectName = parsed?.name || "test";
|
|
2776
2816
|
if (options.debug) {
|
|
2777
2817
|
console.log(
|
|
2778
|
-
|
|
2818
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
2779
2819
|
redactYamlSecrets(finalYamlConfig)
|
|
2780
2820
|
);
|
|
2781
2821
|
}
|
|
2782
2822
|
if (options.dryRun) {
|
|
2783
|
-
console.log(
|
|
2823
|
+
console.log(pc22.green("[DRY-RUN] Unit tests simulated. Compose was not started."));
|
|
2784
2824
|
return 0;
|
|
2785
2825
|
}
|
|
2786
2826
|
await teardownCompose(finalYamlConfig, options.projectDir, {
|
|
@@ -2805,11 +2845,11 @@ var runTestUnit = async (options) => {
|
|
|
2805
2845
|
clearRunState(options.projectDir);
|
|
2806
2846
|
}
|
|
2807
2847
|
if (status === 0) {
|
|
2808
|
-
console.log(
|
|
2848
|
+
console.log(pc22.bold(pc22.green(`
|
|
2809
2849
|
\u2705 Unit tests passed successfully.
|
|
2810
2850
|
`)));
|
|
2811
2851
|
} else {
|
|
2812
|
-
console.error(
|
|
2852
|
+
console.error(pc22.red(`
|
|
2813
2853
|
\u274C Unit tests failed with exit code ${status}.
|
|
2814
2854
|
`));
|
|
2815
2855
|
}
|
|
@@ -2817,23 +2857,25 @@ var runTestUnit = async (options) => {
|
|
|
2817
2857
|
};
|
|
2818
2858
|
var runTestE2e = async (options) => {
|
|
2819
2859
|
if (!options.skipBanner) {
|
|
2820
|
-
console.log(
|
|
2860
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2821
2861
|
========================================`)));
|
|
2822
|
-
console.log(
|
|
2823
|
-
console.log(
|
|
2862
|
+
console.log(pc22.bold(pc22.blue(`\u{1F6A6} STAGE: INTEGRATED E2E TESTS`)));
|
|
2863
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2824
2864
|
`)));
|
|
2825
2865
|
}
|
|
2826
|
-
const finalYamlConfig = compileEnvironment("e2e", options.projectDir
|
|
2866
|
+
const finalYamlConfig = compileEnvironment("e2e", options.projectDir, {
|
|
2867
|
+
silenceWarnings: options.silenceWarnings
|
|
2868
|
+
});
|
|
2827
2869
|
const parsed = parse(finalYamlConfig);
|
|
2828
2870
|
const projectName = parsed?.name || "e2e";
|
|
2829
2871
|
if (options.debug) {
|
|
2830
2872
|
console.log(
|
|
2831
|
-
|
|
2873
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
2832
2874
|
redactYamlSecrets(finalYamlConfig)
|
|
2833
2875
|
);
|
|
2834
2876
|
}
|
|
2835
2877
|
if (options.dryRun) {
|
|
2836
|
-
console.log(
|
|
2878
|
+
console.log(pc22.green("[DRY-RUN] E2E tests simulated. Compose was not started."));
|
|
2837
2879
|
return 0;
|
|
2838
2880
|
}
|
|
2839
2881
|
await teardownCompose(finalYamlConfig, options.projectDir, {
|
|
@@ -2864,11 +2906,11 @@ var runTestE2e = async (options) => {
|
|
|
2864
2906
|
clearRunState(options.projectDir);
|
|
2865
2907
|
}
|
|
2866
2908
|
if (status === 0) {
|
|
2867
|
-
console.log(
|
|
2909
|
+
console.log(pc22.bold(pc22.green(`
|
|
2868
2910
|
\u2705 E2E tests passed successfully.
|
|
2869
2911
|
`)));
|
|
2870
2912
|
} else {
|
|
2871
|
-
console.error(
|
|
2913
|
+
console.error(pc22.red(`
|
|
2872
2914
|
\u274C E2E tests failed with exit code ${status}.
|
|
2873
2915
|
`));
|
|
2874
2916
|
}
|
|
@@ -2877,15 +2919,15 @@ var runTestE2e = async (options) => {
|
|
|
2877
2919
|
|
|
2878
2920
|
// src/core/runners/runTest.ts
|
|
2879
2921
|
var runTest = async (options) => {
|
|
2880
|
-
console.log(
|
|
2922
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2881
2923
|
========================================`)));
|
|
2882
|
-
console.log(
|
|
2883
|
-
console.log(
|
|
2924
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} [1/2] STAGE: UNIT & ISOLATED TESTS`)));
|
|
2925
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2884
2926
|
`)));
|
|
2885
2927
|
const unitStatus = await runTestUnit({ ...options, skipBanner: true });
|
|
2886
2928
|
if (unitStatus !== 0) {
|
|
2887
2929
|
console.error(
|
|
2888
|
-
|
|
2930
|
+
pc22.red(
|
|
2889
2931
|
`
|
|
2890
2932
|
\u274C [1/2] Unit tests failed with exit code ${unitStatus}. Aborting E2E tests.
|
|
2891
2933
|
`
|
|
@@ -2894,29 +2936,29 @@ var runTest = async (options) => {
|
|
|
2894
2936
|
return unitStatus;
|
|
2895
2937
|
}
|
|
2896
2938
|
console.log(
|
|
2897
|
-
|
|
2939
|
+
pc22.bold(pc22.green(`
|
|
2898
2940
|
\u2705 [1/2] Unit tests passed successfully.
|
|
2899
2941
|
`))
|
|
2900
2942
|
);
|
|
2901
|
-
console.log(
|
|
2902
|
-
console.log(
|
|
2903
|
-
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(`========================================
|
|
2904
2946
|
`)));
|
|
2905
2947
|
const e2eStatus = await runTestE2e({ ...options, skipBanner: true });
|
|
2906
2948
|
if (e2eStatus !== 0) {
|
|
2907
2949
|
console.error(
|
|
2908
|
-
|
|
2950
|
+
pc22.red(`
|
|
2909
2951
|
\u274C [2/2] E2E tests failed with exit code ${e2eStatus}.
|
|
2910
2952
|
`)
|
|
2911
2953
|
);
|
|
2912
2954
|
return e2eStatus;
|
|
2913
2955
|
}
|
|
2914
|
-
console.log(
|
|
2956
|
+
console.log(pc22.bold(pc22.green(`
|
|
2915
2957
|
\u2705 [2/2] E2E tests passed successfully.
|
|
2916
2958
|
`)));
|
|
2917
2959
|
console.log(
|
|
2918
|
-
|
|
2919
|
-
|
|
2960
|
+
pc22.bold(
|
|
2961
|
+
pc22.green(`\u{1F389} All test stages (unit + e2e) completed successfully!
|
|
2920
2962
|
`)
|
|
2921
2963
|
)
|
|
2922
2964
|
);
|
|
@@ -2924,16 +2966,17 @@ var runTest = async (options) => {
|
|
|
2924
2966
|
};
|
|
2925
2967
|
async function runMeshTestE2e(options = {}) {
|
|
2926
2968
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
2927
|
-
console.log(
|
|
2969
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2928
2970
|
========================================`)));
|
|
2929
|
-
console.log(
|
|
2930
|
-
console.log(
|
|
2971
|
+
console.log(pc22.bold(pc22.blue(`\u{1F6A6} [MESH] STAGE: GLOBAL INTEGRATED E2E TESTS`)));
|
|
2972
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2931
2973
|
`)));
|
|
2932
2974
|
if (!options.skipChecks) {
|
|
2933
2975
|
checkMesh(meshDir, { requireTester: true });
|
|
2934
2976
|
}
|
|
2935
2977
|
const { yaml, testerServiceName } = compileMeshEnvironment("prod", meshDir, {
|
|
2936
|
-
includeTester: true
|
|
2978
|
+
includeTester: true,
|
|
2979
|
+
silenceWarnings: options.silenceWarnings
|
|
2937
2980
|
});
|
|
2938
2981
|
if (!testerServiceName) {
|
|
2939
2982
|
throw new ScriptError(
|
|
@@ -2942,12 +2985,12 @@ async function runMeshTestE2e(options = {}) {
|
|
|
2942
2985
|
}
|
|
2943
2986
|
if (options.debug) {
|
|
2944
2987
|
console.log(
|
|
2945
|
-
|
|
2988
|
+
pc22.yellow("\nFinal merged Mesh E2E YAML configuration:\n"),
|
|
2946
2989
|
redactYamlSecrets(yaml)
|
|
2947
2990
|
);
|
|
2948
2991
|
}
|
|
2949
2992
|
if (options.dryRun) {
|
|
2950
|
-
console.log(
|
|
2993
|
+
console.log(pc22.green("[DRY-RUN] Global E2E test simulated. Compose was not started."));
|
|
2951
2994
|
return 0;
|
|
2952
2995
|
}
|
|
2953
2996
|
const parsed = parse(yaml);
|
|
@@ -2973,16 +3016,16 @@ async function runMeshTestE2e(options = {}) {
|
|
|
2973
3016
|
{ removeVolumes: true }
|
|
2974
3017
|
);
|
|
2975
3018
|
} finally {
|
|
2976
|
-
console.log(
|
|
3019
|
+
console.log(pc22.cyan("\n\u{1F9F9} Cleaning up global mesh containers and volumes..."));
|
|
2977
3020
|
await teardownCompose(yaml, meshDir, { removeVolumes: true });
|
|
2978
3021
|
clearRunState(meshDir);
|
|
2979
3022
|
}
|
|
2980
3023
|
if (status === 0) {
|
|
2981
|
-
console.log(
|
|
3024
|
+
console.log(pc22.bold(pc22.green(`
|
|
2982
3025
|
\u2705 Global E2E tests passed successfully.
|
|
2983
3026
|
`)));
|
|
2984
3027
|
} else {
|
|
2985
|
-
console.error(
|
|
3028
|
+
console.error(pc22.red(`
|
|
2986
3029
|
\u274C Global E2E tests failed with exit code ${status}.
|
|
2987
3030
|
`));
|
|
2988
3031
|
}
|
|
@@ -2992,44 +3035,45 @@ async function runMeshTestE2e(options = {}) {
|
|
|
2992
3035
|
// src/core/mesh/runners/runMeshTest.ts
|
|
2993
3036
|
async function runMeshTest(options = {}) {
|
|
2994
3037
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
2995
|
-
console.log(
|
|
3038
|
+
console.log(pc22.bold(pc22.blue(`
|
|
2996
3039
|
========================================`)));
|
|
2997
|
-
console.log(
|
|
2998
|
-
console.log(
|
|
3040
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} GLOBAL MESH TEST PIPELINE`)));
|
|
3041
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
2999
3042
|
`)));
|
|
3000
3043
|
if (!options.skipChecks) {
|
|
3001
3044
|
checkMesh(meshDir, { requireTester: true });
|
|
3002
3045
|
}
|
|
3003
3046
|
const mesh = getMeshJson(meshDir);
|
|
3004
|
-
console.log(
|
|
3047
|
+
console.log(pc22.bold(pc22.blue(`
|
|
3005
3048
|
========================================`)));
|
|
3006
3049
|
console.log(
|
|
3007
|
-
|
|
3008
|
-
|
|
3050
|
+
pc22.bold(
|
|
3051
|
+
pc22.blue(`\u{1F9EA} [1/2] STAGE: LOCAL SUBMODULE TEST SUITES (Unit & Isolated E2E)`)
|
|
3009
3052
|
)
|
|
3010
3053
|
);
|
|
3011
|
-
console.log(
|
|
3054
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3012
3055
|
`)));
|
|
3013
3056
|
for (const [serviceName, serviceConfig] of Object.entries(mesh.services)) {
|
|
3014
3057
|
const serviceDir = path13.resolve(meshDir, serviceConfig.path);
|
|
3015
3058
|
console.log(
|
|
3016
|
-
|
|
3059
|
+
pc22.bold(pc22.cyan(`
|
|
3017
3060
|
-> Running full test suite for [${serviceName}] in isolation...`))
|
|
3018
3061
|
);
|
|
3019
3062
|
if (options.dryRun) {
|
|
3020
3063
|
console.log(
|
|
3021
|
-
|
|
3064
|
+
pc22.green(`[DRY-RUN] Full isolated tests for ${serviceName} simulated.`)
|
|
3022
3065
|
);
|
|
3023
3066
|
continue;
|
|
3024
3067
|
}
|
|
3025
3068
|
const serviceStatus = await runTest({
|
|
3026
3069
|
projectDir: serviceDir,
|
|
3027
3070
|
debug: Boolean(options.debug),
|
|
3028
|
-
detach: Boolean(options.detach)
|
|
3071
|
+
detach: Boolean(options.detach),
|
|
3072
|
+
silenceWarnings: options.silenceWarnings
|
|
3029
3073
|
});
|
|
3030
3074
|
if (serviceStatus !== 0) {
|
|
3031
3075
|
console.error(
|
|
3032
|
-
|
|
3076
|
+
pc22.red(
|
|
3033
3077
|
`
|
|
3034
3078
|
\u274C Isolated tests failed for service [${serviceName}] with exit code ${serviceStatus}. Aborting global E2E tests.
|
|
3035
3079
|
`
|
|
@@ -3038,27 +3082,27 @@ async function runMeshTest(options = {}) {
|
|
|
3038
3082
|
return serviceStatus;
|
|
3039
3083
|
}
|
|
3040
3084
|
console.log(
|
|
3041
|
-
|
|
3085
|
+
pc22.bold(pc22.green(`
|
|
3042
3086
|
\u2705 Isolated tests passed for service: [${serviceName}]
|
|
3043
3087
|
`))
|
|
3044
3088
|
);
|
|
3045
3089
|
}
|
|
3046
|
-
console.log(
|
|
3090
|
+
console.log(pc22.bold(pc22.blue(`
|
|
3047
3091
|
========================================`)));
|
|
3048
3092
|
console.log(
|
|
3049
|
-
|
|
3050
|
-
|
|
3093
|
+
pc22.bold(
|
|
3094
|
+
pc22.blue(`\u{1F6A6} [2/2] STAGE: INTEGRATED PRODUCTION MESH & GLOBAL E2E ASSERTIONS`)
|
|
3051
3095
|
)
|
|
3052
3096
|
);
|
|
3053
|
-
console.log(
|
|
3097
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3054
3098
|
`)));
|
|
3055
3099
|
const e2eStatus = await runMeshTestE2e({ ...options, skipChecks: true });
|
|
3056
3100
|
if (e2eStatus !== 0) {
|
|
3057
3101
|
return e2eStatus;
|
|
3058
3102
|
}
|
|
3059
3103
|
console.log(
|
|
3060
|
-
|
|
3061
|
-
|
|
3104
|
+
pc22.bold(
|
|
3105
|
+
pc22.green(`\u{1F389} Entire global mesh test pipeline (unit, local e2e, and global e2e) completed successfully!
|
|
3062
3106
|
`)
|
|
3063
3107
|
)
|
|
3064
3108
|
);
|
|
@@ -3066,10 +3110,10 @@ async function runMeshTest(options = {}) {
|
|
|
3066
3110
|
}
|
|
3067
3111
|
async function runMeshTestUnit(options = {}) {
|
|
3068
3112
|
const meshDir = resolveProjectDir(options.projectDir);
|
|
3069
|
-
console.log(
|
|
3113
|
+
console.log(pc22.bold(pc22.blue(`
|
|
3070
3114
|
========================================`)));
|
|
3071
|
-
console.log(
|
|
3072
|
-
console.log(
|
|
3115
|
+
console.log(pc22.bold(pc22.blue(`\u{1F9EA} [MESH] STAGE: ISOLATED UNIT TESTS`)));
|
|
3116
|
+
console.log(pc22.bold(pc22.blue(`========================================
|
|
3073
3117
|
`)));
|
|
3074
3118
|
if (!options.skipChecks) {
|
|
3075
3119
|
checkMesh(meshDir, { requireTester: false });
|
|
@@ -3078,11 +3122,11 @@ async function runMeshTestUnit(options = {}) {
|
|
|
3078
3122
|
for (const [serviceName, serviceConfig] of Object.entries(mesh.services)) {
|
|
3079
3123
|
const serviceDir = path13.resolve(meshDir, serviceConfig.path);
|
|
3080
3124
|
console.log(
|
|
3081
|
-
|
|
3125
|
+
pc22.cyan(`
|
|
3082
3126
|
-> Running isolated unit tests for service: [${serviceName}]...`)
|
|
3083
3127
|
);
|
|
3084
3128
|
if (options.dryRun) {
|
|
3085
|
-
console.log(
|
|
3129
|
+
console.log(pc22.green(`[DRY-RUN] Unit tests for ${serviceName} simulated.`));
|
|
3086
3130
|
continue;
|
|
3087
3131
|
}
|
|
3088
3132
|
const unitStatus = await runTestUnit({
|
|
@@ -3093,20 +3137,20 @@ async function runMeshTestUnit(options = {}) {
|
|
|
3093
3137
|
});
|
|
3094
3138
|
if (unitStatus !== 0) {
|
|
3095
3139
|
console.error(
|
|
3096
|
-
|
|
3140
|
+
pc22.red(`
|
|
3097
3141
|
\u274C Unit tests failed for service [${serviceName}] with exit code ${unitStatus}.
|
|
3098
3142
|
`)
|
|
3099
3143
|
);
|
|
3100
3144
|
return unitStatus;
|
|
3101
3145
|
}
|
|
3102
3146
|
console.log(
|
|
3103
|
-
|
|
3147
|
+
pc22.bold(pc22.green(`
|
|
3104
3148
|
\u2705 Isolated unit tests passed for service: [${serviceName}]
|
|
3105
3149
|
`))
|
|
3106
3150
|
);
|
|
3107
3151
|
}
|
|
3108
3152
|
console.log(
|
|
3109
|
-
|
|
3153
|
+
pc22.bold(pc22.green(`\u{1F389} All mesh service unit tests completed successfully!
|
|
3110
3154
|
`))
|
|
3111
3155
|
);
|
|
3112
3156
|
return 0;
|
|
@@ -3148,6 +3192,9 @@ var registerMeshUpCommand = (cmd) => {
|
|
|
3148
3192
|
).option(
|
|
3149
3193
|
"--skip-checks",
|
|
3150
3194
|
"Skip hadolint and conftest pre-flight checks"
|
|
3195
|
+
).option(
|
|
3196
|
+
"--silence-warnings",
|
|
3197
|
+
"Silence non-critical warnings like URL templating hints"
|
|
3151
3198
|
).option(
|
|
3152
3199
|
"-C, --project-dir <dir>",
|
|
3153
3200
|
"Mesh project directory containing mesh.json (defaults to cwd)"
|
|
@@ -3167,7 +3214,8 @@ Examples:
|
|
|
3167
3214
|
debug: options.debug,
|
|
3168
3215
|
detach: options.detach,
|
|
3169
3216
|
dryRun: options.dryRun,
|
|
3170
|
-
skipChecks: options.skipChecks
|
|
3217
|
+
skipChecks: options.skipChecks,
|
|
3218
|
+
silenceWarnings: options.silenceWarnings
|
|
3171
3219
|
});
|
|
3172
3220
|
if (exitCode !== 0) {
|
|
3173
3221
|
process.exit(exitCode);
|
|
@@ -3187,7 +3235,7 @@ var registerMeshCommand = (program) => {
|
|
|
3187
3235
|
registerMeshCheckCommand(meshCmd);
|
|
3188
3236
|
};
|
|
3189
3237
|
async function handlePrune(options = {}) {
|
|
3190
|
-
console.log(
|
|
3238
|
+
console.log(pc22.cyan("\n\u{1F9F9} Pruning stopped Compose containers and unused networks..."));
|
|
3191
3239
|
const rmContainers = spawnSync("docker", ["container", "prune", "-f"], {
|
|
3192
3240
|
stdio: "inherit",
|
|
3193
3241
|
encoding: "utf-8"
|
|
@@ -3207,13 +3255,13 @@ async function handlePrune(options = {}) {
|
|
|
3207
3255
|
});
|
|
3208
3256
|
}
|
|
3209
3257
|
if (options.volumes) {
|
|
3210
|
-
console.log(
|
|
3258
|
+
console.log(pc22.cyan("\u{1F9F9} Pruning dangling volumes..."));
|
|
3211
3259
|
spawnSync("docker", ["volume", "prune", "-f"], {
|
|
3212
3260
|
stdio: "inherit",
|
|
3213
3261
|
encoding: "utf-8"
|
|
3214
3262
|
});
|
|
3215
3263
|
}
|
|
3216
|
-
console.log(
|
|
3264
|
+
console.log(pc22.green("\u2705 Docker environment pruned successfully.\n"));
|
|
3217
3265
|
return 0;
|
|
3218
3266
|
}
|
|
3219
3267
|
|
|
@@ -3238,7 +3286,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
|
|
|
3238
3286
|
);
|
|
3239
3287
|
}
|
|
3240
3288
|
console.log(
|
|
3241
|
-
|
|
3289
|
+
pc22.cyan(`
|
|
3242
3290
|
\u{1F9F9} Stopping and tearing down service environment [${stage}]...`)
|
|
3243
3291
|
);
|
|
3244
3292
|
if (options.debug) {
|
|
@@ -3249,7 +3297,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
|
|
|
3249
3297
|
else if (stage === "test-e2e") env = "e2e";
|
|
3250
3298
|
const finalYamlConfig = compileEnvironment(env, projectDir);
|
|
3251
3299
|
console.log(
|
|
3252
|
-
|
|
3300
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
3253
3301
|
redactYamlSecrets(finalYamlConfig)
|
|
3254
3302
|
);
|
|
3255
3303
|
} catch {
|
|
@@ -3269,7 +3317,7 @@ async function handleServiceDown(rawStage = "dev", options = {}) {
|
|
|
3269
3317
|
}
|
|
3270
3318
|
clearRunState(projectDir);
|
|
3271
3319
|
console.log(
|
|
3272
|
-
|
|
3320
|
+
pc22.green(`\u2705 Service environment [${stage}] stopped and removed.
|
|
3273
3321
|
`)
|
|
3274
3322
|
);
|
|
3275
3323
|
return 0;
|
|
@@ -3307,18 +3355,20 @@ Examples:
|
|
|
3307
3355
|
);
|
|
3308
3356
|
};
|
|
3309
3357
|
var runDev = async (options) => {
|
|
3310
|
-
console.log(
|
|
3311
|
-
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
|
+
});
|
|
3312
3362
|
const parsed = parse(finalYamlConfig);
|
|
3313
3363
|
const projectName = parsed?.name || "dev";
|
|
3314
3364
|
if (options.debug) {
|
|
3315
3365
|
console.log(
|
|
3316
|
-
|
|
3366
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
3317
3367
|
redactYamlSecrets(finalYamlConfig)
|
|
3318
3368
|
);
|
|
3319
3369
|
}
|
|
3320
3370
|
if (options.dryRun) {
|
|
3321
|
-
console.log(
|
|
3371
|
+
console.log(pc22.green("Dry run complete. Compose was not started."));
|
|
3322
3372
|
return 0;
|
|
3323
3373
|
}
|
|
3324
3374
|
const hostPorts = extractHostPorts(finalYamlConfig);
|
|
@@ -3348,18 +3398,20 @@ var runDev = async (options) => {
|
|
|
3348
3398
|
return status;
|
|
3349
3399
|
};
|
|
3350
3400
|
var runProd = async (options) => {
|
|
3351
|
-
console.log(
|
|
3352
|
-
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
|
+
});
|
|
3353
3405
|
const parsed = parse(finalYamlConfig);
|
|
3354
3406
|
const projectName = parsed?.name || "prod";
|
|
3355
3407
|
if (options.debug) {
|
|
3356
3408
|
console.log(
|
|
3357
|
-
|
|
3409
|
+
pc22.yellow("Final merged YAML configuration:\n"),
|
|
3358
3410
|
redactYamlSecrets(finalYamlConfig)
|
|
3359
3411
|
);
|
|
3360
3412
|
}
|
|
3361
3413
|
if (options.dryRun) {
|
|
3362
|
-
console.log(
|
|
3414
|
+
console.log(pc22.green("Dry run complete. Compose was not started."));
|
|
3363
3415
|
return 0;
|
|
3364
3416
|
}
|
|
3365
3417
|
const hostPorts = extractHostPorts(finalYamlConfig);
|
|
@@ -3397,7 +3449,8 @@ async function handleServiceUp(rawStage, options = {}) {
|
|
|
3397
3449
|
projectDir,
|
|
3398
3450
|
debug: Boolean(options.debug),
|
|
3399
3451
|
detach: Boolean(options.detach),
|
|
3400
|
-
dryRun: Boolean(options.dryRun)
|
|
3452
|
+
dryRun: Boolean(options.dryRun),
|
|
3453
|
+
silenceWarnings: Boolean(options.silenceWarnings)
|
|
3401
3454
|
};
|
|
3402
3455
|
if (stage === "dev") {
|
|
3403
3456
|
return await runDev(runOptions);
|
|
@@ -3429,6 +3482,9 @@ var registerUpCommand = (cmd) => {
|
|
|
3429
3482
|
).option(
|
|
3430
3483
|
"--skip-checks",
|
|
3431
3484
|
"Skip hadolint and conftest pre-flight checks"
|
|
3485
|
+
).option(
|
|
3486
|
+
"--silence-warnings",
|
|
3487
|
+
"Silence non-critical warnings like URL templating hints"
|
|
3432
3488
|
).option(
|
|
3433
3489
|
"-C, --project-dir <dir>",
|
|
3434
3490
|
"Service project directory (defaults to cwd)"
|
|
@@ -3448,7 +3504,8 @@ Examples:
|
|
|
3448
3504
|
debug: options.debug,
|
|
3449
3505
|
detach: options.detach,
|
|
3450
3506
|
dryRun: options.dryRun,
|
|
3451
|
-
skipChecks: options.skipChecks
|
|
3507
|
+
skipChecks: options.skipChecks,
|
|
3508
|
+
silenceWarnings: options.silenceWarnings
|
|
3452
3509
|
});
|
|
3453
3510
|
if (exitCode !== 0) {
|
|
3454
3511
|
process.exit(exitCode);
|
|
@@ -3501,10 +3558,10 @@ async function runCli(argv = process.argv) {
|
|
|
3501
3558
|
(arg) => arg === "-h" || arg === "--help" || arg === "-V" || arg === "--version"
|
|
3502
3559
|
);
|
|
3503
3560
|
if (!isHelpOrVersion && argv.length > 2) {
|
|
3504
|
-
console.log(
|
|
3561
|
+
console.log(pc22.dim(`builder v${version}`));
|
|
3505
3562
|
}
|
|
3506
3563
|
if (argv.length <= 2) {
|
|
3507
|
-
console.log(
|
|
3564
|
+
console.log(pc22.dim(`builder v${version}
|
|
3508
3565
|
`));
|
|
3509
3566
|
cli.outputHelp();
|
|
3510
3567
|
return;
|
|
@@ -3527,20 +3584,20 @@ async function runCli(argv = process.argv) {
|
|
|
3527
3584
|
if (err instanceof ScriptError) {
|
|
3528
3585
|
exitCode = err.exitCode;
|
|
3529
3586
|
const formatted = err.message.startsWith("\u274C") ? err.message : `\u274C ${err.message}`;
|
|
3530
|
-
console.error(
|
|
3587
|
+
console.error(pc22.red(`
|
|
3531
3588
|
${formatted}
|
|
3532
3589
|
`));
|
|
3533
3590
|
if (isVerbose && err.stack) {
|
|
3534
|
-
console.error(
|
|
3591
|
+
console.error(pc22.dim(err.stack));
|
|
3535
3592
|
}
|
|
3536
3593
|
} else {
|
|
3537
3594
|
const message = errorMessage(err);
|
|
3538
3595
|
const formatted = message.startsWith("\u274C") ? message : `\u274C Error: ${message}`;
|
|
3539
|
-
console.error(
|
|
3596
|
+
console.error(pc22.red(`
|
|
3540
3597
|
${formatted}
|
|
3541
3598
|
`));
|
|
3542
3599
|
if (isVerbose && err instanceof Error && err.stack) {
|
|
3543
|
-
console.error(
|
|
3600
|
+
console.error(pc22.dim(err.stack));
|
|
3544
3601
|
}
|
|
3545
3602
|
}
|
|
3546
3603
|
if (process.env.VITEST) {
|
|
@@ -3576,6 +3633,7 @@ var buildJsonSchema = z.object({
|
|
|
3576
3633
|
policies: buildPolicyConfigSchema.optional(),
|
|
3577
3634
|
composeFiles: z.array(z.string()).optional().describe("Additional compose files to merge"),
|
|
3578
3635
|
dependencies: z.record(z.string(), buildDependencySchema).optional().describe("Service dependencies and mocks"),
|
|
3636
|
+
envOverrides: z.record(z.string(), z.string()).optional().describe("Environment variable overrides for the app service with URL templating"),
|
|
3579
3637
|
overrides: z.record(
|
|
3580
3638
|
z.enum(["dev", "prod", "test", "e2e"]),
|
|
3581
3639
|
buildOverrideSchema
|