sst 2.0.0-rc.43 → 2.0.0-rc.45

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.
@@ -44,7 +44,7 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
44
44
  Colors.line(`No stacks found matching ${blue(args.filter)}`);
45
45
  process.exit(1);
46
46
  }
47
- const component = render(React.createElement(DeploymentUI, { stacks: assembly.stacks.map((s) => s.stackName) }));
47
+ const component = render(React.createElement(DeploymentUI, { assembly: assembly }));
48
48
  const results = await Stacks.deployMany(assembly.stacks);
49
49
  component.clear();
50
50
  component.unmount();
@@ -114,6 +114,7 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
114
114
  project.metafile = metafile;
115
115
  project.stacks = sstConfig.stacks;
116
116
  const assembly = await Stacks.synth({
117
+ increaseTimeout: args["increase-timeout"],
117
118
  fn: project.stacks,
118
119
  outDir: `.sst/cdk.out`,
119
120
  mode: "dev",
@@ -159,7 +160,7 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
159
160
  pending = undefined;
160
161
  if (lastDeployed)
161
162
  console.log();
162
- const component = render(React.createElement(DeploymentUI, { stacks: assembly.stacks.map((s) => s.stackName) }));
163
+ const component = render(React.createElement(DeploymentUI, { assembly: assembly }));
163
164
  const results = await Stacks.deployMany(assembly.stacks);
164
165
  component.clear();
165
166
  component.unmount();
@@ -32,7 +32,7 @@ export const remove = (program) => program.command("remove [filter]", "Remove yo
32
32
  console.log(`No stacks found matching ${blue(args.filter)}`);
33
33
  process.exit(1);
34
34
  }
35
- const component = render(React.createElement(DeploymentUI, { stacks: assembly.stacks.map((s) => s.stackName) }));
35
+ const component = render(React.createElement(DeploymentUI, { assembly: assembly }));
36
36
  const results = await Stacks.removeMany(target);
37
37
  component.clear();
38
38
  component.unmount();
package/cli/sst.js CHANGED
@@ -5,7 +5,9 @@ import { VisibleError } from "../error.js";
5
5
  import { useSpinners } from "./spinner.js";
6
6
  import { Logger } from "../logger.js";
7
7
  import dotenv from "dotenv";
8
- dotenv.config();
8
+ dotenv.config({
9
+ override: true,
10
+ });
9
11
  import { env } from "./commands/env.js";
10
12
  import { dev } from "./commands/dev.js";
11
13
  import { bind } from "./commands/bind.js";
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" resolution-mode="require"/>
2
2
  import { Stacks } from "../../stacks/index.js";
3
- import { CloudAssembly } from "aws-cdk-lib/cx-api";
3
+ import type { CloudAssembly } from "aws-cdk-lib/cx-api";
4
4
  interface Props {
5
- stacks: string[];
5
+ assembly: CloudAssembly;
6
6
  }
7
7
  export declare const DeploymentUI: (props: Props) => JSX.Element;
8
8
  export declare function printDeploymentResults(assembly: CloudAssembly, results: Awaited<ReturnType<typeof Stacks.deployMany>>): void;
package/cli/ui/deploy.js CHANGED
@@ -19,7 +19,8 @@ export const DeploymentUI = (props) => {
19
19
  return;
20
20
  setResources((previous) => {
21
21
  if (Stacks.isFinal(event.ResourceStatus)) {
22
- Colors.line(Colors.warning(Colors.prefix), Colors.dim(`${event.StackName} ${event.ResourceType} ${event.LogicalResourceId}`), Stacks.isFailed(event.ResourceStatus)
22
+ const readable = Stacks.logicalIdToCdkPath(props.assembly, event.StackName, event.LogicalResourceId);
23
+ Colors.line(Colors.warning(Colors.prefix), Colors.dim(`${event.StackName} ${readable} ${event.ResourceType}`), Stacks.isFailed(event.ResourceStatus)
23
24
  ? Colors.danger(event.ResourceStatus)
24
25
  : Colors.dim(event.ResourceStatus));
25
26
  const { [event.LogicalResourceId]: _, ...next } = previous;
@@ -44,63 +45,61 @@ export const DeploymentUI = (props) => {
44
45
  }
45
46
  return (React.createElement(Box, { flexDirection: "column" },
46
47
  Object.entries(resources).map(([_, evt]) => {
48
+ const readable = Stacks.logicalIdToCdkPath(props.assembly, evt.StackName, evt.LogicalResourceId);
47
49
  return (React.createElement(Box, { key: evt.LogicalResourceId },
48
50
  React.createElement(Text, null,
49
51
  React.createElement(Spinner, null),
50
52
  " ",
51
53
  evt.StackName,
52
54
  " ",
53
- evt.ResourceType,
55
+ readable,
54
56
  " ",
55
- evt.LogicalResourceId,
57
+ evt.ResourceType,
56
58
  " "),
57
59
  React.createElement(Text, { color: color(evt.ResourceStatus || "") }, evt.ResourceStatus)));
58
60
  }),
59
61
  Object.entries(resources).length === 0 && (React.createElement(Box, null,
60
62
  React.createElement(Text, null,
61
63
  React.createElement(Spinner, null),
62
- " ",
63
- React.createElement(Text, { dimColor: true }, "Waiting for changes"))))));
64
+ " ")))));
64
65
  };
65
66
  export function printDeploymentResults(assembly, results) {
66
- Colors.gap();
67
- Colors.line(Colors.success(`✔`), Colors.bold(` Deployed`));
68
- for (const [stack, result] of Object.entries(results)) {
69
- if (Object.values(result.errors).length)
70
- continue;
71
- const outputs = Object.entries(result.outputs).filter(([key, _]) => {
72
- if (key.startsWith("Export"))
73
- return false;
74
- if (key.includes("SstSiteEnv"))
75
- return false;
76
- if (key === "SSTMetadata")
77
- return false;
78
- return true;
79
- });
80
- Colors.line(` ${Colors.dim(stack)}`);
81
- if (outputs.length > 0) {
82
- for (const key of Object.keys(Object.fromEntries(outputs)).sort()) {
83
- const value = result.outputs[key];
84
- Colors.line(` ${Colors.bold.dim(key)}: ${value}`);
67
+ // Print success stacks
68
+ const success = Object.entries(results)
69
+ .filter(([_stack, result]) => Object.keys(result.errors).length === 0);
70
+ if (success.length) {
71
+ Colors.gap();
72
+ Colors.line(Colors.success(`✔`), Colors.bold(` Deployed`));
73
+ for (const [stack, result] of success) {
74
+ const outputs = Object.entries(result.outputs).filter(([key, _]) => {
75
+ if (key.startsWith("Export"))
76
+ return false;
77
+ if (key.includes("SstSiteEnv"))
78
+ return false;
79
+ if (key === "SSTMetadata")
80
+ return false;
81
+ return true;
82
+ });
83
+ Colors.line(` ${Colors.dim(stack)}`);
84
+ if (outputs.length > 0) {
85
+ for (const key of Object.keys(Object.fromEntries(outputs)).sort()) {
86
+ const value = result.outputs[key];
87
+ Colors.line(` ${Colors.bold.dim(key + ":")} ${value}`);
88
+ }
85
89
  }
86
90
  }
87
91
  }
88
- Colors.gap();
89
- if (Object.values(results).flatMap((s) => Object.keys(s.errors)).length) {
92
+ // Print failed stacks
93
+ const failed = Object.entries(results)
94
+ .filter(([_stack, result]) => Object.keys(result.errors).length > 0);
95
+ if (failed.length) {
96
+ Colors.gap();
90
97
  Colors.line(`${Colors.danger(`✖`)} ${Colors.bold.dim(`Errors`)}`);
91
- for (const [stack, result] of Object.entries(results)) {
92
- const hasErrors = Object.entries(result.errors).length > 0;
93
- if (!hasErrors)
94
- continue;
98
+ for (const [stack, result] of failed) {
95
99
  Colors.line(` ${Colors.dim(stack)}`);
96
100
  for (const [id, error] of Object.entries(result.errors)) {
97
- const found = Object.entries(assembly.manifest.artifacts?.[stack].metadata || {}).find(([_key, value]) => value[0]?.type === "aws:cdk:logicalId" && value[0]?.data === id)?.[0] || "";
98
- const readable = found
99
- .split("/")
100
- .filter(Boolean)
101
- .slice(1, -1)
102
- .join("/");
103
- Colors.line(` ${Colors.danger.bold(readable)}: ${error}`);
101
+ const readable = Stacks.logicalIdToCdkPath(assembly, stack, id);
102
+ Colors.line(` ${Colors.danger.bold(readable + ":")} ${error}`);
104
103
  }
105
104
  }
106
105
  Colors.gap();
package/cli/ui/header.js CHANGED
@@ -1,12 +1,15 @@
1
+ import { useProject } from "../../project.js";
1
2
  import { Colors } from "../colors.js";
2
3
  import { useLocalServerConfig } from "../local/server.js";
3
4
  export async function printHeader(input) {
4
- const local = await useLocalServerConfig();
5
+ const project = useProject();
5
6
  Colors.line(`${Colors.primary.bold("SST v2.0.4")} ${Colors.dim(`ready!`)}`);
6
7
  Colors.gap();
7
- Colors.line(`${Colors.primary(`➜`)} ${Colors.bold("Stage:")} dev`);
8
- if (input.console)
8
+ Colors.line(`${Colors.primary(`➜`)} ${Colors.bold("Stage:")} ${project.config.stage}`);
9
+ if (input.console) {
10
+ const local = await useLocalServerConfig();
9
11
  Colors.line(`${Colors.primary(`➜`)} ${Colors.bold("Console:")} ${Colors.link(local.url)}`);
12
+ }
10
13
  Colors.gap();
11
14
  }
12
15
  export function printConsole() { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst",
3
- "version": "2.0.0-rc.43",
3
+ "version": "2.0.0-rc.45",
4
4
  "bin": {
5
5
  "sst": "cli/sst.js"
6
6
  },
package/project.js CHANGED
@@ -81,6 +81,7 @@ export async function initProject(globals) {
81
81
  await initBootstrap();
82
82
  dotenv.config({
83
83
  path: path.join(project.paths.root, `.env.${project.config.stage}`),
84
+ override: true,
84
85
  });
85
86
  Logger.debug("Config loaded", project);
86
87
  }
package/sst.mjs CHANGED
@@ -1101,6 +1101,17 @@ async function loadAssembly(from) {
1101
1101
  const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
1102
1102
  return new CloudAssembly(from);
1103
1103
  }
1104
+ function logicalIdToCdkPath(assembly, stack, logicalId) {
1105
+ const found = Object.entries(
1106
+ assembly.manifest.artifacts?.[stack].metadata || {}
1107
+ ).find(
1108
+ ([_key, value]) => value[0]?.type === "aws:cdk:logicalId" && value[0]?.data === logicalId
1109
+ )?.[0];
1110
+ if (!found) {
1111
+ return logicalId;
1112
+ }
1113
+ return found.split("/").filter(Boolean).slice(1, -1).join("/");
1114
+ }
1104
1115
  var init_assembly = __esm({
1105
1116
  "src/stacks/assembly.ts"() {
1106
1117
  "use strict";
@@ -3993,6 +4004,7 @@ __export(stacks_exports, {
3993
4004
  isSuccess: () => isSuccess,
3994
4005
  load: () => load,
3995
4006
  loadAssembly: () => loadAssembly,
4007
+ logicalIdToCdkPath: () => logicalIdToCdkPath,
3996
4008
  metadata: () => metadata,
3997
4009
  metadataForStack: () => metadataForStack,
3998
4010
  monitor: () => monitor,
@@ -4338,7 +4350,8 @@ async function initProject(globals) {
4338
4350
  const { initBootstrap: initBootstrap2 } = await Promise.resolve().then(() => (init_bootstrap(), bootstrap_exports));
4339
4351
  await initBootstrap2();
4340
4352
  dotenv.config({
4341
- path: path13.join(project.paths.root, `.env.${project.config.stage}`)
4353
+ path: path13.join(project.paths.root, `.env.${project.config.stage}`),
4354
+ override: true
4342
4355
  });
4343
4356
  Logger.debug("Config loaded", project);
4344
4357
  }
@@ -5121,44 +5134,38 @@ import React, { useState, useEffect } from "react";
5121
5134
  import { Box, Text } from "ink";
5122
5135
  import inkSpinner from "ink-spinner";
5123
5136
  function printDeploymentResults(assembly, results) {
5124
- Colors.gap();
5125
- Colors.line(Colors.success(`\u2714`), Colors.bold(` Deployed`));
5126
- for (const [stack, result] of Object.entries(results)) {
5127
- if (Object.values(result.errors).length)
5128
- continue;
5129
- const outputs = Object.entries(result.outputs).filter(([key, _]) => {
5130
- if (key.startsWith("Export"))
5131
- return false;
5132
- if (key.includes("SstSiteEnv"))
5133
- return false;
5134
- if (key === "SSTMetadata")
5135
- return false;
5136
- return true;
5137
- });
5138
- Colors.line(` ${Colors.dim(stack)}`);
5139
- if (outputs.length > 0) {
5140
- for (const key of Object.keys(Object.fromEntries(outputs)).sort()) {
5141
- const value = result.outputs[key];
5142
- Colors.line(` ${Colors.bold.dim(key)}: ${value}`);
5137
+ const success = Object.entries(results).filter(([_stack, result]) => Object.keys(result.errors).length === 0);
5138
+ if (success.length) {
5139
+ Colors.gap();
5140
+ Colors.line(Colors.success(`\u2714`), Colors.bold(` Deployed`));
5141
+ for (const [stack, result] of success) {
5142
+ const outputs = Object.entries(result.outputs).filter(([key, _]) => {
5143
+ if (key.startsWith("Export"))
5144
+ return false;
5145
+ if (key.includes("SstSiteEnv"))
5146
+ return false;
5147
+ if (key === "SSTMetadata")
5148
+ return false;
5149
+ return true;
5150
+ });
5151
+ Colors.line(` ${Colors.dim(stack)}`);
5152
+ if (outputs.length > 0) {
5153
+ for (const key of Object.keys(Object.fromEntries(outputs)).sort()) {
5154
+ const value = result.outputs[key];
5155
+ Colors.line(` ${Colors.bold.dim(key + ":")} ${value}`);
5156
+ }
5143
5157
  }
5144
5158
  }
5145
5159
  }
5146
- Colors.gap();
5147
- if (Object.values(results).flatMap((s) => Object.keys(s.errors)).length) {
5160
+ const failed = Object.entries(results).filter(([_stack, result]) => Object.keys(result.errors).length > 0);
5161
+ if (failed.length) {
5162
+ Colors.gap();
5148
5163
  Colors.line(`${Colors.danger(`\u2716`)} ${Colors.bold.dim(`Errors`)}`);
5149
- for (const [stack, result] of Object.entries(results)) {
5150
- const hasErrors = Object.entries(result.errors).length > 0;
5151
- if (!hasErrors)
5152
- continue;
5164
+ for (const [stack, result] of failed) {
5153
5165
  Colors.line(` ${Colors.dim(stack)}`);
5154
5166
  for (const [id, error2] of Object.entries(result.errors)) {
5155
- const found = Object.entries(
5156
- assembly.manifest.artifacts?.[stack].metadata || {}
5157
- ).find(
5158
- ([_key, value]) => value[0]?.type === "aws:cdk:logicalId" && value[0]?.data === id
5159
- )?.[0] || "";
5160
- const readable = found.split("/").filter(Boolean).slice(1, -1).join("/");
5161
- Colors.line(` ${Colors.danger.bold(readable)}: ${error2}`);
5167
+ const readable = stacks_exports.logicalIdToCdkPath(assembly, stack, id);
5168
+ Colors.line(` ${Colors.danger.bold(readable + ":")} ${error2}`);
5162
5169
  }
5163
5170
  }
5164
5171
  Colors.gap();
@@ -5185,11 +5192,10 @@ var init_deploy2 = __esm({
5185
5192
  return;
5186
5193
  setResources((previous2) => {
5187
5194
  if (stacks_exports.isFinal(event2.ResourceStatus)) {
5195
+ const readable = stacks_exports.logicalIdToCdkPath(props.assembly, event2.StackName, event2.LogicalResourceId);
5188
5196
  Colors.line(
5189
5197
  Colors.warning(Colors.prefix),
5190
- Colors.dim(
5191
- `${event2.StackName} ${event2.ResourceType} ${event2.LogicalResourceId}`
5192
- ),
5198
+ Colors.dim(`${event2.StackName} ${readable} ${event2.ResourceType}`),
5193
5199
  stacks_exports.isFailed(event2.ResourceStatus) ? Colors.danger(event2.ResourceStatus) : Colors.dim(event2.ResourceStatus)
5194
5200
  );
5195
5201
  const { [event2.LogicalResourceId]: _, ...next } = previous2;
@@ -5213,8 +5219,9 @@ var init_deploy2 = __esm({
5213
5219
  return "yellow";
5214
5220
  }
5215
5221
  return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, Object.entries(resources).map(([_, evt]) => {
5216
- return /* @__PURE__ */ React.createElement(Box, { key: evt.LogicalResourceId }, /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Spinner, null), " ", evt.StackName, " ", evt.ResourceType, " ", evt.LogicalResourceId, " "), /* @__PURE__ */ React.createElement(Text, { color: color(evt.ResourceStatus || "") }, evt.ResourceStatus));
5217
- }), Object.entries(resources).length === 0 && /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Spinner, null), " ", /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "Waiting for changes"))));
5222
+ const readable = stacks_exports.logicalIdToCdkPath(props.assembly, evt.StackName, evt.LogicalResourceId);
5223
+ return /* @__PURE__ */ React.createElement(Box, { key: evt.LogicalResourceId }, /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Spinner, null), " ", evt.StackName, " ", readable, " ", evt.ResourceType, " "), /* @__PURE__ */ React.createElement(Text, { color: color(evt.ResourceStatus || "") }, evt.ResourceStatus));
5224
+ }), Object.entries(resources).length === 0 && /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, null, /* @__PURE__ */ React.createElement(Spinner, null), " ")));
5218
5225
  };
5219
5226
  }
5220
5227
  });
@@ -5904,19 +5911,24 @@ init_colors();
5904
5911
  import chalk2 from "chalk";
5905
5912
 
5906
5913
  // src/cli/ui/header.ts
5914
+ init_project();
5907
5915
  init_colors();
5908
5916
  init_server2();
5909
5917
  async function printHeader(input) {
5910
- const local = await useLocalServerConfig();
5918
+ const project = useProject();
5911
5919
  Colors.line(`${Colors.primary.bold("SST v2.0.4")} ${Colors.dim(`ready!`)}`);
5912
5920
  Colors.gap();
5913
- Colors.line(`${Colors.primary(`\u279C`)} ${Colors.bold("Stage:")} dev`);
5914
- if (input.console)
5921
+ Colors.line(
5922
+ `${Colors.primary(`\u279C`)} ${Colors.bold("Stage:")} ${project.config.stage}`
5923
+ );
5924
+ if (input.console) {
5925
+ const local = await useLocalServerConfig();
5915
5926
  Colors.line(
5916
5927
  `${Colors.primary(`\u279C`)} ${Colors.bold("Console:")} ${Colors.link(
5917
5928
  local.url
5918
5929
  )}`
5919
5930
  );
5931
+ }
5920
5932
  Colors.gap();
5921
5933
  }
5922
5934
 
@@ -6068,6 +6080,7 @@ var dev = (program2) => program2.command(
6068
6080
  project2.metafile = metafile;
6069
6081
  project2.stacks = sstConfig.stacks;
6070
6082
  const assembly = await Stacks.synth({
6083
+ increaseTimeout: args["increase-timeout"],
6071
6084
  fn: project2.stacks,
6072
6085
  outDir: `.sst/cdk.out`,
6073
6086
  mode: "dev"
@@ -6111,7 +6124,7 @@ var dev = (program2) => program2.command(
6111
6124
  if (lastDeployed)
6112
6125
  console.log();
6113
6126
  const component = render(
6114
- /* @__PURE__ */ React2.createElement(DeploymentUI2, { stacks: assembly.stacks.map((s) => s.stackName) })
6127
+ /* @__PURE__ */ React2.createElement(DeploymentUI2, { assembly })
6115
6128
  );
6116
6129
  const results = await Stacks.deployMany(assembly.stacks);
6117
6130
  component.clear();
@@ -6294,7 +6307,7 @@ var deploy2 = (program2) => program2.command(
6294
6307
  process.exit(1);
6295
6308
  }
6296
6309
  const component = render(
6297
- /* @__PURE__ */ React2.createElement(DeploymentUI2, { stacks: assembly.stacks.map((s) => s.stackName) })
6310
+ /* @__PURE__ */ React2.createElement(DeploymentUI2, { assembly })
6298
6311
  );
6299
6312
  const results = await Stacks.deployMany(assembly.stacks);
6300
6313
  component.clear();
@@ -6351,7 +6364,7 @@ var remove2 = (program2) => program2.command(
6351
6364
  process.exit(1);
6352
6365
  }
6353
6366
  const component = render(
6354
- /* @__PURE__ */ React2.createElement(DeploymentUI2, { stacks: assembly.stacks.map((s) => s.stackName) })
6367
+ /* @__PURE__ */ React2.createElement(DeploymentUI2, { assembly })
6355
6368
  );
6356
6369
  const results = await Stacks.removeMany(target);
6357
6370
  component.clear();
@@ -6758,7 +6771,9 @@ var diff2 = (program2) => program2.command(
6758
6771
  );
6759
6772
 
6760
6773
  // src/cli/sst.ts
6761
- dotenv2.config();
6774
+ dotenv2.config({
6775
+ override: true
6776
+ });
6762
6777
  dev(program);
6763
6778
  deploy2(program);
6764
6779
  build(program);
@@ -1 +1,3 @@
1
- export declare function loadAssembly(from: string): Promise<import("aws-cdk-lib/cx-api").CloudAssembly>;
1
+ import type { CloudAssembly } from "aws-cdk-lib/cx-api";
2
+ export declare function loadAssembly(from: string): Promise<CloudAssembly>;
3
+ export declare function logicalIdToCdkPath(assembly: CloudAssembly, stack: string, logicalId: string): string;
@@ -2,3 +2,14 @@ export async function loadAssembly(from) {
2
2
  const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
3
3
  return new CloudAssembly(from);
4
4
  }
5
+ export function logicalIdToCdkPath(assembly, stack, logicalId) {
6
+ const found = Object.entries(assembly.manifest.artifacts?.[stack].metadata || {}).find(([_key, value]) => value[0]?.type === "aws:cdk:logicalId" && value[0]?.data === logicalId)?.[0];
7
+ if (!found) {
8
+ return logicalId;
9
+ }
10
+ return found
11
+ .split("/")
12
+ .filter(Boolean)
13
+ .slice(1, -1)
14
+ .join("/");
15
+ }