@solid-stack/builder 1.1.4 → 1.1.6

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 CHANGED
@@ -46,6 +46,16 @@ builder service up dev
46
46
  - Merges `docker-compose.base.yml`, `docker-compose.dev.yml`, `.env.dev`, and any overrides defined in `build.json`
47
47
  - Mounts source code with hot-reloading enabled
48
48
 
49
+ #### Full Development Mode (`builder service up dev --full`)
50
+
51
+ Spins up the development environment with hot-reloading while connecting to all declared mock dependencies and setting `INFRA_MODE=integrated`:
52
+
53
+ ```bash
54
+ builder service up dev --full
55
+ # Or alias:
56
+ builder service up dev --integrated
57
+ ```
58
+
49
59
  ### 2. Production Mode (`builder service up prod`)
50
60
 
51
61
  Spins up the production runtime with integrated local mocks:
@@ -97,6 +107,8 @@ builder service up test-e2e
97
107
  | `-C, --project-dir <path>` | Specify target service directory (defaults to current working directory) |
98
108
  | `--unit` | For `test`, run only unit test stage |
99
109
  | `--e2e` | For `test`, run only e2e test stage |
110
+ | `--full` | For `dev`, spin up with mock dependencies and `INFRA_MODE=integrated` |
111
+ | `--integrated` | Alias for `--full` |
100
112
 
101
113
  ---
102
114
 
package/dist/bin.js CHANGED
@@ -1232,12 +1232,13 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
1232
1232
  let overrideVolumes = [];
1233
1233
  let overrideHealthcheck = void 0;
1234
1234
  let overrideCommand = void 0;
1235
+ let overrideApp = void 0;
1235
1236
  const stageOverride = serviceOverrides[mode];
1236
1237
  if (stageOverride && existsSync(stageOverride.path)) {
1237
1238
  try {
1238
1239
  const overrideYaml = parse(readFileSync(stageOverride.path, "utf-8"));
1239
1240
  mergeTopLevelResources(overrideYaml);
1240
- const overrideApp = overrideYaml?.services?.app || overrideYaml?.services?.[serviceName];
1241
+ overrideApp = overrideYaml?.services?.app || overrideYaml?.services?.[serviceName];
1241
1242
  if (!overrideApp && overrideYaml?.services && Object.keys(overrideYaml.services).length > 0) {
1242
1243
  throw new ScriptError(
1243
1244
  `Override file "${stageOverride.path}" must define service "app" or "${serviceName}".`
@@ -1277,16 +1278,41 @@ function compileMeshEnvironment(mode, rawMeshDir = process.cwd(), options = {})
1277
1278
  }
1278
1279
  }
1279
1280
  environment.PORT = String(INTERNAL_PORT);
1281
+ const buildArgs = {};
1282
+ if (overrideApp?.build?.args) {
1283
+ if (Array.isArray(overrideApp.build.args)) {
1284
+ for (const item of overrideApp.build.args) {
1285
+ if (typeof item === "string") {
1286
+ const eqIdx = item.indexOf("=");
1287
+ if (eqIdx !== -1) {
1288
+ buildArgs[item.slice(0, eqIdx)] = item.slice(eqIdx + 1);
1289
+ } else {
1290
+ buildArgs[item] = process.env[item] ?? null;
1291
+ }
1292
+ }
1293
+ }
1294
+ } else if (typeof overrideApp.build.args === "object") {
1295
+ Object.assign(buildArgs, overrideApp.build.args);
1296
+ }
1297
+ }
1298
+ if (serviceBuildJson.envOverrides) {
1299
+ for (const [k, v] of Object.entries(serviceBuildJson.envOverrides)) {
1300
+ buildArgs[k] = interpolateEnvTemplates(v, `Service build.json: ${serviceName}`);
1301
+ }
1302
+ }
1280
1303
  if (serviceConfig.envOverrides) {
1281
1304
  for (const [k, v] of Object.entries(serviceConfig.envOverrides)) {
1282
- environment[k] = interpolateEnvTemplates(v, `Service: ${serviceName}`);
1305
+ const interpolated = interpolateEnvTemplates(v, `Service: ${serviceName}`);
1306
+ environment[k] = interpolated;
1307
+ buildArgs[k] = interpolated;
1283
1308
  }
1284
1309
  }
1285
1310
  const serviceDef = {
1286
1311
  build: {
1287
1312
  context: relServiceDir,
1288
1313
  dockerfile,
1289
- target: mode
1314
+ target: mode,
1315
+ ...Object.keys(buildArgs).length > 0 ? { args: buildArgs } : {}
1290
1316
  },
1291
1317
  init: true,
1292
1318
  logging: {
@@ -2613,6 +2639,12 @@ var compileEnvironment = (environment, projectDir = process.cwd(), options = {})
2613
2639
  composeFlags.push("-f", overrides.dev.path);
2614
2640
  filesUsed.push(overrides.dev.path);
2615
2641
  }
2642
+ if (options.full && dependencies.length > 0) {
2643
+ for (const dep of dependencies) {
2644
+ composeFlags.push("-f", dep.path);
2645
+ filesUsed.push(dep.path);
2646
+ }
2647
+ }
2616
2648
  composeFlags.push("-f", standalonePath);
2617
2649
  filesUsed.push(standalonePath);
2618
2650
  break;
@@ -2704,7 +2736,7 @@ ${explanation}`);
2704
2736
  }
2705
2737
  const mergedYamlConfig = result.stdout;
2706
2738
  const yml = parse(mergedYamlConfig);
2707
- if (environment === "prod" || environment === "e2e") {
2739
+ if (environment === "prod" || environment === "e2e" || environment === "dev" && options.full) {
2708
2740
  renameServicesWithDependencies(yml, dependencies);
2709
2741
  addDependenciesToAppService(yml, dependencies);
2710
2742
  }
@@ -2788,16 +2820,51 @@ ${explanation}`);
2788
2820
  serviceConfig.environment = {};
2789
2821
  }
2790
2822
  };
2823
+ const normalizeBuildArgs = (serviceConfig) => {
2824
+ if (typeof serviceConfig.build === "string") {
2825
+ serviceConfig.build = {
2826
+ context: serviceConfig.build
2827
+ };
2828
+ }
2829
+ if (serviceConfig.build && typeof serviceConfig.build === "object") {
2830
+ if (Array.isArray(serviceConfig.build.args)) {
2831
+ const argsObj = {};
2832
+ for (const item of serviceConfig.build.args) {
2833
+ if (typeof item === "string") {
2834
+ const eqIdx = item.indexOf("=");
2835
+ if (eqIdx !== -1) {
2836
+ argsObj[item.slice(0, eqIdx)] = item.slice(eqIdx + 1);
2837
+ } else {
2838
+ argsObj[item] = process.env[item] ?? null;
2839
+ }
2840
+ }
2841
+ }
2842
+ serviceConfig.build.args = argsObj;
2843
+ } else if (!serviceConfig.build.args || typeof serviceConfig.build.args !== "object") {
2844
+ serviceConfig.build.args = {};
2845
+ }
2846
+ }
2847
+ };
2791
2848
  if (buildJson.envOverrides && yml.services && yml.services.app) {
2792
2849
  normalizeEnvironment(yml.services.app);
2850
+ normalizeBuildArgs(yml.services.app);
2793
2851
  for (const [k, v] of Object.entries(buildJson.envOverrides)) {
2794
- yml.services.app.environment[k] = interpolateEnv(v, "App EnvOverrides");
2852
+ const val = interpolateEnv(v, "App EnvOverrides");
2853
+ yml.services.app.environment[k] = val;
2854
+ if (yml.services.app.build?.args) {
2855
+ yml.services.app.build.args[k] = val;
2856
+ }
2795
2857
  }
2796
2858
  }
2797
2859
  if (buildJson.tester?.envOverrides && yml.services && yml.services.tester) {
2798
2860
  normalizeEnvironment(yml.services.tester);
2861
+ normalizeBuildArgs(yml.services.tester);
2799
2862
  for (const [k, v] of Object.entries(buildJson.tester.envOverrides)) {
2800
- yml.services.tester.environment[k] = interpolateEnv(v, "Tester EnvOverrides");
2863
+ const val = interpolateEnv(v, "Tester EnvOverrides");
2864
+ yml.services.tester.environment[k] = val;
2865
+ if (yml.services.tester.build?.args) {
2866
+ yml.services.tester.build.args[k] = val;
2867
+ }
2801
2868
  }
2802
2869
  }
2803
2870
  if (yml.services) {
@@ -2814,6 +2881,10 @@ ${explanation}`);
2814
2881
  }
2815
2882
  }
2816
2883
  }
2884
+ if (environment === "dev" && options.full && yml.services?.app) {
2885
+ normalizeEnvironment(yml.services.app);
2886
+ yml.services.app.environment.INFRA_MODE = "integrated";
2887
+ }
2817
2888
  attachName(yml, projectName);
2818
2889
  const finalYamlConfig = stringify(yml);
2819
2890
  return finalYamlConfig;
@@ -3384,9 +3455,14 @@ Examples:
3384
3455
  );
3385
3456
  };
3386
3457
  var runDev = async (options) => {
3387
- console.log(pc22.cyan(`\u{1F680} Starting DEV environment...`));
3458
+ console.log(
3459
+ pc22.cyan(
3460
+ options.full ? `\u{1F680} Starting DEV environment (full / integrated)...` : `\u{1F680} Starting DEV environment...`
3461
+ )
3462
+ );
3388
3463
  const finalYamlConfig = compileEnvironment("dev", options.projectDir, {
3389
- silenceWarnings: options.silenceWarnings
3464
+ silenceWarnings: options.silenceWarnings,
3465
+ full: options.full
3390
3466
  });
3391
3467
  const parsed = parse(finalYamlConfig);
3392
3468
  const projectName = parsed?.name || "dev";
@@ -3474,12 +3550,14 @@ var runProd = async (options) => {
3474
3550
  async function handleServiceUp(rawStage, options = {}) {
3475
3551
  const projectDir = resolveProjectDir(options.projectDir);
3476
3552
  const stage = (rawStage || "dev").toLowerCase();
3553
+ const isFull = Boolean(options.full || options.integrated);
3477
3554
  const runOptions = {
3478
3555
  projectDir,
3479
3556
  debug: Boolean(options.debug),
3480
3557
  detach: Boolean(options.detach),
3481
3558
  dryRun: Boolean(options.dryRun),
3482
- silenceWarnings: Boolean(options.silenceWarnings)
3559
+ silenceWarnings: Boolean(options.silenceWarnings),
3560
+ full: isFull
3483
3561
  };
3484
3562
  if (stage === "dev") {
3485
3563
  return await runDev(runOptions);
@@ -3514,6 +3592,12 @@ var registerUpCommand = (cmd) => {
3514
3592
  ).option(
3515
3593
  "--silence-warnings",
3516
3594
  "Silence non-critical warnings like URL templating hints"
3595
+ ).option(
3596
+ "--full",
3597
+ "Run dev environment with mock dependencies and integrated infra mode"
3598
+ ).option(
3599
+ "--integrated",
3600
+ "Alias for --full"
3517
3601
  ).option(
3518
3602
  "-C, --project-dir <dir>",
3519
3603
  "Service project directory (defaults to cwd)"
@@ -3522,6 +3606,7 @@ var registerUpCommand = (cmd) => {
3522
3606
  `
3523
3607
  Examples:
3524
3608
  $ builder service up dev
3609
+ $ builder service up dev --full
3525
3610
  $ builder service up prod
3526
3611
  $ builder service up test
3527
3612
  $ builder service up test-unit
@@ -3534,7 +3619,8 @@ Examples:
3534
3619
  detach: options.detach,
3535
3620
  dryRun: options.dryRun,
3536
3621
  skipChecks: options.skipChecks,
3537
- silenceWarnings: options.silenceWarnings
3622
+ silenceWarnings: options.silenceWarnings,
3623
+ full: Boolean(options.full || options.integrated)
3538
3624
  });
3539
3625
  if (exitCode !== 0) {
3540
3626
  process.exit(exitCode);