sst 2.0.0-rc.31 → 2.0.0-rc.34
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/bus.js +1 -1
- package/cli/colors.d.ts +7 -0
- package/cli/colors.js +7 -0
- package/cli/commands/bind.d.ts +2 -0
- package/cli/commands/build.d.ts +2 -0
- package/cli/commands/console.d.ts +2 -0
- package/cli/commands/deploy.d.ts +2 -2
- package/cli/commands/deploy.js +17 -23
- package/cli/commands/dev.d.ts +1 -1
- package/cli/commands/dev.js +97 -45
- package/cli/commands/diff.d.ts +2 -0
- package/cli/commands/env.d.ts +2 -0
- package/cli/commands/remove.d.ts +2 -2
- package/cli/commands/remove.js +13 -27
- package/cli/commands/secrets/get.d.ts +2 -0
- package/cli/commands/secrets/list.d.ts +2 -0
- package/cli/commands/secrets/remove.d.ts +2 -0
- package/cli/commands/secrets/set.d.ts +2 -0
- package/cli/commands/update.d.ts +2 -0
- package/cli/commands/version.d.ts +2 -0
- package/cli/program.d.ts +2 -0
- package/cli/program.js +7 -0
- package/cli/ui/deploy.d.ts +2 -1
- package/cli/ui/deploy.js +54 -83
- package/cli/ui/functions.d.ts +2 -0
- package/cli/ui/functions.js +128 -0
- package/constructs/Stack.js +2 -2
- package/logger.js +2 -0
- package/package.json +2 -1
- package/runtime/server.js +1 -0
- package/runtime/workers.d.ts +1 -0
- package/runtime/workers.js +3 -1
- package/sst.mjs +354 -227
- package/stacks/monitor.d.ts +6 -2
- package/stacks/monitor.js +22 -3
- package/stacks/synth.js +1 -1
- package/support/bridge/bridge.mjs +28 -28
package/bus.js
CHANGED
package/cli/colors.d.ts
ADDED
package/cli/colors.js
ADDED
package/cli/commands/bind.d.ts
CHANGED
package/cli/commands/build.d.ts
CHANGED
package/cli/commands/deploy.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export declare const deploy: (program: Program) => import("yargs").Argv<{
|
|
|
7
7
|
} & {
|
|
8
8
|
region: string | undefined;
|
|
9
9
|
} & {
|
|
10
|
-
|
|
10
|
+
verbose: boolean | undefined;
|
|
11
11
|
} & {
|
|
12
|
-
|
|
12
|
+
from: string | undefined;
|
|
13
13
|
} & {
|
|
14
14
|
filter: string | undefined;
|
|
15
15
|
}>;
|
package/cli/commands/deploy.js
CHANGED
|
@@ -2,11 +2,6 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
|
|
|
2
2
|
.option("from", {
|
|
3
3
|
type: "string",
|
|
4
4
|
describe: "Deploy using previously built output",
|
|
5
|
-
})
|
|
6
|
-
.option("fullscreen", {
|
|
7
|
-
type: "boolean",
|
|
8
|
-
describe: "Disable full screen UI",
|
|
9
|
-
default: true,
|
|
10
5
|
})
|
|
11
6
|
.positional("filter", {
|
|
12
7
|
type: "string",
|
|
@@ -16,23 +11,33 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
|
|
|
16
11
|
const { printDeploymentResults } = await import("../ui/deploy.js");
|
|
17
12
|
const { createSpinner } = await import("../spinner.js");
|
|
18
13
|
const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
|
|
19
|
-
const { blue, bold } = await import("colorette");
|
|
14
|
+
const { dim, blue, bold } = await import("colorette");
|
|
20
15
|
const { useProject } = await import("../../project.js");
|
|
21
16
|
const { Stacks } = await import("../../stacks/index.js");
|
|
22
17
|
const { render } = await import("ink");
|
|
23
18
|
const { DeploymentUI } = await import("../ui/deploy.js");
|
|
19
|
+
const { Colors } = await import("../colors.js");
|
|
24
20
|
const project = useProject();
|
|
21
|
+
console.log();
|
|
22
|
+
console.log(` ${Colors.primary(`${bold(`SST`)} v${project.version}`)}`);
|
|
23
|
+
console.log();
|
|
24
|
+
console.log(` ${Colors.primary(`➜`)} ${bold(`Stage:`)} ${dim(project.config.stage)}`);
|
|
25
|
+
console.log();
|
|
25
26
|
const assembly = await (async function () {
|
|
26
27
|
if (args.from) {
|
|
27
28
|
const result = new CloudAssembly(args.from);
|
|
28
29
|
return result;
|
|
29
30
|
}
|
|
30
|
-
const spinner = createSpinner(
|
|
31
|
+
const spinner = createSpinner({
|
|
32
|
+
text: " Building stacks",
|
|
33
|
+
indent: 2,
|
|
34
|
+
});
|
|
31
35
|
const result = await Stacks.synth({
|
|
32
36
|
fn: project.stacks,
|
|
33
37
|
mode: "deploy",
|
|
34
38
|
});
|
|
35
39
|
spinner.succeed();
|
|
40
|
+
console.log();
|
|
36
41
|
return result;
|
|
37
42
|
})();
|
|
38
43
|
const target = assembly.stacks.filter((s) => !args.filter ||
|
|
@@ -41,22 +46,11 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
|
|
|
41
46
|
console.log(`No stacks found matching ${blue(args.filter)}`);
|
|
42
47
|
process.exit(1);
|
|
43
48
|
}
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return () => {
|
|
50
|
-
component.unmount();
|
|
51
|
-
process.stdout.write("\x1b[?1049l");
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const spinner = createSpinner("Deploying stacks");
|
|
55
|
-
return () => spinner.succeed();
|
|
56
|
-
})();
|
|
57
|
-
const results = await Stacks.deployMany(target);
|
|
58
|
-
cleanup();
|
|
59
|
-
printDeploymentResults(results);
|
|
49
|
+
const component = render(React.createElement(DeploymentUI, { stacks: assembly.stacks.map((s) => s.stackName) }));
|
|
50
|
+
const results = await Stacks.deployMany(assembly.stacks);
|
|
51
|
+
component.clear();
|
|
52
|
+
component.unmount();
|
|
53
|
+
printDeploymentResults(assembly, results);
|
|
60
54
|
if (Object.values(results).some((stack) => Stacks.isFailed(stack.status)))
|
|
61
55
|
process.exit(1);
|
|
62
56
|
process.exit(0);
|
package/cli/commands/dev.d.ts
CHANGED
package/cli/commands/dev.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}), async (args) => {
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { Colors } from "../colors.js";
|
|
3
|
+
import { Functions } from "../ui/functions.js";
|
|
4
|
+
export const dev = (program) => program.command(["dev", "start"], "Work on your app locally", (yargs) => yargs, async (args) => {
|
|
6
5
|
const { useRuntimeWorkers } = await import("../../runtime/workers.js");
|
|
7
6
|
const { useIOTBridge } = await import("../../runtime/iot.js");
|
|
8
7
|
const { useRuntimeServer } = await import("../../runtime/server.js");
|
|
@@ -33,36 +32,65 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
|
|
|
33
32
|
console.log(yellow(`Warning: ${bold(`sst start`)} has been renamed to ${bold(`sst dev`)}`));
|
|
34
33
|
}
|
|
35
34
|
const useFunctionLogger = Context.memo(async () => {
|
|
35
|
+
const component = render(React.createElement(Functions, null));
|
|
36
36
|
const bus = useBus();
|
|
37
|
+
/*
|
|
37
38
|
bus.subscribe("function.invoked", async (evt) => {
|
|
38
|
-
|
|
39
|
+
console.log(
|
|
40
|
+
bold(magenta(` ➜ `)),
|
|
41
|
+
useFunctions().fromID(evt.properties.functionID).handler!
|
|
42
|
+
);
|
|
39
43
|
});
|
|
44
|
+
|
|
40
45
|
bus.subscribe("function.build.success", async (evt) => {
|
|
41
|
-
|
|
46
|
+
console.log(
|
|
47
|
+
bold(gray(`Built `)),
|
|
48
|
+
useFunctions().fromID(evt.properties.functionID).handler!
|
|
49
|
+
);
|
|
42
50
|
});
|
|
43
51
|
bus.subscribe("function.build.failed", async (evt) => {
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
console.log(
|
|
53
|
+
bold(red(`Build failed `)),
|
|
54
|
+
useFunctions().fromID(evt.properties.functionID).handler!
|
|
55
|
+
);
|
|
56
|
+
console.log(dim(evt.properties.errors.join("\n")));
|
|
46
57
|
});
|
|
58
|
+
|
|
47
59
|
bus.subscribe("worker.stdout", async (evt) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
const { message } = evt.properties;
|
|
61
|
+
const lines = message.split("\n");
|
|
62
|
+
for (let i = 0; i < lines.length; i++) {
|
|
63
|
+
const line = lines[i];
|
|
64
|
+
lines[i] = " " + line;
|
|
65
|
+
}
|
|
66
|
+
console.log(
|
|
67
|
+
bold(blue(` ➜ `)),
|
|
68
|
+
useFunctions().fromID(evt.properties.functionID).handler!
|
|
69
|
+
);
|
|
70
|
+
console.log(dim(lines.join("\n")));
|
|
56
71
|
});
|
|
72
|
+
*/
|
|
73
|
+
/*
|
|
57
74
|
bus.subscribe("function.success", async (evt) => {
|
|
58
|
-
|
|
75
|
+
console.log(
|
|
76
|
+
bold(green(` ✔ `)),
|
|
77
|
+
useFunctions().fromID(evt.properties.functionID).handler!
|
|
78
|
+
);
|
|
79
|
+
console.log();
|
|
59
80
|
});
|
|
81
|
+
*/
|
|
82
|
+
/*
|
|
60
83
|
bus.subscribe("function.error", async (evt) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
84
|
+
console.log(
|
|
85
|
+
bold(red(` ✖ `)),
|
|
86
|
+
useFunctions().fromID(evt.properties.functionID).handler!
|
|
87
|
+
);
|
|
88
|
+
console.log(` ${Colors.danger(evt.properties.errorMessage)}`);
|
|
89
|
+
for (const line of evt.properties.trace || []) {
|
|
90
|
+
console.log(` ${dim(line)}`);
|
|
91
|
+
}
|
|
65
92
|
});
|
|
93
|
+
*/
|
|
66
94
|
});
|
|
67
95
|
const useStackBuilder = Context.memo(async () => {
|
|
68
96
|
const watcher = useWatcher();
|
|
@@ -72,7 +100,13 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
|
|
|
72
100
|
let pending;
|
|
73
101
|
let isDeploying = false;
|
|
74
102
|
async function build() {
|
|
75
|
-
const spinner = createSpinner(
|
|
103
|
+
const spinner = createSpinner({
|
|
104
|
+
indent: 2,
|
|
105
|
+
color: "gray",
|
|
106
|
+
text: lastDeployed
|
|
107
|
+
? ` Building stacks`
|
|
108
|
+
: dim(` Checking for changes`),
|
|
109
|
+
}).start();
|
|
76
110
|
try {
|
|
77
111
|
const [metafile, sstConfig] = await Stacks.load(project.paths.config);
|
|
78
112
|
project.metafile = metafile;
|
|
@@ -86,17 +120,27 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
|
|
|
86
120
|
const next = await checksum(assembly.directory);
|
|
87
121
|
Logger.debug("Checksum", "next", next, "old", lastDeployed);
|
|
88
122
|
if (next === lastDeployed) {
|
|
89
|
-
spinner.succeed("
|
|
123
|
+
spinner.succeed(" No changes");
|
|
124
|
+
console.log();
|
|
90
125
|
return;
|
|
91
126
|
}
|
|
92
|
-
|
|
127
|
+
if (!lastDeployed) {
|
|
128
|
+
spinner.stop();
|
|
129
|
+
spinner.clear();
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
spinner.succeed(` Stacks built!`);
|
|
133
|
+
}
|
|
93
134
|
pending = assembly;
|
|
94
135
|
if (lastDeployed)
|
|
95
|
-
deploy();
|
|
136
|
+
setTimeout(() => deploy(), 100);
|
|
96
137
|
}
|
|
97
138
|
catch (ex) {
|
|
98
139
|
spinner.fail();
|
|
99
|
-
console.
|
|
140
|
+
console.log(ex.stack
|
|
141
|
+
.split("\n")
|
|
142
|
+
.map((line) => " " + line)
|
|
143
|
+
.join("\n"));
|
|
100
144
|
}
|
|
101
145
|
}
|
|
102
146
|
async function deploy() {
|
|
@@ -108,22 +152,14 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
|
|
|
108
152
|
const assembly = pending;
|
|
109
153
|
const nextChecksum = await checksum(assembly.directory);
|
|
110
154
|
pending = undefined;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
process.stdout.write("\x1b[?1049h");
|
|
114
|
-
const component = render(React.createElement(DeploymentUI, { stacks: assembly.stacks.map((s) => s.stackName) }));
|
|
115
|
-
return () => {
|
|
116
|
-
component.unmount();
|
|
117
|
-
process.stdout.write("\x1b[?1049l");
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
const spinner = createSpinner("Deploying stacks");
|
|
121
|
-
return () => spinner.succeed();
|
|
122
|
-
})();
|
|
155
|
+
console.log();
|
|
156
|
+
const component = render(React.createElement(DeploymentUI, { stacks: assembly.stacks.map((s) => s.stackName) }));
|
|
123
157
|
const results = await Stacks.deployMany(assembly.stacks);
|
|
124
|
-
|
|
158
|
+
component.clear();
|
|
159
|
+
component.unmount();
|
|
160
|
+
render(React.createElement(Functions, null));
|
|
125
161
|
lastDeployed = nextChecksum;
|
|
126
|
-
printDeploymentResults(results);
|
|
162
|
+
printDeploymentResults(assembly, results);
|
|
127
163
|
const keys = await SiteEnv.keys();
|
|
128
164
|
if (keys.length) {
|
|
129
165
|
const result = {};
|
|
@@ -169,10 +205,26 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
|
|
|
169
205
|
await build();
|
|
170
206
|
await deploy();
|
|
171
207
|
});
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
208
|
+
const project = useProject();
|
|
209
|
+
const primary = chalk.hex("#E27152");
|
|
210
|
+
const link = chalk.cyan;
|
|
211
|
+
console.clear();
|
|
212
|
+
console.log();
|
|
213
|
+
console.log(` ${Colors.primary(`${bold(`SST`)} v${project.version}`)} ${dim(`ready!`)}`);
|
|
214
|
+
console.log();
|
|
215
|
+
console.log(` ${primary(`➜`)} ${bold(`Stage:`)} ${dim(project.config.stage)}`);
|
|
216
|
+
console.log(` ${primary(`➜`)} ${bold(`Console:`)} ${link(`https://console.sst.dev/${project.config.name}/${project.config.stage}`)}`);
|
|
217
|
+
/*
|
|
218
|
+
console.log(` ${primary(`➜`)} ${bold(dim(`Outputs:`))}`);
|
|
219
|
+
for (let i = 0; i < 3; i++) {
|
|
220
|
+
console.log(` ${dim(`thdxr-scratch-MyStack`)}`);
|
|
221
|
+
console.log(
|
|
222
|
+
` ${bold(
|
|
223
|
+
dim(`ApiEndpoint`)
|
|
224
|
+
)}: https://hdq3z0es2d.execute-api.us-east-1.amazonaws.com`
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
*/
|
|
176
228
|
await Promise.all([
|
|
177
229
|
useLocalServer({
|
|
178
230
|
key: "",
|
package/cli/commands/diff.d.ts
CHANGED
package/cli/commands/env.d.ts
CHANGED
package/cli/commands/remove.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export declare const remove: (program: Program) => import("yargs").Argv<{
|
|
|
7
7
|
} & {
|
|
8
8
|
region: string | undefined;
|
|
9
9
|
} & {
|
|
10
|
-
|
|
10
|
+
verbose: boolean | undefined;
|
|
11
11
|
} & {
|
|
12
|
-
|
|
12
|
+
from: string | undefined;
|
|
13
13
|
} & {
|
|
14
14
|
filter: string | undefined;
|
|
15
15
|
}>;
|
package/cli/commands/remove.js
CHANGED
|
@@ -1,57 +1,43 @@
|
|
|
1
|
-
export const remove = (program) => program.command("remove [filter]", "Remove your app from AWS", (yargs) => yargs
|
|
2
|
-
.option("from", { type: "string" })
|
|
3
|
-
.option("fullscreen", {
|
|
4
|
-
type: "boolean",
|
|
5
|
-
describe: "Disable full screen UI",
|
|
6
|
-
default: true,
|
|
7
|
-
})
|
|
8
|
-
.positional("filter", {
|
|
1
|
+
export const remove = (program) => program.command("remove [filter]", "Remove your app from AWS", (yargs) => yargs.option("from", { type: "string" }).positional("filter", {
|
|
9
2
|
type: "string",
|
|
10
3
|
describe: "Optionally filter stacks to remove",
|
|
11
4
|
}), async (args) => {
|
|
12
5
|
const React = await import("react");
|
|
13
6
|
const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
|
|
14
|
-
const { blue, bold } = await import("colorette");
|
|
7
|
+
const { dim, blue, bold } = await import("colorette");
|
|
15
8
|
const { useProject } = await import("../../project.js");
|
|
16
9
|
const { Stacks } = await import("../../stacks/index.js");
|
|
17
10
|
const { render } = await import("ink");
|
|
18
11
|
const { DeploymentUI } = await import("../ui/deploy.js");
|
|
19
12
|
const { printDeploymentResults } = await import("../ui/deploy.js");
|
|
20
|
-
const {
|
|
13
|
+
const { Colors } = await import("../colors.js");
|
|
14
|
+
const project = useProject();
|
|
15
|
+
console.log();
|
|
16
|
+
console.log(` ${Colors.primary(`${bold(`SST`)} v${project.version}`)}`);
|
|
17
|
+
console.log();
|
|
18
|
+
console.log(` ${Colors.primary(`➜`)} ${bold(`Stage:`)} ${dim(project.config.stage)}`);
|
|
19
|
+
console.log();
|
|
21
20
|
const assembly = await (async function () {
|
|
22
21
|
if (args.from) {
|
|
23
22
|
const result = new CloudAssembly(args.from);
|
|
24
23
|
return result;
|
|
25
24
|
}
|
|
26
|
-
const project = useProject();
|
|
27
25
|
return await Stacks.synth({
|
|
28
26
|
fn: project.stacks,
|
|
29
27
|
mode: "remove",
|
|
30
28
|
});
|
|
31
29
|
})();
|
|
32
|
-
const project = useProject();
|
|
33
30
|
const target = assembly.stacks.filter((s) => !args.filter ||
|
|
34
31
|
s.stackName.toLowerCase().includes(args.filter.toLowerCase()));
|
|
35
32
|
if (!target.length) {
|
|
36
33
|
console.log(`No stacks found matching ${blue(args.filter)}`);
|
|
37
34
|
process.exit(1);
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
const cleanup = (() => {
|
|
41
|
-
if (args.fullscreen) {
|
|
42
|
-
process.stdout.write("\x1b[?1049h");
|
|
43
|
-
const component = render(React.createElement(DeploymentUI, { stacks: assembly.stacks.map((s) => s.stackName) }));
|
|
44
|
-
return () => {
|
|
45
|
-
component.unmount();
|
|
46
|
-
process.stdout.write("\x1b[?1049l");
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
const spinner = createSpinner("Removing stacks");
|
|
50
|
-
return () => spinner.succeed();
|
|
51
|
-
})();
|
|
36
|
+
const component = render(React.createElement(DeploymentUI, { stacks: assembly.stacks.map((s) => s.stackName) }));
|
|
52
37
|
const results = await Stacks.removeMany(target);
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
component.clear();
|
|
39
|
+
component.unmount();
|
|
40
|
+
printDeploymentResults(assembly, results);
|
|
55
41
|
if (Object.values(results).some((stack) => Stacks.isFailed(stack.status)))
|
|
56
42
|
process.exit(1);
|
|
57
43
|
process.exit(0);
|
package/cli/commands/update.d.ts
CHANGED
package/cli/program.d.ts
CHANGED
package/cli/program.js
CHANGED
|
@@ -13,9 +13,16 @@ export const program = yargs(hideBin(process.argv))
|
|
|
13
13
|
.option("region", {
|
|
14
14
|
type: "string",
|
|
15
15
|
describe: "The AWS region to use",
|
|
16
|
+
})
|
|
17
|
+
.option("verbose", {
|
|
18
|
+
type: "boolean",
|
|
19
|
+
describe: "Print verbose logs",
|
|
16
20
|
})
|
|
17
21
|
.group(["stage", "profile", "region", "help"], "Global:")
|
|
18
22
|
.middleware(async (argv) => {
|
|
23
|
+
if (argv.verbose) {
|
|
24
|
+
process.env.SST_VERBOSE = "1";
|
|
25
|
+
}
|
|
19
26
|
if (argv._.length > 0) {
|
|
20
27
|
const { initProject } = await import("../project.js");
|
|
21
28
|
await initProject(argv);
|
package/cli/ui/deploy.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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
4
|
interface Props {
|
|
4
5
|
stacks: string[];
|
|
5
6
|
}
|
|
6
7
|
export declare const DeploymentUI: (props: Props) => JSX.Element;
|
|
7
|
-
export declare function printDeploymentResults(results: Awaited<ReturnType<typeof Stacks.deployMany>>): void;
|
|
8
|
+
export declare function printDeploymentResults(assembly: CloudAssembly, results: Awaited<ReturnType<typeof Stacks.deployMany>>): void;
|
|
8
9
|
export {};
|