@solid-stack/builder 1.1.1 → 1.1.2

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.
@@ -69,6 +69,7 @@ export declare const buildJsonSchema: z.ZodObject<{
69
69
  path: string;
70
70
  service?: string | undefined;
71
71
  }>>>;
72
+ envOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
72
73
  overrides: z.ZodOptional<z.ZodRecord<z.ZodEnum<["dev", "prod", "test", "e2e"]>, z.ZodObject<{
73
74
  path: z.ZodString;
74
75
  }, "strict", z.ZodTypeAny, {
@@ -102,6 +103,7 @@ export declare const buildJsonSchema: z.ZodObject<{
102
103
  path: string;
103
104
  service?: string | undefined;
104
105
  }> | undefined;
106
+ envOverrides?: Record<string, string> | undefined;
105
107
  overrides?: Partial<Record<"dev" | "e2e" | "prod" | "test", {
106
108
  path: string;
107
109
  }>> | undefined;
@@ -127,6 +129,7 @@ export declare const buildJsonSchema: z.ZodObject<{
127
129
  path: string;
128
130
  service?: string | undefined;
129
131
  }> | undefined;
132
+ envOverrides?: Record<string, string> | undefined;
130
133
  overrides?: Partial<Record<"dev" | "e2e" | "prod" | "test", {
131
134
  path: string;
132
135
  }>> | undefined;
@@ -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;;;;;;;;;EAWa,CAAC;AAEhD,eAAO,MAAM,mBAAmB;;;;;;EAOiB,CAAC;AAElD,eAAO,MAAM,iBAAiB;;;;;;EAUS,CAAC;AAExC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCyC,CAAC"}
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;;;;;;;;;EAWa,CAAC;AAEhD,eAAO,MAAM,mBAAmB;;;;;;EAOiB,CAAC;AAElD,eAAO,MAAM,iBAAiB;;;;;;EAUS,CAAC;AAExC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CyC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"compileEnvironment.d.ts","sourceRoot":"","sources":["../../src/core/compileEnvironment.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAarD,eAAO,MAAM,kBAAkB,gBAChB,WAAW,eACZ,MAAM,KACjB,MAkQF,CAAC"}
1
+ {"version":3,"file":"compileEnvironment.d.ts","sourceRoot":"","sources":["../../src/core/compileEnvironment.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAarD,eAAO,MAAM,kBAAkB,gBAChB,WAAW,eACZ,MAAM,KACjB,MAyQF,CAAC"}
package/dist/index.js CHANGED
@@ -2696,49 +2696,49 @@ ${explanation}`);
2696
2696
  if (environment === "e2e") {
2697
2697
  makeE2eDependOnApp(yml);
2698
2698
  }
2699
- if (buildJson.tester?.envOverrides && yml.services && yml.services.tester) {
2700
- const INTERNAL_PORT = 3e3;
2701
- const urlRegistry = /* @__PURE__ */ new Map();
2702
- const appPublicPort = buildJson.port ? Number(buildJson.port) : null;
2703
- urlRegistry.set("app", {
2704
- networkUrl: `http://app:${INTERNAL_PORT}`,
2705
- publicUrl: appPublicPort ? `http://localhost:${appPublicPort}` : null
2699
+ const INTERNAL_PORT = 3e3;
2700
+ const urlRegistry = /* @__PURE__ */ new Map();
2701
+ const appPublicPort = buildJson.port ? Number(buildJson.port) : null;
2702
+ urlRegistry.set("app", {
2703
+ networkUrl: `http://app:${INTERNAL_PORT}`,
2704
+ publicUrl: appPublicPort ? `http://localhost:${appPublicPort}` : null
2705
+ });
2706
+ if (buildJson.name && buildJson.name !== "app") {
2707
+ urlRegistry.set(buildJson.name, urlRegistry.get("app"));
2708
+ }
2709
+ for (const dep of dependencies) {
2710
+ urlRegistry.set(dep.name, {
2711
+ networkUrl: `http://${dep.name}:${INTERNAL_PORT}`,
2712
+ publicUrl: null
2706
2713
  });
2707
- if (buildJson.name && buildJson.name !== "app") {
2708
- urlRegistry.set(buildJson.name, urlRegistry.get("app"));
2709
- }
2710
- for (const dep of dependencies) {
2711
- urlRegistry.set(dep.name, {
2712
- networkUrl: `http://${dep.name}:${INTERNAL_PORT}`,
2713
- publicUrl: null
2714
- });
2715
- }
2716
- const interpolateEnv = (val) => {
2717
- let output = val;
2718
- for (const [sName, urls] of urlRegistry.entries()) {
2719
- const escaped = sName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2714
+ }
2715
+ const interpolateEnv = (val, context) => {
2716
+ let output = val;
2717
+ for (const [sName, urls] of urlRegistry.entries()) {
2718
+ const escaped = sName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2719
+ output = output.replace(
2720
+ new RegExp(`\\$\\{${escaped}\\.network_url\\}`, "g"),
2721
+ urls.networkUrl
2722
+ );
2723
+ if (urls.publicUrl) {
2720
2724
  output = output.replace(
2721
- new RegExp(`\\$\\{${escaped}\\.network_url\\}`, "g"),
2722
- urls.networkUrl
2723
- );
2724
- if (urls.publicUrl) {
2725
- output = output.replace(
2726
- new RegExp(`\\$\\{${escaped}\\.public_url\\}`, "g"),
2727
- urls.publicUrl
2728
- );
2729
- }
2730
- }
2731
- const unresolvedMatch = output.match(/\$\{([^}]+?)\.(network_url|public_url)\}/);
2732
- if (unresolvedMatch) {
2733
- throw new ScriptError(
2734
- `[Local E2E Tester] Unresolved template variable: ${unresolvedMatch[0]}. Check build.json dependencies.`
2725
+ new RegExp(`\\$\\{${escaped}\\.public_url\\}`, "g"),
2726
+ urls.publicUrl
2735
2727
  );
2736
2728
  }
2737
- return output;
2738
- };
2739
- if (Array.isArray(yml.services.tester.environment)) {
2729
+ }
2730
+ const unresolvedMatch = output.match(/\$\{([^}]+?)\.(network_url|public_url)\}/);
2731
+ if (unresolvedMatch) {
2732
+ throw new ScriptError(
2733
+ `[${context}] Unresolved template variable: ${unresolvedMatch[0]}. Check build.json dependencies.`
2734
+ );
2735
+ }
2736
+ return output;
2737
+ };
2738
+ const normalizeEnvironment = (serviceConfig) => {
2739
+ if (Array.isArray(serviceConfig.environment)) {
2740
2740
  const envObj = {};
2741
- for (const item of yml.services.tester.environment) {
2741
+ for (const item of serviceConfig.environment) {
2742
2742
  if (typeof item === "string") {
2743
2743
  const eqIdx = item.indexOf("=");
2744
2744
  if (eqIdx !== -1) {
@@ -2748,12 +2748,21 @@ ${explanation}`);
2748
2748
  }
2749
2749
  }
2750
2750
  }
2751
- yml.services.tester.environment = envObj;
2752
- } else if (!yml.services.tester.environment || typeof yml.services.tester.environment !== "object") {
2753
- yml.services.tester.environment = {};
2751
+ serviceConfig.environment = envObj;
2752
+ } else if (!serviceConfig.environment || typeof serviceConfig.environment !== "object") {
2753
+ serviceConfig.environment = {};
2754
2754
  }
2755
+ };
2756
+ if (buildJson.envOverrides && yml.services && yml.services.app) {
2757
+ normalizeEnvironment(yml.services.app);
2758
+ for (const [k, v] of Object.entries(buildJson.envOverrides)) {
2759
+ yml.services.app.environment[k] = interpolateEnv(v, "App EnvOverrides");
2760
+ }
2761
+ }
2762
+ if (buildJson.tester?.envOverrides && yml.services && yml.services.tester) {
2763
+ normalizeEnvironment(yml.services.tester);
2755
2764
  for (const [k, v] of Object.entries(buildJson.tester.envOverrides)) {
2756
- yml.services.tester.environment[k] = interpolateEnv(v);
2765
+ yml.services.tester.environment[k] = interpolateEnv(v, "Tester EnvOverrides");
2757
2766
  }
2758
2767
  }
2759
2768
  attachName(yml, projectName);
@@ -3576,6 +3585,7 @@ var buildJsonSchema = z.object({
3576
3585
  policies: buildPolicyConfigSchema.optional(),
3577
3586
  composeFiles: z.array(z.string()).optional().describe("Additional compose files to merge"),
3578
3587
  dependencies: z.record(z.string(), buildDependencySchema).optional().describe("Service dependencies and mocks"),
3588
+ envOverrides: z.record(z.string(), z.string()).optional().describe("Environment variable overrides for the app service with URL templating"),
3579
3589
  overrides: z.record(
3580
3590
  z.enum(["dev", "prod", "test", "e2e"]),
3581
3591
  buildOverrideSchema