@stacksolo/cli 0.1.8 → 0.1.10

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/index.js CHANGED
@@ -5175,7 +5175,7 @@ function resolveConfig(config) {
5175
5175
  }
5176
5176
  if (project.networks) {
5177
5177
  for (const network of project.networks) {
5178
- resources.push(...resolveNetwork(network, projectInfo.region));
5178
+ resources.push(...resolveNetwork(network, projectInfo));
5179
5179
  }
5180
5180
  }
5181
5181
  if (project.crons) {
@@ -5295,10 +5295,11 @@ function resolveCron(cron, defaultRegion) {
5295
5295
  dependsOn
5296
5296
  };
5297
5297
  }
5298
- function resolveNetwork(network, defaultRegion) {
5298
+ function resolveNetwork(network, projectInfo) {
5299
5299
  const resources = [];
5300
5300
  const networkId = `network-${network.name}`;
5301
5301
  const registryId = `registry-${network.name}`;
5302
+ const defaultRegion = projectInfo.region;
5302
5303
  resources.push({
5303
5304
  id: networkId,
5304
5305
  type: "gcp:vpc_network",
@@ -5341,12 +5342,12 @@ function resolveNetwork(network, defaultRegion) {
5341
5342
  }
5342
5343
  if (network.containers) {
5343
5344
  for (const container of network.containers) {
5344
- resources.push(resolveContainer(container, network.name, defaultRegion, networkId, registryId));
5345
+ resources.push(resolveContainer(container, network.name, defaultRegion, networkId, registryId, projectInfo));
5345
5346
  }
5346
5347
  }
5347
5348
  if (network.functions) {
5348
5349
  for (const fn of network.functions) {
5349
- resources.push(resolveFunction(fn, network.name, defaultRegion, networkId, registryId));
5350
+ resources.push(resolveFunction(fn, network.name, defaultRegion, networkId, registryId, projectInfo));
5350
5351
  }
5351
5352
  }
5352
5353
  if (network.databases) {
@@ -5421,7 +5422,7 @@ function resolveFirewallRule(rule, networkName, networkId) {
5421
5422
  network: networkName
5422
5423
  };
5423
5424
  }
5424
- function resolveContainer(container, networkName, defaultRegion, networkId, registryId) {
5425
+ function resolveContainer(container, networkName, defaultRegion, networkId, registryId, projectInfo) {
5425
5426
  const dependsOn = [networkId];
5426
5427
  if (registryId) {
5427
5428
  dependsOn.push(registryId);
@@ -5464,14 +5465,16 @@ function resolveContainer(container, networkName, defaultRegion, networkId, regi
5464
5465
  serviceAccount: container.serviceAccount,
5465
5466
  vpcConnector: container.vpcConnector,
5466
5467
  labels: container.labels,
5467
- location: defaultRegion
5468
+ location: defaultRegion,
5469
+ projectId: projectInfo?.gcpProjectId,
5470
+ projectName: projectInfo?.name
5468
5471
  },
5469
5472
  dependsOn: [...new Set(dependsOn)],
5470
5473
  // Deduplicate
5471
5474
  network: networkName
5472
5475
  };
5473
5476
  }
5474
- function resolveFunction(fn, networkName, defaultRegion, networkId, registryId) {
5477
+ function resolveFunction(fn, networkName, defaultRegion, networkId, registryId, projectInfo) {
5475
5478
  const dependsOn = [networkId];
5476
5479
  if (registryId) {
5477
5480
  dependsOn.push(registryId);
@@ -5522,7 +5525,9 @@ function resolveFunction(fn, networkName, defaultRegion, networkId, registryId)
5522
5525
  vpcConnector: fn.vpcConnector,
5523
5526
  labels: fn.labels,
5524
5527
  location: defaultRegion,
5525
- trigger: fn.trigger
5528
+ trigger: fn.trigger,
5529
+ projectId: projectInfo?.gcpProjectId,
5530
+ projectName: projectInfo?.name
5526
5531
  },
5527
5532
  dependsOn: [...new Set(dependsOn)],
5528
5533
  network: networkName
@@ -5947,6 +5952,8 @@ function resolveCdktfConfig(config, projectInfo) {
5947
5952
  name: uiName,
5948
5953
  config: {
5949
5954
  name: uiName,
5955
+ originalName: ui.name,
5956
+ // Short name for route matching
5950
5957
  location: "US",
5951
5958
  // Multi-region for CDN
5952
5959
  sourceDir: ui.sourceDir || `apps/${ui.name}`,
@@ -5983,6 +5990,8 @@ function resolveCdktfConfig(config, projectInfo) {
5983
5990
  const isGcsUI = gcsUis.some((ui) => ui.name === r.backend);
5984
5991
  if (isGcsUI) {
5985
5992
  return {
5993
+ host: r.host,
5994
+ // Pass through host for host-based routing
5986
5995
  path: r.path,
5987
5996
  uiName: `${projectInfo.name}-${r.backend}`
5988
5997
  };
@@ -5990,11 +5999,15 @@ function resolveCdktfConfig(config, projectInfo) {
5990
5999
  const isContainer = containers.some((c) => c.name === r.backend);
5991
6000
  if (isContainer) {
5992
6001
  return {
6002
+ host: r.host,
6003
+ // Pass through host for host-based routing
5993
6004
  path: r.path,
5994
6005
  containerName: `${projectInfo.name}-${r.backend}`
5995
6006
  };
5996
6007
  }
5997
6008
  return {
6009
+ host: r.host,
6010
+ // Pass through host for host-based routing
5998
6011
  path: r.path,
5999
6012
  functionName: `${projectInfo.name}-${r.backend}`
6000
6013
  };
@@ -6013,6 +6026,7 @@ function resolveCdktfConfig(config, projectInfo) {
6013
6026
  functionName: functionNames.length > 0 ? functionNames[0] : void 0,
6014
6027
  // HTTPS configuration
6015
6028
  domain: lbHttpsConfig?.domain,
6029
+ domains: lbHttpsConfig?.domains,
6016
6030
  enableHttps: lbHttpsConfig?.enableHttps,
6017
6031
  redirectHttpToHttps: lbHttpsConfig?.redirectHttpToHttps
6018
6032
  },
@@ -10612,7 +10626,39 @@ async function deployConfig(config, _stateDir, options = {}) {
10612
10626
  await execAsync6(`cd "${stagingDir}" && zip -r "${sourceZipPath}" .`, { timeout: 6e4 });
10613
10627
  await fs8.rm(stagingDir, { recursive: true, force: true });
10614
10628
  } else {
10615
- await execAsync6(`cd "${sourceDir}" && zip -r "${sourceZipPath}" . -x "*.git*" -x "node_modules/*"`, { timeout: 6e4 });
10629
+ const stagingDir = path10.join(workDir, `staging-${fnName}`);
10630
+ await fs8.mkdir(stagingDir, { recursive: true });
10631
+ await execAsync6(`rsync -a --exclude='node_modules' --exclude='.git' "${sourceDir}/" "${stagingDir}/"`, { timeout: 3e4 });
10632
+ const stagingPkgPath = path10.join(stagingDir, "package.json");
10633
+ try {
10634
+ const pkgContent = await fs8.readFile(stagingPkgPath, "utf-8");
10635
+ const pkg2 = JSON.parse(pkgContent);
10636
+ let modified = false;
10637
+ if (pkg2.dependencies) {
10638
+ for (const [name, version] of Object.entries(pkg2.dependencies)) {
10639
+ if (typeof version === "string" && version.startsWith("workspace:")) {
10640
+ delete pkg2.dependencies[name];
10641
+ log(`Removed workspace dependency: ${name}@${version}`);
10642
+ modified = true;
10643
+ }
10644
+ }
10645
+ }
10646
+ if (pkg2.devDependencies) {
10647
+ for (const [name, version] of Object.entries(pkg2.devDependencies)) {
10648
+ if (typeof version === "string" && version.startsWith("workspace:")) {
10649
+ delete pkg2.devDependencies[name];
10650
+ log(`Removed workspace devDependency: ${name}@${version}`);
10651
+ modified = true;
10652
+ }
10653
+ }
10654
+ }
10655
+ if (modified) {
10656
+ await fs8.writeFile(stagingPkgPath, JSON.stringify(pkg2, null, 2));
10657
+ }
10658
+ } catch {
10659
+ }
10660
+ await execAsync6(`cd "${stagingDir}" && zip -r "${sourceZipPath}" . -x "*.git*"`, { timeout: 6e4 });
10661
+ await fs8.rm(stagingDir, { recursive: true, force: true });
10616
10662
  }
10617
10663
  sourceZips.push({ name: fnName, zipPath: sourceZipPath });
10618
10664
  }
@@ -10916,7 +10962,8 @@ terraform {
10916
10962
  log("Building and uploading UI assets...");
10917
10963
  for (const uiResource of uiResources) {
10918
10964
  const uiName = uiResource.config.name;
10919
- const sourceDir = path10.resolve(process.cwd(), uiResource.config.sourceDir || `apps/${uiName}`);
10965
+ const uiOriginalName = uiResource.config.originalName || uiName;
10966
+ const sourceDir = path10.resolve(process.cwd(), uiResource.config.sourceDir || `apps/${uiOriginalName}`);
10920
10967
  const framework = uiResource.config.framework;
10921
10968
  const buildCommand2 = uiResource.config.buildCommand || "npm run build";
10922
10969
  const buildOutputDir = uiResource.config.buildOutputDir;
@@ -10976,7 +11023,7 @@ terraform {
10976
11023
  const lb = network.loadBalancer;
10977
11024
  if (lb?.routes) {
10978
11025
  for (const route of lb.routes) {
10979
- if (route.backend === uiName && route.path) {
11026
+ if (route.backend === uiOriginalName && route.path) {
10980
11027
  const pathMatch = route.path.match(/^\/([^/*]+)/);
10981
11028
  if (pathMatch) {
10982
11029
  uploadPath = pathMatch[1];