@awsless/awsless 0.0.59 → 0.0.61

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/bin.js CHANGED
@@ -5267,7 +5267,6 @@ var sitePlugin = definePlugin({
5267
5267
  key: (/* @__PURE__ */ new Date()).toISOString(),
5268
5268
  distributionId: distribution.id,
5269
5269
  paths: ["/*"]
5270
- // waitForInvalidation: false,
5271
5270
  }
5272
5271
  }).dependsOn(distribution);
5273
5272
  if (props.static) {
@@ -6850,9 +6849,11 @@ var bootstrapDeployer = (config) => {
6850
6849
  const shouldDeploy = await shouldDeployBootstrap(client, stack);
6851
6850
  if (shouldDeploy) {
6852
6851
  term.out.write(dialog("warning", [`Your app hasn't been bootstrapped yet`]));
6853
- const confirmed = await term.out.write(confirmPrompt("Would you like to bootstrap?"));
6854
- if (!confirmed) {
6855
- throw new Cancelled();
6852
+ if (!process.env.SKIP_PROMPT) {
6853
+ const confirmed = await term.out.write(confirmPrompt("Would you like to bootstrap?"));
6854
+ if (!confirmed) {
6855
+ throw new Cancelled();
6856
+ }
6856
6857
  }
6857
6858
  const done = term.out.write(loadingDialog("Bootstrapping..."));
6858
6859
  await client.deploy(stack);
@@ -7059,11 +7060,13 @@ var deploy = (program2) => {
7059
7060
  const stackNames = app.stacks.map((stack) => stack.name);
7060
7061
  const formattedFilter = stackNames.map((i) => style.info(i)).join(style.placeholder(", "));
7061
7062
  debug("Stacks to deploy", formattedFilter);
7062
- const deployAll = filters.length === 0;
7063
- const deploySingle = filters.length === 1;
7064
- const confirm = await write(confirmPrompt(deployAll ? `Are you sure you want to deploy ${style.warning("all")} stacks?` : deploySingle ? `Are you sure you want to deploy the ${formattedFilter} stack?` : `Are you sure you want to deploy the [ ${formattedFilter} ] stacks?`));
7065
- if (!confirm) {
7066
- throw new Cancelled();
7063
+ if (!process.env.SKIP_PROMPT) {
7064
+ const deployAll = filters.length === 0;
7065
+ const deploySingle = filters.length === 1;
7066
+ const confirm = await write(confirmPrompt(deployAll ? `Are you sure you want to deploy ${style.warning("all")} stacks?` : deploySingle ? `Are you sure you want to deploy the ${formattedFilter} stack?` : `Are you sure you want to deploy the [ ${formattedFilter} ] stacks?`));
7067
+ if (!confirm) {
7068
+ throw new Cancelled();
7069
+ }
7067
7070
  }
7068
7071
  await cleanUp();
7069
7072
  await write(typesGenerator(config));
@@ -7278,11 +7281,13 @@ var del2 = (program2) => {
7278
7281
  const stackNames = app.stacks.map((stack) => stack.name);
7279
7282
  const formattedFilter = stackNames.map((i) => style.info(i)).join(style.placeholder(", "));
7280
7283
  debug("Stacks to delete", formattedFilter);
7281
- const deployAll = filters.length === 0;
7282
- const deploySingle = filters.length === 1;
7283
- const confirm = await write(confirmPrompt(deployAll ? `Are you sure you want to ${style.error("delete")} ${style.warning("all")} stacks?` : deploySingle ? `Are you sure you want to ${style.error("delete")} the ${formattedFilter} stack?` : `Are you sure you want to ${style.error("delete")} the [ ${formattedFilter} ] stacks?`));
7284
- if (!confirm) {
7285
- throw new Cancelled();
7284
+ if (!process.env.SKIP_PROMPT) {
7285
+ const deployAll = filters.length === 0;
7286
+ const deploySingle = filters.length === 1;
7287
+ const confirm = await write(confirmPrompt(deployAll ? `Are you sure you want to ${style.error("delete")} ${style.warning("all")} stacks?` : deploySingle ? `Are you sure you want to ${style.error("delete")} the ${formattedFilter} stack?` : `Are you sure you want to ${style.error("delete")} the [ ${formattedFilter} ] stacks?`));
7288
+ if (!confirm) {
7289
+ throw new Cancelled();
7290
+ }
7286
7291
  }
7287
7292
  const doneDeploying = write(loadingDialog("Deleting stacks from AWS..."));
7288
7293
  const client = new StackClient(app, config.account, config.region, config.credentials);
@@ -7318,6 +7323,7 @@ program.option("--config-file <string>", "The config file location");
7318
7323
  program.option("--stage <string>", "The stage to use, defaults to prod stage", "prod");
7319
7324
  program.option("--profile <string>", "The AWS profile to use");
7320
7325
  program.option("--region <string>", "The AWS region to use");
7326
+ program.option("-s --skip-prompt", "Skip prompts");
7321
7327
  program.option("-m --mute", "Mute sound effects");
7322
7328
  program.option("-v --verbose", "Print verbose logs");
7323
7329
  program.exitOverride(() => {
@@ -7326,6 +7332,9 @@ program.exitOverride(() => {
7326
7332
  program.on("option:verbose", () => {
7327
7333
  process.env.VERBOSE = program.opts().verbose ? "1" : void 0;
7328
7334
  });
7335
+ program.on("option:skip-prompt", () => {
7336
+ process.env.SKIP_PROMPT = program.opts().verbose ? "1" : void 0;
7337
+ });
7329
7338
  var commands2 = [
7330
7339
  bootstrap,
7331
7340
  status,
@@ -1,4 +1,4 @@
1
- import { CloudFrontClient, CreateInvalidationCommand, waitUntilInvalidationCompleted } from '@aws-sdk/client-cloudfront';
1
+ import { CloudFrontClient, CreateInvalidationCommand } from '@aws-sdk/client-cloudfront';
2
2
 
3
3
  const send = async (event, id, status, data, reason = '')=>{
4
4
  const body = JSON.stringify({
@@ -26,17 +26,13 @@ const send = async (event, id, status, data, reason = '')=>{
26
26
  const client = new CloudFrontClient({});
27
27
  const handler = async (event)=>{
28
28
  const type = event.RequestType;
29
- const { distributionId, paths, waitForInvalidation } = event.ResourceProperties;
29
+ const { distributionId, paths } = event.ResourceProperties;
30
30
  console.log('Type', type);
31
31
  console.log('DistributionId', distributionId);
32
32
  console.log('Paths', paths);
33
- console.log('WaitForInvalidation', waitForInvalidation);
34
33
  try {
35
34
  if (type === 'Update') {
36
- const id = await invalidateCache(distributionId, paths);
37
- if (waitForInvalidation) {
38
- await wait(distributionId, id);
39
- }
35
+ await invalidateCache(distributionId, paths);
40
36
  }
41
37
  await send(event, distributionId, 'SUCCESS');
42
38
  } catch (error) {
@@ -61,18 +57,5 @@ const invalidateCache = async (distributionId, paths)=>{
61
57
  }));
62
58
  return result.Invalidation.Id;
63
59
  };
64
- const wait = async (distributionId, id)=>{
65
- try {
66
- await waitUntilInvalidationCompleted({
67
- client,
68
- maxWaitTime: 600
69
- }, {
70
- DistributionId: distributionId,
71
- Id: id
72
- });
73
- } catch (error) {
74
- console.error(error);
75
- }
76
- };
77
60
 
78
61
  export { handler };
package/dist/index.js CHANGED
@@ -149,19 +149,22 @@ import { paramCase as paramCase2 } from "change-case";
149
149
  var getConfigName = (name) => {
150
150
  return `/.awsless/${APP}/${name}`;
151
151
  };
152
- var data = {};
153
152
  var TEST = process.env.NODE_ENV === "test";
154
153
  var CONFIGS = process.env.AWSLESS_CONFIG;
155
- if (!TEST && CONFIGS) {
156
- const keys = CONFIGS.split(",");
157
- if (keys.length > 0) {
158
- const paths = {};
159
- for (const key of keys) {
160
- paths[key] = getConfigName(key);
154
+ var loadConfigData = async () => {
155
+ if (!TEST && CONFIGS) {
156
+ const keys = CONFIGS.split(",");
157
+ if (keys.length > 0) {
158
+ const paths = {};
159
+ for (const key of keys) {
160
+ paths[key] = getConfigName(key);
161
+ }
162
+ return await ssm(paths);
161
163
  }
162
- data = await ssm(paths);
163
164
  }
164
- }
165
+ return {};
166
+ };
167
+ var data = await loadConfigData();
165
168
  var Config = new Proxy({}, {
166
169
  get(_, name) {
167
170
  const key = paramCase2(name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.59",
3
+ "version": "0.0.61",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -25,8 +25,8 @@
25
25
  "peerDependencies": {
26
26
  "@awsless/lambda": "^0.0.6",
27
27
  "@awsless/sns": "^0.0.6",
28
- "@awsless/ssm": "^0.0.7",
29
- "@awsless/sqs": "^0.0.6"
28
+ "@awsless/sqs": "^0.0.6",
29
+ "@awsless/ssm": "^0.0.7"
30
30
  },
31
31
  "dependencies": {
32
32
  "@aws-sdk/client-cloudformation": "^3.369.0",