sst 2.0.0-rc.50 → 2.0.0-rc.51
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/cli/commands/deploy.js +4 -0
- package/cli/commands/dev.js +4 -1
- package/cli/ui/deploy.js +5 -12
- package/package.json +1 -1
- package/project.js +3 -1
- package/sst.mjs +82 -58
- package/stacks/deploy.js +2 -2
- package/stacks/monitor.d.ts +1 -0
- package/stacks/monitor.js +9 -1
package/cli/commands/deploy.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useSTSIdentity } from "../../credentials.js";
|
|
2
2
|
import { Colors } from "../colors.js";
|
|
3
|
+
import fs from "fs/promises";
|
|
4
|
+
import path from "path";
|
|
3
5
|
export const deploy = (program) => program.command("deploy [filter]", "Deploy your app to AWS", (yargs) => yargs
|
|
4
6
|
.option("from", {
|
|
5
7
|
type: "string",
|
|
@@ -17,6 +19,7 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
|
|
|
17
19
|
const { loadAssembly, Stacks } = await import("../../stacks/index.js");
|
|
18
20
|
const { render } = await import("ink");
|
|
19
21
|
const { DeploymentUI } = await import("../ui/deploy.js");
|
|
22
|
+
const { mapValues } = await import("remeda");
|
|
20
23
|
const project = useProject();
|
|
21
24
|
const identity = await useSTSIdentity();
|
|
22
25
|
Colors.line(`${Colors.primary.bold(`SST v${project.version}`)}`);
|
|
@@ -57,5 +60,6 @@ export const deploy = (program) => program.command("deploy [filter]", "Deploy yo
|
|
|
57
60
|
printDeploymentResults(assembly, results);
|
|
58
61
|
if (Object.values(results).some((stack) => Stacks.isFailed(stack.status)))
|
|
59
62
|
process.exit(1);
|
|
63
|
+
fs.writeFile(path.join(project.paths.out, "outputs.json"), JSON.stringify(mapValues(results, (val) => val.outputs), null, 2));
|
|
60
64
|
process.exit(0);
|
|
61
65
|
});
|
package/cli/commands/dev.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { Colors } from "../colors.js";
|
|
3
3
|
import { printHeader } from "../ui/header.js";
|
|
4
|
+
import { mapValues } from "remeda";
|
|
4
5
|
export const dev = (program) => program.command(["dev", "start"], "Work on your app locally", (yargs) => yargs.option("increase-timeout", {
|
|
5
6
|
type: "boolean",
|
|
6
7
|
description: "Increase function timeout",
|
|
@@ -81,9 +82,10 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
|
|
|
81
82
|
});
|
|
82
83
|
bus.subscribe("function.success", async (evt) => {
|
|
83
84
|
// stdout logs sometimes come in after
|
|
85
|
+
const p = prefix(evt.properties.requestID);
|
|
84
86
|
const req = pending.get(evt.properties.requestID);
|
|
85
87
|
setTimeout(() => {
|
|
86
|
-
Colors.line(
|
|
88
|
+
Colors.line(p, Colors.dim(`Done in ${Date.now() - req.started - 100}ms`));
|
|
87
89
|
end(evt.properties.requestID);
|
|
88
90
|
}, 100);
|
|
89
91
|
});
|
|
@@ -181,6 +183,7 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
|
|
|
181
183
|
}
|
|
182
184
|
await SiteEnv.writeValues(result);
|
|
183
185
|
}
|
|
186
|
+
fs.writeFile(path.join(project.paths.out, "outputs.json"), JSON.stringify(mapValues(results, (val) => val.outputs), null, 2));
|
|
184
187
|
isDeploying = false;
|
|
185
188
|
deploy();
|
|
186
189
|
}
|
package/cli/ui/deploy.js
CHANGED
|
@@ -70,15 +70,7 @@ export function printDeploymentResults(assembly, results, remove) {
|
|
|
70
70
|
Colors.gap();
|
|
71
71
|
Colors.line(Colors.success(`✔`), Colors.bold(remove ? ` Removed:` : ` Deployed:`));
|
|
72
72
|
for (const [stack, result] of success) {
|
|
73
|
-
const outputs = Object.entries(result.outputs)
|
|
74
|
-
if (key.startsWith("Export"))
|
|
75
|
-
return false;
|
|
76
|
-
if (key.includes("SstSiteEnv"))
|
|
77
|
-
return false;
|
|
78
|
-
if (key === "SSTMetadata")
|
|
79
|
-
return false;
|
|
80
|
-
return true;
|
|
81
|
-
});
|
|
73
|
+
const outputs = Object.entries(result.outputs);
|
|
82
74
|
Colors.line(` ${Colors.dim(stackNameToId(stack))}`);
|
|
83
75
|
if (outputs.length > 0) {
|
|
84
76
|
for (const key of Object.keys(Object.fromEntries(outputs)).sort()) {
|
|
@@ -87,6 +79,7 @@ export function printDeploymentResults(assembly, results, remove) {
|
|
|
87
79
|
}
|
|
88
80
|
}
|
|
89
81
|
}
|
|
82
|
+
Colors.gap();
|
|
90
83
|
}
|
|
91
84
|
// Print failed stacks
|
|
92
85
|
const failed = Object.entries(results).filter(([_stack, result]) => Object.keys(result.errors).length > 0);
|
|
@@ -121,9 +114,9 @@ function logicalIdToCdkPath(assembly, stack, logicalId) {
|
|
|
121
114
|
}
|
|
122
115
|
function getHelper(error) {
|
|
123
116
|
return `This is a common deploy error. Check out this GitHub issue for more details - https://github.com/serverless-stack/sst/issues/125`;
|
|
124
|
-
return getApiAccessLogPermissionsHelper(error)
|
|
125
|
-
|
|
126
|
-
|
|
117
|
+
return (getApiAccessLogPermissionsHelper(error) ||
|
|
118
|
+
getAppSyncMultiResolverHelper(error) ||
|
|
119
|
+
getApiLogRoleHelper(error));
|
|
127
120
|
}
|
|
128
121
|
function getApiAccessLogPermissionsHelper(error) {
|
|
129
122
|
// Can run into this issue when enabling access logs for API Gateway
|
package/package.json
CHANGED
package/project.js
CHANGED
|
@@ -64,7 +64,9 @@ export async function initProject(globals) {
|
|
|
64
64
|
config: {
|
|
65
65
|
...config,
|
|
66
66
|
stage,
|
|
67
|
-
profile:
|
|
67
|
+
profile: process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY
|
|
68
|
+
? undefined
|
|
69
|
+
: (globals.profile || config.profile),
|
|
68
70
|
region: globals.region || config.region,
|
|
69
71
|
role: globals.role || config.role,
|
|
70
72
|
ssmPrefix: config.ssmPrefix || `/sst/${config.name}/${stage}/`,
|
package/sst.mjs
CHANGED
|
@@ -1191,6 +1191,7 @@ import {
|
|
|
1191
1191
|
DescribeStacksCommand,
|
|
1192
1192
|
DescribeStackEventsCommand
|
|
1193
1193
|
} from "@aws-sdk/client-cloudformation";
|
|
1194
|
+
import { map, omitBy, pipe } from "remeda";
|
|
1194
1195
|
function isFinal(input) {
|
|
1195
1196
|
return STATUSES_SUCCESS.includes(input) || STATUSES_FAILED.includes(input);
|
|
1196
1197
|
}
|
|
@@ -1271,8 +1272,11 @@ async function monitor(stack) {
|
|
|
1271
1272
|
if (isFinal(first.StackStatus)) {
|
|
1272
1273
|
return {
|
|
1273
1274
|
status: first.StackStatus,
|
|
1274
|
-
outputs:
|
|
1275
|
-
first.Outputs
|
|
1275
|
+
outputs: pipe(
|
|
1276
|
+
first.Outputs || [],
|
|
1277
|
+
map((o) => [o.OutputKey, o.OutputValue]),
|
|
1278
|
+
Object.fromEntries,
|
|
1279
|
+
filterOutputs
|
|
1276
1280
|
),
|
|
1277
1281
|
errors: isFailed(first.StackStatus) ? errors : {}
|
|
1278
1282
|
};
|
|
@@ -1295,6 +1299,14 @@ async function monitor(stack) {
|
|
|
1295
1299
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
1296
1300
|
}
|
|
1297
1301
|
}
|
|
1302
|
+
function filterOutputs(input) {
|
|
1303
|
+
return pipe(
|
|
1304
|
+
input,
|
|
1305
|
+
omitBy((_, key) => {
|
|
1306
|
+
return key.startsWith("Export") || key.includes("SstSiteEnv") || key === "SSTMetadata";
|
|
1307
|
+
})
|
|
1308
|
+
);
|
|
1309
|
+
}
|
|
1298
1310
|
var STATUSES_PENDING, STATUSES_SUCCESS, STATUSES_FAILED, STATUSES;
|
|
1299
1311
|
var init_monitor = __esm({
|
|
1300
1312
|
"src/stacks/monitor.ts"() {
|
|
@@ -2339,16 +2351,13 @@ async function publishAssets4(stacks) {
|
|
|
2339
2351
|
const { publishDeployAssets: publishDeployAssets2 } = await Promise.resolve().then(() => (init_cloudformation_deployments_wrapper(), cloudformation_deployments_wrapper_exports));
|
|
2340
2352
|
const results = {};
|
|
2341
2353
|
for (const stack of stacks) {
|
|
2342
|
-
const result = await publishDeployAssets2(
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
deploymentMethod: {
|
|
2348
|
-
method: "direct"
|
|
2349
|
-
}
|
|
2354
|
+
const result = await publishDeployAssets2(provider, {
|
|
2355
|
+
stack,
|
|
2356
|
+
quiet: false,
|
|
2357
|
+
deploymentMethod: {
|
|
2358
|
+
method: "direct"
|
|
2350
2359
|
}
|
|
2351
|
-
);
|
|
2360
|
+
});
|
|
2352
2361
|
results[stack.stackName] = result;
|
|
2353
2362
|
}
|
|
2354
2363
|
return results;
|
|
@@ -2426,7 +2435,7 @@ async function deploy(stack) {
|
|
|
2426
2435
|
});
|
|
2427
2436
|
return {
|
|
2428
2437
|
errors: {},
|
|
2429
|
-
outputs: result.outputs,
|
|
2438
|
+
outputs: filterOutputs(result.outputs),
|
|
2430
2439
|
status: "SKIPPED"
|
|
2431
2440
|
};
|
|
2432
2441
|
}
|
|
@@ -2502,13 +2511,13 @@ async function diff(stack, oldTemplate) {
|
|
|
2502
2511
|
}
|
|
2503
2512
|
async function buildLogicalToPathMap(stack) {
|
|
2504
2513
|
const { ArtifactMetadataEntryType } = await import("@aws-cdk/cloud-assembly-schema");
|
|
2505
|
-
const
|
|
2514
|
+
const map3 = {};
|
|
2506
2515
|
for (const md of stack.findMetadataByType(
|
|
2507
2516
|
ArtifactMetadataEntryType.LOGICAL_ID
|
|
2508
2517
|
)) {
|
|
2509
|
-
|
|
2518
|
+
map3[md.data] = md.path;
|
|
2510
2519
|
}
|
|
2511
|
-
return
|
|
2520
|
+
return map3;
|
|
2512
2521
|
}
|
|
2513
2522
|
var init_diff = __esm({
|
|
2514
2523
|
"src/stacks/diff.ts"() {
|
|
@@ -4017,6 +4026,7 @@ __export(stacks_exports, {
|
|
|
4017
4026
|
deploy: () => deploy,
|
|
4018
4027
|
deployMany: () => deployMany,
|
|
4019
4028
|
diff: () => diff,
|
|
4029
|
+
filterOutputs: () => filterOutputs,
|
|
4020
4030
|
isFailed: () => isFailed,
|
|
4021
4031
|
isFinal: () => isFinal,
|
|
4022
4032
|
isPending: () => isPending,
|
|
@@ -4352,7 +4362,7 @@ async function initProject(globals) {
|
|
|
4352
4362
|
config: {
|
|
4353
4363
|
...config,
|
|
4354
4364
|
stage,
|
|
4355
|
-
profile: globals.profile || config.profile,
|
|
4365
|
+
profile: process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY ? void 0 : globals.profile || config.profile,
|
|
4356
4366
|
region: globals.region || config.region,
|
|
4357
4367
|
role: globals.role || config.role,
|
|
4358
4368
|
ssmPrefix: config.ssmPrefix || `/sst/${config.name}/${stage}/`
|
|
@@ -5203,15 +5213,7 @@ function printDeploymentResults(assembly, results, remove4) {
|
|
|
5203
5213
|
Colors.bold(remove4 ? ` Removed:` : ` Deployed:`)
|
|
5204
5214
|
);
|
|
5205
5215
|
for (const [stack, result] of success) {
|
|
5206
|
-
const outputs = Object.entries(result.outputs)
|
|
5207
|
-
if (key.startsWith("Export"))
|
|
5208
|
-
return false;
|
|
5209
|
-
if (key.includes("SstSiteEnv"))
|
|
5210
|
-
return false;
|
|
5211
|
-
if (key === "SSTMetadata")
|
|
5212
|
-
return false;
|
|
5213
|
-
return true;
|
|
5214
|
-
});
|
|
5216
|
+
const outputs = Object.entries(result.outputs);
|
|
5215
5217
|
Colors.line(` ${Colors.dim(stackNameToId(stack))}`);
|
|
5216
5218
|
if (outputs.length > 0) {
|
|
5217
5219
|
for (const key of Object.keys(Object.fromEntries(outputs)).sort()) {
|
|
@@ -5220,6 +5222,7 @@ function printDeploymentResults(assembly, results, remove4) {
|
|
|
5220
5222
|
}
|
|
5221
5223
|
}
|
|
5222
5224
|
}
|
|
5225
|
+
Colors.gap();
|
|
5223
5226
|
}
|
|
5224
5227
|
const failed = Object.entries(results).filter(
|
|
5225
5228
|
([_stack, result]) => Object.keys(result.errors).length > 0
|
|
@@ -5400,15 +5403,15 @@ async function extractSchema(opts) {
|
|
|
5400
5403
|
{
|
|
5401
5404
|
name: "pothos-extractor",
|
|
5402
5405
|
visitor: {
|
|
5403
|
-
Program(
|
|
5404
|
-
const dummyResolverId =
|
|
5406
|
+
Program(path18) {
|
|
5407
|
+
const dummyResolverId = path18.scope.generateUidIdentifier("DUMMY_RESOLVER");
|
|
5405
5408
|
const resolverNode = dummyResolver({
|
|
5406
5409
|
dummy_resolver: dummyResolverId
|
|
5407
5410
|
});
|
|
5408
|
-
|
|
5409
|
-
|
|
5411
|
+
path18.unshiftContainer("body", resolverNode);
|
|
5412
|
+
path18.scope.crawl();
|
|
5410
5413
|
let schemaBuilder = null;
|
|
5411
|
-
|
|
5414
|
+
path18.traverse({
|
|
5412
5415
|
ImportDeclaration(declarator) {
|
|
5413
5416
|
if (!declarator)
|
|
5414
5417
|
return;
|
|
@@ -5466,17 +5469,17 @@ async function extractSchema(opts) {
|
|
|
5466
5469
|
);
|
|
5467
5470
|
return contents.code;
|
|
5468
5471
|
}
|
|
5469
|
-
function getBindings(
|
|
5472
|
+
function getBindings(path18, globalPaths) {
|
|
5470
5473
|
const bindings = [];
|
|
5471
|
-
|
|
5474
|
+
path18.traverse({
|
|
5472
5475
|
Expression(expressionPath) {
|
|
5473
5476
|
if (!expressionPath.isIdentifier())
|
|
5474
5477
|
return;
|
|
5475
|
-
const binding =
|
|
5478
|
+
const binding = path18.scope.getBinding(expressionPath);
|
|
5476
5479
|
if (!binding || globalPaths.has(binding.path) || bindings.includes(binding.path))
|
|
5477
5480
|
return;
|
|
5478
5481
|
const rootBinding = findRootBinding(binding.path);
|
|
5479
|
-
if (
|
|
5482
|
+
if (path18 === rootBinding) {
|
|
5480
5483
|
bindings.push(binding.path);
|
|
5481
5484
|
return;
|
|
5482
5485
|
}
|
|
@@ -5489,8 +5492,8 @@ function getBindings(path17, globalPaths) {
|
|
|
5489
5492
|
}
|
|
5490
5493
|
return bindings;
|
|
5491
5494
|
}
|
|
5492
|
-
function findRootBinding(
|
|
5493
|
-
let rootPath =
|
|
5495
|
+
function findRootBinding(path18) {
|
|
5496
|
+
let rootPath = path18;
|
|
5494
5497
|
while (rootPath.parentPath?.node !== void 0 && !rootPath.parentPath?.isProgram()) {
|
|
5495
5498
|
rootPath = rootPath.parentPath;
|
|
5496
5499
|
}
|
|
@@ -5760,7 +5763,7 @@ import {
|
|
|
5760
5763
|
LambdaClient,
|
|
5761
5764
|
UpdateFunctionConfigurationCommand
|
|
5762
5765
|
} from "@aws-sdk/client-lambda";
|
|
5763
|
-
import { pipe, map } from "remeda";
|
|
5766
|
+
import { pipe as pipe2, map as map2 } from "remeda";
|
|
5764
5767
|
async function* scan(prefix) {
|
|
5765
5768
|
const ssm = useAWSClient(SSMClient);
|
|
5766
5769
|
let token;
|
|
@@ -5853,9 +5856,9 @@ var init_config = __esm({
|
|
|
5853
5856
|
const env3 = {
|
|
5854
5857
|
SST_APP: project.config.name,
|
|
5855
5858
|
SST_STAGE: project.config.stage,
|
|
5856
|
-
...
|
|
5859
|
+
...pipe2(
|
|
5857
5860
|
parameters2,
|
|
5858
|
-
|
|
5861
|
+
map2((p) => [envFor(p), p.value]),
|
|
5859
5862
|
Object.fromEntries
|
|
5860
5863
|
)
|
|
5861
5864
|
};
|
|
@@ -6014,12 +6017,12 @@ var env = (program2) => program2.command(
|
|
|
6014
6017
|
),
|
|
6015
6018
|
async (args) => {
|
|
6016
6019
|
const { createSpinner: createSpinner2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
|
|
6017
|
-
const
|
|
6020
|
+
const fs18 = await import("fs/promises");
|
|
6018
6021
|
const { SiteEnv } = await Promise.resolve().then(() => (init_site_env(), site_env_exports));
|
|
6019
6022
|
const { spawnSync } = await import("child_process");
|
|
6020
6023
|
let spinner;
|
|
6021
6024
|
while (true) {
|
|
6022
|
-
const exists = await
|
|
6025
|
+
const exists = await fs18.access(SiteEnv.valuesFile()).then(() => true).catch(() => false);
|
|
6023
6026
|
if (!exists) {
|
|
6024
6027
|
spinner = createSpinner2("Cannot find SST environment variables. Waiting for SST to start...").start();
|
|
6025
6028
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
@@ -6046,6 +6049,7 @@ var env = (program2) => program2.command(
|
|
|
6046
6049
|
init_colors();
|
|
6047
6050
|
init_header();
|
|
6048
6051
|
import chalk2 from "chalk";
|
|
6052
|
+
import { mapValues } from "remeda";
|
|
6049
6053
|
var dev = (program2) => program2.command(
|
|
6050
6054
|
["dev", "start"],
|
|
6051
6055
|
"Work on your app locally",
|
|
@@ -6068,8 +6072,8 @@ var dev = (program2) => program2.command(
|
|
|
6068
6072
|
const { Context: Context2 } = await Promise.resolve().then(() => (init_context(), context_exports));
|
|
6069
6073
|
const { DeploymentUI: DeploymentUI2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
6070
6074
|
const { useLocalServer: useLocalServer2 } = await Promise.resolve().then(() => (init_server2(), server_exports2));
|
|
6071
|
-
const
|
|
6072
|
-
const
|
|
6075
|
+
const path18 = await import("path");
|
|
6076
|
+
const fs18 = await import("fs/promises");
|
|
6073
6077
|
const crypto2 = await import("crypto");
|
|
6074
6078
|
const { printDeploymentResults: printDeploymentResults2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
6075
6079
|
const { useFunctions: useFunctions3 } = await import("../src/constructs/Function.js");
|
|
@@ -6153,10 +6157,11 @@ var dev = (program2) => program2.command(
|
|
|
6153
6157
|
Colors.gap();
|
|
6154
6158
|
});
|
|
6155
6159
|
bus.subscribe("function.success", async (evt) => {
|
|
6160
|
+
const p = prefix(evt.properties.requestID);
|
|
6156
6161
|
const req = pending.get(evt.properties.requestID);
|
|
6157
6162
|
setTimeout(() => {
|
|
6158
6163
|
Colors.line(
|
|
6159
|
-
|
|
6164
|
+
p,
|
|
6160
6165
|
Colors.dim(`Done in ${Date.now() - req.started - 100}ms`)
|
|
6161
6166
|
);
|
|
6162
6167
|
end(evt.properties.requestID);
|
|
@@ -6259,21 +6264,29 @@ var dev = (program2) => program2.command(
|
|
|
6259
6264
|
}
|
|
6260
6265
|
await SiteEnv.writeValues(result);
|
|
6261
6266
|
}
|
|
6267
|
+
fs18.writeFile(
|
|
6268
|
+
path18.join(project2.paths.out, "outputs.json"),
|
|
6269
|
+
JSON.stringify(
|
|
6270
|
+
mapValues(results, (val) => val.outputs),
|
|
6271
|
+
null,
|
|
6272
|
+
2
|
|
6273
|
+
)
|
|
6274
|
+
);
|
|
6262
6275
|
isDeploying = false;
|
|
6263
6276
|
deploy3();
|
|
6264
6277
|
}
|
|
6265
6278
|
async function checksum(cdkOutPath) {
|
|
6266
|
-
const manifestPath =
|
|
6279
|
+
const manifestPath = path18.join(cdkOutPath, "manifest.json");
|
|
6267
6280
|
const cdkManifest = JSON.parse(
|
|
6268
|
-
await
|
|
6281
|
+
await fs18.readFile(manifestPath).then((x) => x.toString())
|
|
6269
6282
|
);
|
|
6270
6283
|
const checksumData = await Promise.all(
|
|
6271
6284
|
Object.keys(cdkManifest.artifacts).filter(
|
|
6272
6285
|
(key) => cdkManifest.artifacts[key].type === "aws:cloudformation:stack"
|
|
6273
6286
|
).map(async (key) => {
|
|
6274
6287
|
const { templateFile } = cdkManifest.artifacts[key].properties;
|
|
6275
|
-
const templatePath =
|
|
6276
|
-
const templateContent = await
|
|
6288
|
+
const templatePath = path18.join(cdkOutPath, templateFile);
|
|
6289
|
+
const templateContent = await fs18.readFile(templatePath);
|
|
6277
6290
|
return templateContent;
|
|
6278
6291
|
})
|
|
6279
6292
|
).then((x) => x.join("\n"));
|
|
@@ -6362,7 +6375,7 @@ var build = (program2) => program2.command(
|
|
|
6362
6375
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
6363
6376
|
const { Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
6364
6377
|
const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
|
|
6365
|
-
const
|
|
6378
|
+
const path18 = await import("path");
|
|
6366
6379
|
const result = await Stacks.synth({
|
|
6367
6380
|
fn: useProject2().stacks,
|
|
6368
6381
|
buildDir: args.to,
|
|
@@ -6372,7 +6385,7 @@ var build = (program2) => program2.command(
|
|
|
6372
6385
|
Colors2.line(
|
|
6373
6386
|
Colors2.success(`\u2714`),
|
|
6374
6387
|
Colors2.bold(" Built:"),
|
|
6375
|
-
`${result.stacks.length} stack${result.stacks.length > 1 ? "s" : ""} to ${
|
|
6388
|
+
`${result.stacks.length} stack${result.stacks.length > 1 ? "s" : ""} to ${path18.relative(process.cwd(), result.directory)}`
|
|
6376
6389
|
);
|
|
6377
6390
|
process.exit(0);
|
|
6378
6391
|
}
|
|
@@ -6381,6 +6394,8 @@ var build = (program2) => program2.command(
|
|
|
6381
6394
|
// src/cli/commands/deploy.tsx
|
|
6382
6395
|
init_credentials();
|
|
6383
6396
|
init_colors();
|
|
6397
|
+
import fs17 from "fs/promises";
|
|
6398
|
+
import path17 from "path";
|
|
6384
6399
|
var deploy2 = (program2) => program2.command(
|
|
6385
6400
|
"deploy [filter]",
|
|
6386
6401
|
"Deploy your app to AWS",
|
|
@@ -6400,6 +6415,7 @@ var deploy2 = (program2) => program2.command(
|
|
|
6400
6415
|
const { loadAssembly: loadAssembly2, Stacks } = await Promise.resolve().then(() => (init_stacks(), stacks_exports));
|
|
6401
6416
|
const { render } = await import("ink");
|
|
6402
6417
|
const { DeploymentUI: DeploymentUI2 } = await Promise.resolve().then(() => (init_deploy2(), deploy_exports));
|
|
6418
|
+
const { mapValues: mapValues2 } = await import("remeda");
|
|
6403
6419
|
const project = useProject2();
|
|
6404
6420
|
const identity = await useSTSIdentity();
|
|
6405
6421
|
Colors.line(`${Colors.primary.bold(`SST v${project.version}`)}`);
|
|
@@ -6440,6 +6456,14 @@ var deploy2 = (program2) => program2.command(
|
|
|
6440
6456
|
printDeploymentResults2(assembly, results);
|
|
6441
6457
|
if (Object.values(results).some((stack) => Stacks.isFailed(stack.status)))
|
|
6442
6458
|
process.exit(1);
|
|
6459
|
+
fs17.writeFile(
|
|
6460
|
+
path17.join(project.paths.out, "outputs.json"),
|
|
6461
|
+
JSON.stringify(
|
|
6462
|
+
mapValues2(results, (val) => val.outputs),
|
|
6463
|
+
null,
|
|
6464
|
+
2
|
|
6465
|
+
)
|
|
6466
|
+
);
|
|
6443
6467
|
process.exit(0);
|
|
6444
6468
|
}
|
|
6445
6469
|
);
|
|
@@ -6696,22 +6720,22 @@ var update = (program2) => program2.command(
|
|
|
6696
6720
|
}),
|
|
6697
6721
|
async (args) => {
|
|
6698
6722
|
const { green, yellow } = await import("colorette");
|
|
6699
|
-
const
|
|
6700
|
-
const
|
|
6723
|
+
const fs18 = await import("fs/promises");
|
|
6724
|
+
const path18 = await import("path");
|
|
6701
6725
|
const { fetch } = await import("undici");
|
|
6702
6726
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
6703
6727
|
const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
|
|
6704
6728
|
async function find2(dir) {
|
|
6705
|
-
const children = await
|
|
6729
|
+
const children = await fs18.readdir(dir);
|
|
6706
6730
|
const tasks2 = children.map(async (item) => {
|
|
6707
6731
|
if (item === "node_modules")
|
|
6708
6732
|
return [];
|
|
6709
6733
|
if (/(^|\/)\.[^\/\.]/g.test(item))
|
|
6710
6734
|
return [];
|
|
6711
|
-
const full =
|
|
6735
|
+
const full = path18.join(dir, item);
|
|
6712
6736
|
if (item === "package.json")
|
|
6713
6737
|
return [full];
|
|
6714
|
-
const stat = await
|
|
6738
|
+
const stat = await fs18.stat(full);
|
|
6715
6739
|
if (stat.isDirectory())
|
|
6716
6740
|
return find2(full);
|
|
6717
6741
|
return [];
|
|
@@ -6725,7 +6749,7 @@ var update = (program2) => program2.command(
|
|
|
6725
6749
|
).then((resp) => resp.json());
|
|
6726
6750
|
const results = /* @__PURE__ */ new Map();
|
|
6727
6751
|
const tasks = files.map(async (file) => {
|
|
6728
|
-
const data2 = await
|
|
6752
|
+
const data2 = await fs18.readFile(file).then((x) => x.toString()).then(JSON.parse);
|
|
6729
6753
|
for (const field of FIELDS) {
|
|
6730
6754
|
const deps = data2[field];
|
|
6731
6755
|
if (!deps)
|
|
@@ -6753,7 +6777,7 @@ var update = (program2) => program2.command(
|
|
|
6753
6777
|
deps[pkg] = desired;
|
|
6754
6778
|
}
|
|
6755
6779
|
}
|
|
6756
|
-
await
|
|
6780
|
+
await fs18.writeFile(file, JSON.stringify(data2, null, 2));
|
|
6757
6781
|
});
|
|
6758
6782
|
await Promise.all(tasks);
|
|
6759
6783
|
if (results.size === 0) {
|
|
@@ -6763,7 +6787,7 @@ var update = (program2) => program2.command(
|
|
|
6763
6787
|
for (const [file, pkgs] of results.entries()) {
|
|
6764
6788
|
Colors2.line(
|
|
6765
6789
|
Colors2.success(`\u2714 `),
|
|
6766
|
-
Colors2.bold.dim(
|
|
6790
|
+
Colors2.bold.dim(path18.relative(project.paths.root, file))
|
|
6767
6791
|
);
|
|
6768
6792
|
for (const [pkg, version2] of pkgs) {
|
|
6769
6793
|
Colors2.line(Colors2.dim(` ${pkg}@${version2}`));
|
package/stacks/deploy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useBus } from "../bus.js";
|
|
2
2
|
import { useAWSProvider } from "../credentials.js";
|
|
3
3
|
import { Logger } from "../logger.js";
|
|
4
|
-
import { isFailed, monitor } from "./monitor.js";
|
|
4
|
+
import { filterOutputs, isFailed, monitor, } from "./monitor.js";
|
|
5
5
|
export async function publishAssets(stacks) {
|
|
6
6
|
Logger.debug("Publishing assets");
|
|
7
7
|
const provider = await useAWSProvider();
|
|
@@ -89,7 +89,7 @@ export async function deploy(stack) {
|
|
|
89
89
|
});
|
|
90
90
|
return {
|
|
91
91
|
errors: {},
|
|
92
|
-
outputs: result.outputs,
|
|
92
|
+
outputs: filterOutputs(result.outputs),
|
|
93
93
|
status: "SKIPPED",
|
|
94
94
|
};
|
|
95
95
|
}
|
package/stacks/monitor.d.ts
CHANGED
|
@@ -28,4 +28,5 @@ export declare function monitor(stack: string): Promise<{
|
|
|
28
28
|
outputs: Record<string, string>;
|
|
29
29
|
errors: Record<string, string>;
|
|
30
30
|
}>;
|
|
31
|
+
export declare function filterOutputs(input: Record<string, string>): Record<string, string>;
|
|
31
32
|
export type StackDeploymentResult = Awaited<ReturnType<typeof monitor>>;
|
package/stacks/monitor.js
CHANGED
|
@@ -106,7 +106,7 @@ export async function monitor(stack) {
|
|
|
106
106
|
if (isFinal(first.StackStatus)) {
|
|
107
107
|
return {
|
|
108
108
|
status: first.StackStatus,
|
|
109
|
-
outputs:
|
|
109
|
+
outputs: pipe(first.Outputs || [], map((o) => [o.OutputKey, o.OutputValue]), Object.fromEntries, filterOutputs),
|
|
110
110
|
errors: isFailed(first.StackStatus) ? errors : {},
|
|
111
111
|
};
|
|
112
112
|
}
|
|
@@ -129,3 +129,11 @@ export async function monitor(stack) {
|
|
|
129
129
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
+
import { map, omitBy, pipe } from "remeda";
|
|
133
|
+
export function filterOutputs(input) {
|
|
134
|
+
return pipe(input, omitBy((_, key) => {
|
|
135
|
+
return (key.startsWith("Export") ||
|
|
136
|
+
key.includes("SstSiteEnv") ||
|
|
137
|
+
key === "SSTMetadata");
|
|
138
|
+
}));
|
|
139
|
+
}
|