@solid-stack/builder 1.1.3 → 1.1.5
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/README.md +12 -0
- package/dist/bin.js +83 -30
- package/dist/bin.js.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 +1 -0
- package/dist/core/RunOptions.d.ts.map +1 -1
- package/dist/core/buildSchema.d.ts +8 -0
- package/dist/core/buildSchema.d.ts.map +1 -1
- package/dist/core/compileEnvironment.d.ts +4 -2
- package/dist/core/compileEnvironment.d.ts.map +1 -1
- package/dist/core/mesh/checkers/checkMeshJson.d.ts.map +1 -1
- package/dist/core/mesh/compileMeshEnvironment.d.ts.map +1 -1
- package/dist/core/runners/runDev.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +85 -31
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/extractBuildDeps.d.ts.map +1 -1
- package/package.json +1 -1
- package/schemas/build-schema.json +7 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/commands/service/commands/up/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,eAAO,MAAM,iBAAiB,QAAS,OAAO,KAAG,
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/commands/service/commands/up/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,eAAO,MAAM,iBAAiB,QAAS,OAAO,KAAG,IA0DhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../../src/commands/service/commands/up/handler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnF,wBAAsB,eAAe,CACnC,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../../src/commands/service/commands/up/handler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnF,wBAAsB,eAAe,CACnC,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAqCjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunOptions.d.ts","sourceRoot":"","sources":["../../src/core/RunOptions.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"RunOptions.d.ts","sourceRoot":"","sources":["../../src/core/RunOptions.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC5B,CAAC"}
|
|
@@ -12,12 +12,15 @@ export declare const buildPolicyConfigSchema: z.ZodObject<{
|
|
|
12
12
|
export declare const buildDependencySchema: z.ZodObject<{
|
|
13
13
|
path: z.ZodString;
|
|
14
14
|
service: z.ZodOptional<z.ZodString>;
|
|
15
|
+
port: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
15
16
|
}, "strict", z.ZodTypeAny, {
|
|
16
17
|
path: string;
|
|
17
18
|
service?: string | undefined;
|
|
19
|
+
port?: string | number | undefined;
|
|
18
20
|
}, {
|
|
19
21
|
path: string;
|
|
20
22
|
service?: string | undefined;
|
|
23
|
+
port?: string | number | undefined;
|
|
21
24
|
}>;
|
|
22
25
|
export declare const buildOverrideSchema: z.ZodObject<{
|
|
23
26
|
path: z.ZodString;
|
|
@@ -62,12 +65,15 @@ export declare const buildJsonSchema: z.ZodObject<{
|
|
|
62
65
|
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
63
66
|
path: z.ZodString;
|
|
64
67
|
service: z.ZodOptional<z.ZodString>;
|
|
68
|
+
port: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
65
69
|
}, "strict", z.ZodTypeAny, {
|
|
66
70
|
path: string;
|
|
67
71
|
service?: string | undefined;
|
|
72
|
+
port?: string | number | undefined;
|
|
68
73
|
}, {
|
|
69
74
|
path: string;
|
|
70
75
|
service?: string | undefined;
|
|
76
|
+
port?: string | number | undefined;
|
|
71
77
|
}>>>;
|
|
72
78
|
envOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
73
79
|
overrides: z.ZodOptional<z.ZodRecord<z.ZodEnum<["dev", "prod", "test", "e2e"]>, z.ZodObject<{
|
|
@@ -102,6 +108,7 @@ export declare const buildJsonSchema: z.ZodObject<{
|
|
|
102
108
|
dependencies?: Record<string, {
|
|
103
109
|
path: string;
|
|
104
110
|
service?: string | undefined;
|
|
111
|
+
port?: string | number | undefined;
|
|
105
112
|
}> | undefined;
|
|
106
113
|
envOverrides?: Record<string, string> | undefined;
|
|
107
114
|
overrides?: Partial<Record<"dev" | "e2e" | "prod" | "test", {
|
|
@@ -128,6 +135,7 @@ export declare const buildJsonSchema: z.ZodObject<{
|
|
|
128
135
|
dependencies?: Record<string, {
|
|
129
136
|
path: string;
|
|
130
137
|
service?: string | undefined;
|
|
138
|
+
port?: string | number | undefined;
|
|
131
139
|
}> | undefined;
|
|
132
140
|
envOverrides?: Record<string, string> | undefined;
|
|
133
141
|
overrides?: Partial<Record<"dev" | "e2e" | "prod" | "test", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildSchema.d.ts","sourceRoot":"","sources":["../../src/core/buildSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;;;;;;;;EAYgC,CAAC;AAErE,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"buildSchema.d.ts","sourceRoot":"","sources":["../../src/core/buildSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;;;;;;;;EAYgC,CAAC;AAErE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAea,CAAC;AAEhD,eAAO,MAAM,mBAAmB;;;;;;EAOiB,CAAC;AAElD,eAAO,MAAM,iBAAiB;;;;;;EAUS,CAAC;AAExC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CyC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Environment } from "../types/index.js";
|
|
2
|
-
export
|
|
2
|
+
export interface CompileEnvironmentOptions {
|
|
3
3
|
silenceWarnings?: boolean | undefined;
|
|
4
|
-
|
|
4
|
+
full?: boolean | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare const compileEnvironment: (environment: Environment, projectDir?: string, options?: CompileEnvironmentOptions) => string;
|
|
5
7
|
//# sourceMappingURL=compileEnvironment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileEnvironment.d.ts","sourceRoot":"","sources":["../../src/core/compileEnvironment.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAarD,
|
|
1
|
+
{"version":3,"file":"compileEnvironment.d.ts","sourceRoot":"","sources":["../../src/core/compileEnvironment.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAarD,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,kBAAkB,gBAChB,WAAW,eACZ,MAAM,YACT,yBAAyB,KACjC,MA6UF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkMeshJson.d.ts","sourceRoot":"","sources":["../../../../src/core/mesh/checkers/checkMeshJson.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"checkMeshJson.d.ts","sourceRoot":"","sources":["../../../../src/core/mesh/checkers/checkMeshJson.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAwEpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileMeshEnvironment.d.ts","sourceRoot":"","sources":["../../../src/core/mesh/compileMeshEnvironment.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,KAAK,GAAG,MAAM,EACpB,UAAU,GAAE,MAAsB,EAClC,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"compileMeshEnvironment.d.ts","sourceRoot":"","sources":["../../../src/core/mesh/compileMeshEnvironment.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,KAAK,GAAG,MAAM,EACpB,UAAU,GAAE,MAAsB,EAClC,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAm0BnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runDev.d.ts","sourceRoot":"","sources":["../../../src/core/runners/runDev.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,eAAO,MAAM,MAAM,YAAmB,UAAU,KAAG,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"runDev.d.ts","sourceRoot":"","sources":["../../../src/core/runners/runDev.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,eAAO,MAAM,MAAM,YAAmB,UAAU,KAAG,OAAO,CAAC,MAAM,CAyDhE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./types/index.js";
|
|
2
2
|
export { createCli, runCli } from "./cli.js";
|
|
3
|
-
export { compileEnvironment } from "./core/compileEnvironment.js";
|
|
3
|
+
export { compileEnvironment, type CompileEnvironmentOptions, } from "./core/compileEnvironment.js";
|
|
4
4
|
export { compileMeshEnvironment } from "./core/mesh/compileMeshEnvironment.js";
|
|
5
5
|
export { teardownCompose } from "./core/teardownCompose.js";
|
|
6
6
|
export { runCompose } from "./core/runCompose.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,GAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -535,20 +535,6 @@ function checkMeshJson(mesh) {
|
|
|
535
535
|
}
|
|
536
536
|
const services = result.data.services;
|
|
537
537
|
const serviceKeys = new Set(Object.keys(services));
|
|
538
|
-
const seenPorts = /* @__PURE__ */ new Map();
|
|
539
|
-
for (const [serviceName, serviceConfig] of Object.entries(services)) {
|
|
540
|
-
if (serviceConfig.port) {
|
|
541
|
-
const portNum = Number(serviceConfig.port);
|
|
542
|
-
if (!isNaN(portNum)) {
|
|
543
|
-
if (seenPorts.has(portNum)) {
|
|
544
|
-
throw new ScriptError(
|
|
545
|
-
`Host port collision in mesh.json: Port ${portNum} is declared by both "${seenPorts.get(portNum)}" and "${serviceName}".`
|
|
546
|
-
);
|
|
547
|
-
}
|
|
548
|
-
seenPorts.set(portNum, serviceName);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
538
|
const graph = /* @__PURE__ */ new Map();
|
|
553
539
|
for (const sName of serviceKeys) {
|
|
554
540
|
graph.set(sName, /* @__PURE__ */ new Set());
|
|
@@ -862,7 +848,8 @@ var extractBuildDeps = (buildJson, projectDir = process.cwd()) => {
|
|
|
862
848
|
z.string(),
|
|
863
849
|
z.object({
|
|
864
850
|
path: z.string(),
|
|
865
|
-
service: z.string().optional()
|
|
851
|
+
service: z.string().optional(),
|
|
852
|
+
port: z.union([z.number(), z.string()]).optional()
|
|
866
853
|
})
|
|
867
854
|
)
|
|
868
855
|
});
|
|
@@ -879,7 +866,8 @@ var extractBuildDeps = (buildJson, projectDir = process.cwd()) => {
|
|
|
879
866
|
return {
|
|
880
867
|
path: path13.resolve(projectDir, service.path),
|
|
881
868
|
name,
|
|
882
|
-
serviceName: service.service
|
|
869
|
+
serviceName: service.service,
|
|
870
|
+
port: service.port
|
|
883
871
|
};
|
|
884
872
|
}
|
|
885
873
|
);
|
|
@@ -1152,24 +1140,44 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
|
|
|
1152
1140
|
const globalDepAliasToProvider = /* @__PURE__ */ new Map();
|
|
1153
1141
|
const INTERNAL_PORT = 3e3;
|
|
1154
1142
|
const serviceUrls = /* @__PURE__ */ new Map();
|
|
1143
|
+
const allocatedPorts = /* @__PURE__ */ new Map();
|
|
1144
|
+
function claimPort(portVal, ownerDesc) {
|
|
1145
|
+
if (!portVal) return;
|
|
1146
|
+
const portStr = String(portVal);
|
|
1147
|
+
const hostPort = portStr.includes(":") ? portStr.split(":")[0] : portStr;
|
|
1148
|
+
if (!hostPort) return;
|
|
1149
|
+
if (allocatedPorts.has(hostPort)) {
|
|
1150
|
+
throw new ScriptError(
|
|
1151
|
+
`\u274C Port Collision Detected: Host port ${hostPort} is requested by both [${allocatedPorts.get(hostPort)}] and [${ownerDesc}].`
|
|
1152
|
+
);
|
|
1153
|
+
}
|
|
1154
|
+
allocatedPorts.set(hostPort, ownerDesc);
|
|
1155
|
+
}
|
|
1155
1156
|
for (const [serviceName, serviceConfig] of Object.entries(mesh.services)) {
|
|
1156
1157
|
const serviceDir = path13.resolve(meshDir, serviceConfig.path);
|
|
1157
1158
|
const serviceBuildJson = getBuildJson(serviceDir);
|
|
1159
|
+
const serviceDeps = extractBuildDeps(serviceBuildJson, serviceDir);
|
|
1158
1160
|
let publicPort = null;
|
|
1159
1161
|
if (serviceConfig.port !== void 0 && serviceConfig.port !== null && serviceConfig.port !== "") {
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
publicPort = p;
|
|
1163
|
-
}
|
|
1162
|
+
publicPort = serviceConfig.port;
|
|
1163
|
+
claimPort(publicPort, `mesh service "${serviceName}"`);
|
|
1164
1164
|
} else if (serviceConfig.preservePort && serviceBuildJson.port) {
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1165
|
+
publicPort = serviceBuildJson.port;
|
|
1166
|
+
claimPort(publicPort, `mesh service "${serviceName}" (via preservePort)`);
|
|
1167
|
+
}
|
|
1168
|
+
const provideMap = {
|
|
1169
|
+
...serviceConfig.replaceMocks || {},
|
|
1170
|
+
...serviceConfig.provideDependency || {}
|
|
1171
|
+
};
|
|
1172
|
+
for (const dep of serviceDeps) {
|
|
1173
|
+
if (!provideMap[dep.name] && !(mesh.dependencies && mesh.dependencies[dep.name]) && dep.port) {
|
|
1174
|
+
claimPort(dep.port, `local dependency "${dep.name}" of service "${serviceName}"`);
|
|
1168
1175
|
}
|
|
1169
1176
|
}
|
|
1177
|
+
const hostPort = publicPort ? String(publicPort).includes(":") ? String(publicPort).split(":")[0] : String(publicPort) : null;
|
|
1170
1178
|
serviceUrls.set(serviceName, {
|
|
1171
1179
|
networkUrl: `http://${serviceName}:${INTERNAL_PORT}`,
|
|
1172
|
-
publicUrl:
|
|
1180
|
+
publicUrl: hostPort ? `http://localhost:${hostPort}` : null
|
|
1173
1181
|
});
|
|
1174
1182
|
}
|
|
1175
1183
|
function escapeRegExp(string) {
|
|
@@ -1453,6 +1461,10 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
|
|
|
1453
1461
|
delete resolvedMock.container_name;
|
|
1454
1462
|
normalizeDependsOn(resolvedMock);
|
|
1455
1463
|
applyInternalMockDependsOnMapping(resolvedMock, sidecarMapping);
|
|
1464
|
+
if (dep.port) {
|
|
1465
|
+
const portMapping = String(dep.port).includes(":") ? String(dep.port) : `${dep.port}:3000`;
|
|
1466
|
+
resolvedMock.ports = [...resolvedMock.ports || [], portMapping];
|
|
1467
|
+
}
|
|
1456
1468
|
resolvedMock.networks = {
|
|
1457
1469
|
[`${serviceName}_net`]: {
|
|
1458
1470
|
aliases: [depKey, namespacedDepKey]
|
|
@@ -2609,6 +2621,12 @@ var compileEnvironment = (environment, projectDir = process.cwd(), options = {})
|
|
|
2609
2621
|
composeFlags.push("-f", overrides.dev.path);
|
|
2610
2622
|
filesUsed.push(overrides.dev.path);
|
|
2611
2623
|
}
|
|
2624
|
+
if (options.full && dependencies.length > 0) {
|
|
2625
|
+
for (const dep of dependencies) {
|
|
2626
|
+
composeFlags.push("-f", dep.path);
|
|
2627
|
+
filesUsed.push(dep.path);
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2612
2630
|
composeFlags.push("-f", standalonePath);
|
|
2613
2631
|
filesUsed.push(standalonePath);
|
|
2614
2632
|
break;
|
|
@@ -2700,7 +2718,7 @@ ${explanation}`);
|
|
|
2700
2718
|
}
|
|
2701
2719
|
const mergedYamlConfig = result.stdout;
|
|
2702
2720
|
const yml = parse(mergedYamlConfig);
|
|
2703
|
-
if (environment === "prod" || environment === "e2e") {
|
|
2721
|
+
if (environment === "prod" || environment === "e2e" || environment === "dev" && options.full) {
|
|
2704
2722
|
renameServicesWithDependencies(yml, dependencies);
|
|
2705
2723
|
addDependenciesToAppService(yml, dependencies);
|
|
2706
2724
|
}
|
|
@@ -2718,9 +2736,11 @@ ${explanation}`);
|
|
|
2718
2736
|
urlRegistry.set(buildJson.name, urlRegistry.get("app"));
|
|
2719
2737
|
}
|
|
2720
2738
|
for (const dep of dependencies) {
|
|
2739
|
+
const depPortStr = dep.port ? String(dep.port) : null;
|
|
2740
|
+
const depHostPort = depPortStr ? depPortStr.includes(":") ? depPortStr.split(":")[0] : depPortStr : null;
|
|
2721
2741
|
urlRegistry.set(dep.name, {
|
|
2722
2742
|
networkUrl: `http://${dep.name}:${INTERNAL_PORT}`,
|
|
2723
|
-
publicUrl: null
|
|
2743
|
+
publicUrl: depHostPort ? `http://localhost:${depHostPort}` : null
|
|
2724
2744
|
});
|
|
2725
2745
|
}
|
|
2726
2746
|
const interpolateEnv = (val, context) => {
|
|
@@ -2794,6 +2814,24 @@ ${explanation}`);
|
|
|
2794
2814
|
yml.services.tester.environment[k] = interpolateEnv(v, "Tester EnvOverrides");
|
|
2795
2815
|
}
|
|
2796
2816
|
}
|
|
2817
|
+
if (yml.services) {
|
|
2818
|
+
for (const dep of dependencies) {
|
|
2819
|
+
if (dep.port) {
|
|
2820
|
+
let targetSvc = dep.serviceName && yml.services[dep.serviceName] ? dep.serviceName : dep.name;
|
|
2821
|
+
if (!yml.services[targetSvc]) {
|
|
2822
|
+
targetSvc = Object.keys(yml.services).find((k) => k !== "app" && k !== "tester") || targetSvc;
|
|
2823
|
+
}
|
|
2824
|
+
if (yml.services[targetSvc]) {
|
|
2825
|
+
const portMapping = String(dep.port).includes(":") ? String(dep.port) : `${dep.port}:3000`;
|
|
2826
|
+
yml.services[targetSvc].ports = [...yml.services[targetSvc].ports || [], portMapping];
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
if (environment === "dev" && options.full && yml.services?.app) {
|
|
2832
|
+
normalizeEnvironment(yml.services.app);
|
|
2833
|
+
yml.services.app.environment.INFRA_MODE = "integrated";
|
|
2834
|
+
}
|
|
2797
2835
|
attachName(yml, projectName);
|
|
2798
2836
|
const finalYamlConfig = stringify(yml);
|
|
2799
2837
|
return finalYamlConfig;
|
|
@@ -3355,9 +3393,14 @@ Examples:
|
|
|
3355
3393
|
);
|
|
3356
3394
|
};
|
|
3357
3395
|
var runDev = async (options) => {
|
|
3358
|
-
console.log(
|
|
3396
|
+
console.log(
|
|
3397
|
+
pc22.cyan(
|
|
3398
|
+
options.full ? `\u{1F680} Starting DEV environment (full / integrated)...` : `\u{1F680} Starting DEV environment...`
|
|
3399
|
+
)
|
|
3400
|
+
);
|
|
3359
3401
|
const finalYamlConfig = compileEnvironment("dev", options.projectDir, {
|
|
3360
|
-
silenceWarnings: options.silenceWarnings
|
|
3402
|
+
silenceWarnings: options.silenceWarnings,
|
|
3403
|
+
full: options.full
|
|
3361
3404
|
});
|
|
3362
3405
|
const parsed = parse(finalYamlConfig);
|
|
3363
3406
|
const projectName = parsed?.name || "dev";
|
|
@@ -3445,12 +3488,14 @@ var runProd = async (options) => {
|
|
|
3445
3488
|
async function handleServiceUp(rawStage, options = {}) {
|
|
3446
3489
|
const projectDir = resolveProjectDir(options.projectDir);
|
|
3447
3490
|
const stage = (rawStage || "dev").toLowerCase();
|
|
3491
|
+
const isFull = Boolean(options.full || options.integrated);
|
|
3448
3492
|
const runOptions = {
|
|
3449
3493
|
projectDir,
|
|
3450
3494
|
debug: Boolean(options.debug),
|
|
3451
3495
|
detach: Boolean(options.detach),
|
|
3452
3496
|
dryRun: Boolean(options.dryRun),
|
|
3453
|
-
silenceWarnings: Boolean(options.silenceWarnings)
|
|
3497
|
+
silenceWarnings: Boolean(options.silenceWarnings),
|
|
3498
|
+
full: isFull
|
|
3454
3499
|
};
|
|
3455
3500
|
if (stage === "dev") {
|
|
3456
3501
|
return await runDev(runOptions);
|
|
@@ -3485,6 +3530,12 @@ var registerUpCommand = (cmd) => {
|
|
|
3485
3530
|
).option(
|
|
3486
3531
|
"--silence-warnings",
|
|
3487
3532
|
"Silence non-critical warnings like URL templating hints"
|
|
3533
|
+
).option(
|
|
3534
|
+
"--full",
|
|
3535
|
+
"Run dev environment with mock dependencies and integrated infra mode"
|
|
3536
|
+
).option(
|
|
3537
|
+
"--integrated",
|
|
3538
|
+
"Alias for --full"
|
|
3488
3539
|
).option(
|
|
3489
3540
|
"-C, --project-dir <dir>",
|
|
3490
3541
|
"Service project directory (defaults to cwd)"
|
|
@@ -3493,6 +3544,7 @@ var registerUpCommand = (cmd) => {
|
|
|
3493
3544
|
`
|
|
3494
3545
|
Examples:
|
|
3495
3546
|
$ builder service up dev
|
|
3547
|
+
$ builder service up dev --full
|
|
3496
3548
|
$ builder service up prod
|
|
3497
3549
|
$ builder service up test
|
|
3498
3550
|
$ builder service up test-unit
|
|
@@ -3505,7 +3557,8 @@ Examples:
|
|
|
3505
3557
|
detach: options.detach,
|
|
3506
3558
|
dryRun: options.dryRun,
|
|
3507
3559
|
skipChecks: options.skipChecks,
|
|
3508
|
-
silenceWarnings: options.silenceWarnings
|
|
3560
|
+
silenceWarnings: options.silenceWarnings,
|
|
3561
|
+
full: Boolean(options.full || options.integrated)
|
|
3509
3562
|
});
|
|
3510
3563
|
if (exitCode !== 0) {
|
|
3511
3564
|
process.exit(exitCode);
|
|
@@ -3612,7 +3665,8 @@ var buildPolicyConfigSchema = z.object({
|
|
|
3612
3665
|
}).strict().describe("Policy configurations for infra/contract verification");
|
|
3613
3666
|
var buildDependencySchema = z.object({
|
|
3614
3667
|
path: z.string({ required_error: 'Dependency "path" is required' }).describe("Relative path to mock Docker Compose file"),
|
|
3615
|
-
service: z.string().optional().describe("Target service name in the mock compose file")
|
|
3668
|
+
service: z.string().optional().describe("Target service name in the mock compose file"),
|
|
3669
|
+
port: z.union([z.number(), z.string()]).optional().describe("Host port to map to this dependency locally")
|
|
3616
3670
|
}).strict().describe("Service dependency specification");
|
|
3617
3671
|
var buildOverrideSchema = z.object({
|
|
3618
3672
|
path: z.string({ required_error: 'Override "path" is required' }).describe("Relative path to the environment stage override file")
|