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