@stacksjs/ts-cloud 0.5.2 → 0.5.3

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
@@ -83326,7 +83326,7 @@ async function deployServerlessApp(config6, environment, opts = {}) {
83326
83326
  step(`Creating artifact bucket ${artifactBucket}`);
83327
83327
  await s32.createBucket(artifactBucket);
83328
83328
  }
83329
- const exists = await s32.headObject(artifactBucket, key).then(() => true).catch(() => false);
83329
+ const exists = await s32.headObject(artifactBucket, key).then((r) => r !== null).catch(() => false);
83330
83330
  if (exists) {
83331
83331
  info("Artifact already uploaded — reusing");
83332
83332
  } else {
@@ -83339,7 +83339,20 @@ async function deployServerlessApp(config6, environment, opts = {}) {
83339
83339
  const composed = composeServerlessAppTemplate({ config: config6, environment, app, handlers, runtimeLayers });
83340
83340
  const templateBody = JSON.stringify(composed.template);
83341
83341
  const capabilities = ["CAPABILITY_NAMED_IAM"];
83342
- const stackExists = await cfn.describeStacks({ stackName }).then((r) => r.Stacks.length > 0).catch(() => false);
83342
+ const status = await cfn.describeStacks({ stackName }).then((r) => r.Stacks[0]?.StackStatus).catch(() => {
83343
+ return;
83344
+ });
83345
+ let stackExists = status !== undefined;
83346
+ if (status && /DELETE_IN_PROGRESS/.test(status)) {
83347
+ step("Waiting for an in-progress stack delete to finish");
83348
+ await cfn.waitForStack(stackName, "stack-delete-complete").catch(() => {});
83349
+ stackExists = false;
83350
+ } else if (status && /(?:ROLLBACK_COMPLETE|REVIEW_IN_PROGRESS|CREATE_FAILED)/.test(status)) {
83351
+ step(`Deleting unusable stack (status ${status}) before recreate`);
83352
+ await cfn.deleteStack(stackName);
83353
+ await cfn.waitForStack(stackName, "stack-delete-complete").catch(() => {});
83354
+ stackExists = false;
83355
+ }
83343
83356
  step(stackExists ? "Updating infrastructure stack" : "Creating infrastructure stack");
83344
83357
  try {
83345
83358
  if (stackExists) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/ts-cloud",
3
3
  "type": "module",
4
- "version": "0.5.2",
4
+ "version": "0.5.3",
5
5
  "description": "A lightweight, performant infrastructure-as-code library and CLI for deploying both server-based (EC2) and serverless applications.",
6
6
  "author": "Chris Breuer <chris@stacksjs.com>",
7
7
  "license": "MIT",
@@ -89,8 +89,8 @@
89
89
  "test": "bun test"
90
90
  },
91
91
  "dependencies": {
92
- "@ts-cloud/aws-types": "0.5.2",
93
- "@ts-cloud/core": "0.5.2",
92
+ "@ts-cloud/aws-types": "0.5.3",
93
+ "@ts-cloud/core": "0.5.3",
94
94
  "@stacksjs/ts-xml": "^0.1.0"
95
95
  },
96
96
  "devDependencies": {