@stacksolo/cli 0.1.9 → 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 +53 -9
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
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
|
|
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,
|
|
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
|
|
@@ -5985,6 +5990,8 @@ function resolveCdktfConfig(config, projectInfo) {
|
|
|
5985
5990
|
const isGcsUI = gcsUis.some((ui) => ui.name === r.backend);
|
|
5986
5991
|
if (isGcsUI) {
|
|
5987
5992
|
return {
|
|
5993
|
+
host: r.host,
|
|
5994
|
+
// Pass through host for host-based routing
|
|
5988
5995
|
path: r.path,
|
|
5989
5996
|
uiName: `${projectInfo.name}-${r.backend}`
|
|
5990
5997
|
};
|
|
@@ -5992,11 +5999,15 @@ function resolveCdktfConfig(config, projectInfo) {
|
|
|
5992
5999
|
const isContainer = containers.some((c) => c.name === r.backend);
|
|
5993
6000
|
if (isContainer) {
|
|
5994
6001
|
return {
|
|
6002
|
+
host: r.host,
|
|
6003
|
+
// Pass through host for host-based routing
|
|
5995
6004
|
path: r.path,
|
|
5996
6005
|
containerName: `${projectInfo.name}-${r.backend}`
|
|
5997
6006
|
};
|
|
5998
6007
|
}
|
|
5999
6008
|
return {
|
|
6009
|
+
host: r.host,
|
|
6010
|
+
// Pass through host for host-based routing
|
|
6000
6011
|
path: r.path,
|
|
6001
6012
|
functionName: `${projectInfo.name}-${r.backend}`
|
|
6002
6013
|
};
|
|
@@ -6015,6 +6026,7 @@ function resolveCdktfConfig(config, projectInfo) {
|
|
|
6015
6026
|
functionName: functionNames.length > 0 ? functionNames[0] : void 0,
|
|
6016
6027
|
// HTTPS configuration
|
|
6017
6028
|
domain: lbHttpsConfig?.domain,
|
|
6029
|
+
domains: lbHttpsConfig?.domains,
|
|
6018
6030
|
enableHttps: lbHttpsConfig?.enableHttps,
|
|
6019
6031
|
redirectHttpToHttps: lbHttpsConfig?.redirectHttpToHttps
|
|
6020
6032
|
},
|
|
@@ -10614,7 +10626,39 @@ async function deployConfig(config, _stateDir, options = {}) {
|
|
|
10614
10626
|
await execAsync6(`cd "${stagingDir}" && zip -r "${sourceZipPath}" .`, { timeout: 6e4 });
|
|
10615
10627
|
await fs8.rm(stagingDir, { recursive: true, force: true });
|
|
10616
10628
|
} else {
|
|
10617
|
-
|
|
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 });
|
|
10618
10662
|
}
|
|
10619
10663
|
sourceZips.push({ name: fnName, zipPath: sourceZipPath });
|
|
10620
10664
|
}
|