sst 2.1.29 → 2.1.31

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/bootstrap.d.ts CHANGED
@@ -2,4 +2,4 @@ export declare const useBootstrap: () => Promise<{
2
2
  version: string;
3
3
  bucket: string;
4
4
  }>;
5
- export declare function bootstrapSST(tags?: Record<string, string>, publicAccessBlockConfiguration?: boolean, qualifier?: string): Promise<void>;
5
+ export declare function bootstrapSST(): Promise<void>;
package/bootstrap.js CHANGED
@@ -18,7 +18,8 @@ import { useAWSClient, useAWSCredentials, useSTSIdentity, } from "./credentials.
18
18
  import { VisibleError } from "./error.js";
19
19
  import { Logger } from "./logger.js";
20
20
  import { Stacks } from "./stacks/index.js";
21
- const STACK_NAME = "SSTBootstrap";
21
+ const CDK_STACK_NAME = "CDKToolkit";
22
+ const SST_STACK_NAME = "SSTBootstrap";
22
23
  const OUTPUT_VERSION = "Version";
23
24
  const OUTPUT_BUCKET = "BucketName";
24
25
  const LATEST_VERSION = "7";
@@ -50,11 +51,11 @@ export const useBootstrap = Context.memo(async () => {
50
51
  return sstStatus;
51
52
  }, "Bootstrap");
52
53
  async function loadCDKStatus() {
54
+ const { cdk } = useProject().config;
53
55
  const client = useAWSClient(CloudFormationClient);
56
+ const stackName = cdk?.toolkitStackName || CDK_STACK_NAME;
54
57
  try {
55
- const { Stacks: stacks } = await client.send(new DescribeStacksCommand({
56
- StackName: "CDKToolkit",
57
- }));
58
+ const { Stacks: stacks } = await client.send(new DescribeStacksCommand({ StackName: stackName }));
58
59
  // Check CDK bootstrap stack exists
59
60
  if (!stacks || stacks.length === 0)
60
61
  return false;
@@ -73,7 +74,7 @@ async function loadCDKStatus() {
73
74
  }
74
75
  catch (e) {
75
76
  if (e.name === "ValidationError" &&
76
- e.message === "Stack with id CDKToolkit does not exist") {
77
+ e.message === `Stack with id ${stackName} does not exist`) {
77
78
  return false;
78
79
  }
79
80
  else {
@@ -81,32 +82,63 @@ async function loadCDKStatus() {
81
82
  }
82
83
  }
83
84
  }
84
- export async function bootstrapSST(tags, publicAccessBlockConfiguration, qualifier) {
85
- // Normalize input
86
- tags = tags || {};
87
- publicAccessBlockConfiguration =
88
- publicAccessBlockConfiguration === false ? false : true;
85
+ async function loadSSTStatus() {
86
+ // Get bootstrap CloudFormation stack
87
+ const { bootstrap } = useProject().config;
88
+ const cf = useAWSClient(CloudFormationClient);
89
+ const stackName = bootstrap?.stackName || SST_STACK_NAME;
90
+ let result;
91
+ try {
92
+ result = await cf.send(new DescribeStacksCommand({
93
+ StackName: stackName,
94
+ }));
95
+ }
96
+ catch (e) {
97
+ if (e.Code === "ValidationError" &&
98
+ e.message === `Stack with id ${stackName} does not exist`) {
99
+ return null;
100
+ }
101
+ throw e;
102
+ }
103
+ // Parse stack outputs
104
+ let version, bucket;
105
+ (result.Stacks[0].Outputs || []).forEach((o) => {
106
+ if (o.OutputKey === OUTPUT_VERSION) {
107
+ version = o.OutputValue;
108
+ }
109
+ else if (o.OutputKey === OUTPUT_BUCKET) {
110
+ bucket = o.OutputValue;
111
+ }
112
+ });
113
+ if (!version || !bucket) {
114
+ return null;
115
+ }
116
+ return { version, bucket };
117
+ }
118
+ export async function bootstrapSST() {
119
+ const { region, bootstrap, cdk } = useProject().config;
89
120
  // Create bootstrap stack
90
- const project = useProject();
91
121
  const app = new App();
92
- const stack = new Stack(app, STACK_NAME, {
122
+ const stackName = bootstrap?.stackName || SST_STACK_NAME;
123
+ const stack = new Stack(app, stackName, {
93
124
  env: {
94
- region: project.config.region,
125
+ region,
95
126
  },
96
127
  synthesizer: new DefaultStackSynthesizer({
97
- qualifier,
128
+ qualifier: cdk?.qualifier,
129
+ fileAssetsBucketName: cdk?.fileAssetsBucketName,
98
130
  }),
99
131
  });
100
132
  // Add tags to stack
101
- for (const [key, value] of Object.entries(tags)) {
133
+ for (const [key, value] of Object.entries(bootstrap?.tags || {})) {
102
134
  Tags.of(app).add(key, value);
103
135
  }
104
136
  // Create S3 bucket to store stacks metadata
105
- const bucket = new Bucket(stack, project.config.region, {
137
+ const bucket = new Bucket(stack, region, {
106
138
  encryption: BucketEncryption.S3_MANAGED,
107
139
  removalPolicy: RemovalPolicy.DESTROY,
108
140
  autoDeleteObjects: true,
109
- blockPublicAccess: publicAccessBlockConfiguration
141
+ blockPublicAccess: cdk?.publicAccessBlockConfiguration !== false
110
142
  ? BlockPublicAccess.BLOCK_ALL
111
143
  : undefined,
112
144
  });
@@ -114,7 +146,7 @@ export async function bootstrapSST(tags, publicAccessBlockConfiguration, qualifi
114
146
  const fn = new Function(stack, "MetadataHandler", {
115
147
  code: Code.fromAsset(path.resolve(__dirname, "support/bootstrap-metadata-function")),
116
148
  handler: "index.handler",
117
- runtime: project.config.region?.startsWith("us-gov-")
149
+ runtime: region?.startsWith("us-gov-")
118
150
  ? Runtime.NODEJS_16_X
119
151
  : Runtime.NODEJS_18_X,
120
152
  environment: {
@@ -175,7 +207,8 @@ export async function bootstrapSST(tags, publicAccessBlockConfiguration, qualifi
175
207
  async function bootstrapCDK() {
176
208
  const identity = await useSTSIdentity();
177
209
  const credentials = await useAWSCredentials();
178
- const { region, profile } = useProject().config;
210
+ const { region, profile, cdk } = useProject().config;
211
+ cdk || {};
179
212
  await new Promise((resolve, reject) => {
180
213
  const proc = spawn([
181
214
  "npx",
@@ -183,6 +216,18 @@ async function bootstrapCDK() {
183
216
  "bootstrap",
184
217
  `aws://${identity.Account}/${region}`,
185
218
  "--no-version-reporting",
219
+ ...(cdk?.publicAccessBlockConfiguration === false
220
+ ? ["--public-access-block-configuration", "false"]
221
+ : cdk?.publicAccessBlockConfiguration === true
222
+ ? ["--public-access-block-configuration", "false"]
223
+ : []),
224
+ ...(cdk?.toolkitStackName
225
+ ? ["--toolkit-stack-name", cdk.toolkitStackName]
226
+ : []),
227
+ ...(cdk?.qualifier ? ["--qualifier", cdk.qualifier] : []),
228
+ ...(cdk?.fileAssetsBucketName
229
+ ? ["--toolkit-bucket-name", cdk.fileAssetsBucketName]
230
+ : []),
186
231
  ].join(" "), {
187
232
  env: {
188
233
  ...process.env,
@@ -215,34 +260,3 @@ async function bootstrapCDK() {
215
260
  });
216
261
  });
217
262
  }
218
- async function loadSSTStatus() {
219
- // Get bootstrap CloudFormation stack
220
- const cf = useAWSClient(CloudFormationClient);
221
- let result;
222
- try {
223
- result = await cf.send(new DescribeStacksCommand({
224
- StackName: STACK_NAME,
225
- }));
226
- }
227
- catch (e) {
228
- if (e.Code === "ValidationError" &&
229
- e.message === `Stack with id ${STACK_NAME} does not exist`) {
230
- return null;
231
- }
232
- throw e;
233
- }
234
- // Parse stack outputs
235
- let version, bucket;
236
- (result.Stacks[0].Outputs || []).forEach((o) => {
237
- if (o.OutputKey === OUTPUT_VERSION) {
238
- version = o.OutputValue;
239
- }
240
- else if (o.OutputKey === OUTPUT_BUCKET) {
241
- bucket = o.OutputValue;
242
- }
243
- });
244
- if (!version || !bucket) {
245
- return null;
246
- }
247
- return { version, bucket };
248
- }
@@ -1,9 +1,11 @@
1
1
  import * as trpc from "@trpc/server";
2
2
  import { DendriformPatch } from "dendriform-immer-patch-optimiser";
3
+ import { useProject } from "../../project.js";
3
4
  export type State = {
4
5
  app: string;
5
6
  stage: string;
6
7
  functions: Record<string, FunctionState>;
8
+ bootstrap: ReturnType<typeof useProject>["config"]["bootstrap"];
7
9
  live: boolean;
8
10
  stacks: {
9
11
  status: any;
@@ -29,6 +29,7 @@ export async function useLocalServer(opts) {
29
29
  let state = {
30
30
  app: project.config.name,
31
31
  stage: project.config.stage,
32
+ bootstrap: project.config.bootstrap,
32
33
  live: opts.live,
33
34
  stacks: {
34
35
  status: "idle",
package/cli/sst.js CHANGED
@@ -25,7 +25,6 @@ import { transform } from "./commands/transform.js";
25
25
  import { diff } from "./commands/diff.js";
26
26
  import { version } from "./commands/version.js";
27
27
  import { telemetry } from "./commands/telemetry.js";
28
- import { bootstrap } from "./commands/bootstrap.js";
29
28
  dev(program);
30
29
  deploy(program);
31
30
  build(program);
@@ -39,7 +38,6 @@ consoleCommand(program);
39
38
  diff(program);
40
39
  version(program);
41
40
  telemetry(program);
42
- bootstrap(program);
43
41
  if ("setSourceMapsEnabled" in process) {
44
42
  // @ts-expect-error
45
43
  process.setSourceMapsEnabled(true);
@@ -113,6 +113,7 @@ export declare class Stack extends cdk.Stack {
113
113
  */
114
114
  addOutputs(outputs: Record<string, string | cdk.CfnOutputProps>): void;
115
115
  private createCustomResourceHandler;
116
+ private static buildSynthesizer;
116
117
  private static checkForPropsIsConstruct;
117
118
  private static checkForEnvInProps;
118
119
  }
@@ -3,6 +3,7 @@ import url from "url";
3
3
  import * as path from "path";
4
4
  import * as cdk from "aws-cdk-lib";
5
5
  import * as lambda from "aws-cdk-lib/aws-lambda";
6
+ import { useProject } from "../project.js";
6
7
  import { Function as Fn } from "./Function.js";
7
8
  import { isConstruct } from "./Construct.js";
8
9
  const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
@@ -43,6 +44,7 @@ export class Stack extends cdk.Stack {
43
44
  account: root.account,
44
45
  region: root.region,
45
46
  },
47
+ synthesizer: props?.synthesizer || Stack.buildSynthesizer(),
46
48
  });
47
49
  this.stage = root.stage;
48
50
  this.defaultFunctionProps = root.defaultFunctionProps.map((dfp) => typeof dfp === "function" ? dfp(this) : dfp);
@@ -192,6 +194,17 @@ export class Stack extends cdk.Stack {
192
194
  memorySize: 1024,
193
195
  });
194
196
  }
197
+ static buildSynthesizer() {
198
+ const config = useProject().config;
199
+ const customSynethesizerKeys = Object.keys(config.cdk || {}).filter((key) => key.startsWith("qualifier"));
200
+ if (customSynethesizerKeys.length === 0) {
201
+ return;
202
+ }
203
+ return new cdk.DefaultStackSynthesizer({
204
+ qualifier: config.cdk?.qualifier,
205
+ fileAssetsBucketName: config.cdk?.fileAssetsBucketName,
206
+ });
207
+ }
195
208
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
196
209
  static checkForPropsIsConstruct(id, props) {
197
210
  // If a construct is passed in as stack props, let's detect it and throw a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst",
3
- "version": "2.1.29",
3
+ "version": "2.1.31",
4
4
  "bin": {
5
5
  "sst": "cli/sst.js"
6
6
  },
package/project.d.ts CHANGED
@@ -11,6 +11,16 @@ export interface ConfigOptions {
11
11
  profile?: string;
12
12
  role?: string;
13
13
  ssmPrefix?: string;
14
+ bootstrap?: {
15
+ stackName?: string;
16
+ tags?: Record<string, string>;
17
+ };
18
+ cdk?: {
19
+ toolkitStackName?: string;
20
+ qualifier?: string;
21
+ fileAssetsBucketName?: string;
22
+ publicAccessBlockConfiguration?: boolean;
23
+ };
14
24
  }
15
25
  declare const DEFAULTS: {
16
26
  readonly stage: undefined;
package/project.js CHANGED
@@ -70,6 +70,8 @@ export async function initProject(globals) {
70
70
  region: globals.region || config.region,
71
71
  role: globals.role || config.role,
72
72
  ssmPrefix: config.ssmPrefix || `/sst/${config.name}/${stage}/`,
73
+ bootstrap: config.bootstrap,
74
+ cdk: config.cdk,
73
75
  },
74
76
  stacks: sstConfig.stacks,
75
77
  metafile,
package/sst.mjs CHANGED
@@ -367,7 +367,9 @@ async function initProject(globals) {
367
367
  profile: process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY ? void 0 : globals.profile || config.profile,
368
368
  region: globals.region || config.region,
369
369
  role: globals.role || config.role,
370
- ssmPrefix: config.ssmPrefix || `/sst/${config.name}/${stage}/`
370
+ ssmPrefix: config.ssmPrefix || `/sst/${config.name}/${stage}/`,
371
+ bootstrap: config.bootstrap,
372
+ cdk: config.cdk
371
373
  },
372
374
  stacks: sstConfig.stacks,
373
375
  metafile,
@@ -1861,6 +1863,7 @@ async function useLocalServer(opts) {
1861
1863
  let state2 = {
1862
1864
  app: project.config.name,
1863
1865
  stage: project.config.stage,
1866
+ bootstrap: project.config.bootstrap,
1864
1867
  live: opts.live,
1865
1868
  stacks: {
1866
1869
  status: "idle"
@@ -2767,11 +2770,6 @@ var init_iot2 = __esm({
2767
2770
  });
2768
2771
 
2769
2772
  // src/bootstrap.ts
2770
- var bootstrap_exports = {};
2771
- __export(bootstrap_exports, {
2772
- bootstrapSST: () => bootstrapSST,
2773
- useBootstrap: () => useBootstrap
2774
- });
2775
2773
  import url3 from "url";
2776
2774
  import path8 from "path";
2777
2775
  import { bold, dim } from "colorette";
@@ -2801,12 +2799,12 @@ import {
2801
2799
  BucketEncryption
2802
2800
  } from "aws-cdk-lib/aws-s3";
2803
2801
  async function loadCDKStatus() {
2802
+ const { cdk } = useProject().config;
2804
2803
  const client = useAWSClient(CloudFormationClient);
2804
+ const stackName = cdk?.toolkitStackName || CDK_STACK_NAME;
2805
2805
  try {
2806
2806
  const { Stacks: stacks } = await client.send(
2807
- new DescribeStacksCommand({
2808
- StackName: "CDKToolkit"
2809
- })
2807
+ new DescribeStacksCommand({ StackName: stackName })
2810
2808
  );
2811
2809
  if (!stacks || stacks.length === 0)
2812
2810
  return false;
@@ -2820,41 +2818,71 @@ async function loadCDKStatus() {
2820
2818
  return false;
2821
2819
  return true;
2822
2820
  } catch (e) {
2823
- if (e.name === "ValidationError" && e.message === "Stack with id CDKToolkit does not exist") {
2821
+ if (e.name === "ValidationError" && e.message === `Stack with id ${stackName} does not exist`) {
2824
2822
  return false;
2825
2823
  } else {
2826
2824
  throw e;
2827
2825
  }
2828
2826
  }
2829
2827
  }
2830
- async function bootstrapSST(tags, publicAccessBlockConfiguration, qualifier) {
2831
- tags = tags || {};
2832
- publicAccessBlockConfiguration = publicAccessBlockConfiguration === false ? false : true;
2833
- const project = useProject();
2828
+ async function loadSSTStatus() {
2829
+ const { bootstrap } = useProject().config;
2830
+ const cf = useAWSClient(CloudFormationClient);
2831
+ const stackName = bootstrap?.stackName || SST_STACK_NAME;
2832
+ let result;
2833
+ try {
2834
+ result = await cf.send(
2835
+ new DescribeStacksCommand({
2836
+ StackName: stackName
2837
+ })
2838
+ );
2839
+ } catch (e) {
2840
+ if (e.Code === "ValidationError" && e.message === `Stack with id ${stackName} does not exist`) {
2841
+ return null;
2842
+ }
2843
+ throw e;
2844
+ }
2845
+ let version2, bucket;
2846
+ (result.Stacks[0].Outputs || []).forEach((o) => {
2847
+ if (o.OutputKey === OUTPUT_VERSION) {
2848
+ version2 = o.OutputValue;
2849
+ } else if (o.OutputKey === OUTPUT_BUCKET) {
2850
+ bucket = o.OutputValue;
2851
+ }
2852
+ });
2853
+ if (!version2 || !bucket) {
2854
+ return null;
2855
+ }
2856
+ return { version: version2, bucket };
2857
+ }
2858
+ async function bootstrapSST() {
2859
+ const { region, bootstrap, cdk } = useProject().config;
2834
2860
  const app = new App();
2835
- const stack = new Stack(app, STACK_NAME, {
2861
+ const stackName = bootstrap?.stackName || SST_STACK_NAME;
2862
+ const stack = new Stack(app, stackName, {
2836
2863
  env: {
2837
- region: project.config.region
2864
+ region
2838
2865
  },
2839
2866
  synthesizer: new DefaultStackSynthesizer({
2840
- qualifier
2867
+ qualifier: cdk?.qualifier,
2868
+ fileAssetsBucketName: cdk?.fileAssetsBucketName
2841
2869
  })
2842
2870
  });
2843
- for (const [key, value] of Object.entries(tags)) {
2871
+ for (const [key, value] of Object.entries(bootstrap?.tags || {})) {
2844
2872
  Tags.of(app).add(key, value);
2845
2873
  }
2846
- const bucket = new Bucket(stack, project.config.region, {
2874
+ const bucket = new Bucket(stack, region, {
2847
2875
  encryption: BucketEncryption.S3_MANAGED,
2848
2876
  removalPolicy: RemovalPolicy.DESTROY,
2849
2877
  autoDeleteObjects: true,
2850
- blockPublicAccess: publicAccessBlockConfiguration ? BlockPublicAccess.BLOCK_ALL : void 0
2878
+ blockPublicAccess: cdk?.publicAccessBlockConfiguration !== false ? BlockPublicAccess.BLOCK_ALL : void 0
2851
2879
  });
2852
2880
  const fn = new Function(stack, "MetadataHandler", {
2853
2881
  code: Code.fromAsset(
2854
2882
  path8.resolve(__dirname, "support/bootstrap-metadata-function")
2855
2883
  ),
2856
2884
  handler: "index.handler",
2857
- runtime: project.config.region?.startsWith("us-gov-") ? Runtime.NODEJS_16_X : Runtime.NODEJS_18_X,
2885
+ runtime: region?.startsWith("us-gov-") ? Runtime.NODEJS_16_X : Runtime.NODEJS_18_X,
2858
2886
  environment: {
2859
2887
  BUCKET_NAME: bucket.bucketName
2860
2888
  },
@@ -2920,7 +2948,8 @@ ${JSON.stringify(
2920
2948
  async function bootstrapCDK() {
2921
2949
  const identity = await useSTSIdentity();
2922
2950
  const credentials = await useAWSCredentials();
2923
- const { region, profile } = useProject().config;
2951
+ const { region, profile, cdk } = useProject().config;
2952
+ cdk || {};
2924
2953
  await new Promise((resolve, reject) => {
2925
2954
  const proc = spawn(
2926
2955
  [
@@ -2928,7 +2957,11 @@ async function bootstrapCDK() {
2928
2957
  "cdk",
2929
2958
  "bootstrap",
2930
2959
  `aws://${identity.Account}/${region}`,
2931
- "--no-version-reporting"
2960
+ "--no-version-reporting",
2961
+ ...cdk?.publicAccessBlockConfiguration === false ? ["--public-access-block-configuration", "false"] : cdk?.publicAccessBlockConfiguration === true ? ["--public-access-block-configuration", "false"] : [],
2962
+ ...cdk?.toolkitStackName ? ["--toolkit-stack-name", cdk.toolkitStackName] : [],
2963
+ ...cdk?.qualifier ? ["--qualifier", cdk.qualifier] : [],
2964
+ ...cdk?.fileAssetsBucketName ? ["--toolkit-bucket-name", cdk.fileAssetsBucketName] : []
2932
2965
  ].join(" "),
2933
2966
  {
2934
2967
  env: {
@@ -2962,35 +2995,7 @@ async function bootstrapCDK() {
2962
2995
  });
2963
2996
  });
2964
2997
  }
2965
- async function loadSSTStatus() {
2966
- const cf = useAWSClient(CloudFormationClient);
2967
- let result;
2968
- try {
2969
- result = await cf.send(
2970
- new DescribeStacksCommand({
2971
- StackName: STACK_NAME
2972
- })
2973
- );
2974
- } catch (e) {
2975
- if (e.Code === "ValidationError" && e.message === `Stack with id ${STACK_NAME} does not exist`) {
2976
- return null;
2977
- }
2978
- throw e;
2979
- }
2980
- let version2, bucket;
2981
- (result.Stacks[0].Outputs || []).forEach((o) => {
2982
- if (o.OutputKey === OUTPUT_VERSION) {
2983
- version2 = o.OutputValue;
2984
- } else if (o.OutputKey === OUTPUT_BUCKET) {
2985
- bucket = o.OutputValue;
2986
- }
2987
- });
2988
- if (!version2 || !bucket) {
2989
- return null;
2990
- }
2991
- return { version: version2, bucket };
2992
- }
2993
- var STACK_NAME, OUTPUT_VERSION, OUTPUT_BUCKET, LATEST_VERSION, __dirname, useBootstrap;
2998
+ var CDK_STACK_NAME, SST_STACK_NAME, OUTPUT_VERSION, OUTPUT_BUCKET, LATEST_VERSION, __dirname, useBootstrap;
2994
2999
  var init_bootstrap = __esm({
2995
3000
  "src/bootstrap.ts"() {
2996
3001
  "use strict";
@@ -3001,7 +3006,8 @@ var init_bootstrap = __esm({
3001
3006
  init_error();
3002
3007
  init_logger();
3003
3008
  init_stacks();
3004
- STACK_NAME = "SSTBootstrap";
3009
+ CDK_STACK_NAME = "CDKToolkit";
3010
+ SST_STACK_NAME = "SSTBootstrap";
3005
3011
  OUTPUT_VERSION = "Version";
3006
3012
  OUTPUT_BUCKET = "BucketName";
3007
3013
  LATEST_VERSION = "7";
@@ -3045,7 +3051,7 @@ import {
3045
3051
  } from "@aws-sdk/client-s3";
3046
3052
  async function metadata() {
3047
3053
  Logger.debug("Fetching app metadata");
3048
- const [project, credentials, bootstrap2] = await Promise.all([
3054
+ const [project, credentials, bootstrap] = await Promise.all([
3049
3055
  useProject(),
3050
3056
  useAWSCredentials(),
3051
3057
  useBootstrap()
@@ -3058,7 +3064,7 @@ async function metadata() {
3058
3064
  const result = await s3.send(
3059
3065
  new GetObjectCommand({
3060
3066
  Key: useS3Key(),
3061
- Bucket: bootstrap2.bucket
3067
+ Bucket: bootstrap.bucket
3062
3068
  })
3063
3069
  );
3064
3070
  const body = await result.Body.transformToString();
@@ -3069,7 +3075,7 @@ async function metadata() {
3069
3075
  }
3070
3076
  async function saveAppMetadata(data2) {
3071
3077
  Logger.debug("Saving app metadata");
3072
- const [project, credentials, bootstrap2] = await Promise.all([
3078
+ const [project, credentials, bootstrap] = await Promise.all([
3073
3079
  useProject(),
3074
3080
  useAWSCredentials(),
3075
3081
  useBootstrap()
@@ -3082,7 +3088,7 @@ async function saveAppMetadata(data2) {
3082
3088
  await s3.send(
3083
3089
  new PutObjectCommand({
3084
3090
  Key: useS3Key(),
3085
- Bucket: bootstrap2.bucket,
3091
+ Bucket: bootstrap.bucket,
3086
3092
  Body: JSON.stringify(data2)
3087
3093
  })
3088
3094
  );
@@ -3092,7 +3098,7 @@ async function saveAppMetadata(data2) {
3092
3098
  }
3093
3099
  async function clearAppMetadata() {
3094
3100
  Logger.debug("Clearing app metadata");
3095
- const [project, credentials, bootstrap2] = await Promise.all([
3101
+ const [project, credentials, bootstrap] = await Promise.all([
3096
3102
  useProject(),
3097
3103
  useAWSCredentials(),
3098
3104
  useBootstrap()
@@ -3104,7 +3110,7 @@ async function clearAppMetadata() {
3104
3110
  await s3.send(
3105
3111
  new DeleteObjectCommand({
3106
3112
  Key: useS3Key(),
3107
- Bucket: bootstrap2.bucket
3113
+ Bucket: bootstrap.bucket
3108
3114
  })
3109
3115
  );
3110
3116
  }
@@ -4673,7 +4679,7 @@ import {
4673
4679
  async function metadata2() {
4674
4680
  Logger.debug("Fetching all metadata");
4675
4681
  const project = useProject();
4676
- const [credentials, bootstrap2] = await Promise.all([
4682
+ const [credentials, bootstrap] = await Promise.all([
4677
4683
  useAWSCredentials(),
4678
4684
  useBootstrap()
4679
4685
  ]);
@@ -4685,7 +4691,7 @@ async function metadata2() {
4685
4691
  const list2 = await s3.send(
4686
4692
  new ListObjectsV2Command({
4687
4693
  Prefix: key,
4688
- Bucket: bootstrap2.bucket
4694
+ Bucket: bootstrap.bucket
4689
4695
  })
4690
4696
  );
4691
4697
  const result = Object.fromEntries(
@@ -4695,7 +4701,7 @@ async function metadata2() {
4695
4701
  const result2 = await s3.send(
4696
4702
  new GetObjectCommand2({
4697
4703
  Key: obj.Key,
4698
- Bucket: bootstrap2.bucket
4704
+ Bucket: bootstrap.bucket
4699
4705
  })
4700
4706
  );
4701
4707
  const body = await result2.Body.transformToString();
@@ -4707,7 +4713,7 @@ async function metadata2() {
4707
4713
  return result;
4708
4714
  }
4709
4715
  async function metadataForStack(stackID) {
4710
- const [project, credentials, bootstrap2] = await Promise.all([
4716
+ const [project, credentials, bootstrap] = await Promise.all([
4711
4717
  useProject(),
4712
4718
  useAWSCredentialsProvider(),
4713
4719
  useBootstrap()
@@ -4717,12 +4723,12 @@ async function metadataForStack(stackID) {
4717
4723
  credentials
4718
4724
  });
4719
4725
  const key = `stackMetadata/app.${project.config.name}/stage.${project.config.stage}/stack.${stackID}.json`;
4720
- Logger.debug("Getting metadata", key, "from", bootstrap2.bucket);
4726
+ Logger.debug("Getting metadata", key, "from", bootstrap.bucket);
4721
4727
  try {
4722
4728
  const result = await s3.send(
4723
4729
  new GetObjectCommand2({
4724
4730
  Key: key,
4725
- Bucket: bootstrap2.bucket
4731
+ Bucket: bootstrap.bucket
4726
4732
  })
4727
4733
  );
4728
4734
  const body = await result.Body.transformToString();
@@ -7824,51 +7830,6 @@ var telemetry = (program2) => program2.command(
7824
7830
  }
7825
7831
  );
7826
7832
 
7827
- // src/cli/commands/bootstrap.ts
7828
- var bootstrap = (program2) => program2.command(
7829
- "bootstrap",
7830
- "Create the SST bootstrap stack",
7831
- (yargs2) => yargs2.option("tags", {
7832
- type: "array",
7833
- string: true,
7834
- describe: "Tags to add for the bootstrap stack"
7835
- }).option("qualifier", {
7836
- type: "string",
7837
- describe: "A string that is added to the names of all resources in the bootstrap stack"
7838
- }).option("public-access-block-configuration", {
7839
- type: "boolean",
7840
- default: true,
7841
- describe: "Block public access configuration on SST bootstrap bucket"
7842
- }),
7843
- async (args) => {
7844
- const { createSpinner: createSpinner2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
7845
- const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
7846
- const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
7847
- const { bootstrapSST: bootstrapSST2 } = await Promise.resolve().then(() => (init_bootstrap(), bootstrap_exports));
7848
- const { useSTSIdentity: useSTSIdentity2 } = await Promise.resolve().then(() => (init_credentials(), credentials_exports));
7849
- const project = useProject2();
7850
- const identity = await useSTSIdentity2();
7851
- const tags = Object.fromEntries(
7852
- args.tags?.map((t) => t.split("=")) || []
7853
- );
7854
- if (args.tags?.length) {
7855
- Colors2.line(`${Colors2.primary(`\u279C`)} Using tags`, tags);
7856
- }
7857
- const spinner = createSpinner2(" Deploying bootstrap stack").start();
7858
- await bootstrapSST2(
7859
- tags,
7860
- args.publicAccessBlockConfiguration,
7861
- args.qualifier
7862
- );
7863
- spinner.succeed(
7864
- Colors2.bold(
7865
- ` Bootstrapped account ${identity.Account} in region ${project.config.region}`
7866
- )
7867
- );
7868
- process.exit(0);
7869
- }
7870
- );
7871
-
7872
7833
  // src/cli/sst.ts
7873
7834
  dotenv2.config({
7874
7835
  override: true
@@ -7890,7 +7851,6 @@ consoleCommand(program);
7890
7851
  diff2(program);
7891
7852
  version(program);
7892
7853
  telemetry(program);
7893
- bootstrap(program);
7894
7854
  if ("setSourceMapsEnabled" in process) {
7895
7855
  process.setSourceMapsEnabled(true);
7896
7856
  }
@@ -1,19 +0,0 @@
1
- /// <reference types="yargs" />
2
- import type { Program } from "../program.js";
3
- export declare const bootstrap: (program: Program) => import("yargs").Argv<{
4
- stage: string | undefined;
5
- } & {
6
- profile: string | undefined;
7
- } & {
8
- region: string | undefined;
9
- } & {
10
- verbose: boolean | undefined;
11
- } & {
12
- role: string | undefined;
13
- } & {
14
- tags: string[] | undefined;
15
- } & {
16
- qualifier: string | undefined;
17
- } & {
18
- "public-access-block-configuration": boolean;
19
- }>;
@@ -1,31 +0,0 @@
1
- export const bootstrap = (program) => program.command("bootstrap", "Create the SST bootstrap stack", (yargs) => yargs
2
- .option("tags", {
3
- type: "array",
4
- string: true,
5
- describe: "Tags to add for the bootstrap stack",
6
- })
7
- .option("qualifier", {
8
- type: "string",
9
- describe: "A string that is added to the names of all resources in the bootstrap stack",
10
- })
11
- .option("public-access-block-configuration", {
12
- type: "boolean",
13
- default: true,
14
- describe: "Block public access configuration on SST bootstrap bucket",
15
- }), async (args) => {
16
- const { createSpinner } = await import("../spinner.js");
17
- const { Colors } = await import("../colors.js");
18
- const { useProject } = await import("../../project.js");
19
- const { bootstrapSST } = await import("../../bootstrap.js");
20
- const { useSTSIdentity } = await import("../../credentials.js");
21
- const project = useProject();
22
- const identity = await useSTSIdentity();
23
- const tags = Object.fromEntries(args.tags?.map((t) => t.split("=")) || []);
24
- if (args.tags?.length) {
25
- Colors.line(`${Colors.primary(`➜`)} Using tags`, tags);
26
- }
27
- const spinner = createSpinner(" Deploying bootstrap stack").start();
28
- await bootstrapSST(tags, args.publicAccessBlockConfiguration, args.qualifier);
29
- spinner.succeed(Colors.bold(` Bootstrapped account ${identity.Account} in region ${project.config.region}`));
30
- process.exit(0);
31
- });