sst 2.0.9 → 2.0.10

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,3 +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>): Promise<void>;
package/bootstrap.js CHANGED
@@ -38,7 +38,7 @@ export const useBootstrap = Context.memo(async () => {
38
38
  await bootstrapCDK();
39
39
  }
40
40
  if (needToBootstrapSST) {
41
- await bootstrapSST();
41
+ await bootstrapSST({});
42
42
  // fetch bootstrap status
43
43
  sstStatus = await loadSSTStatus();
44
44
  if (!sstStatus)
@@ -82,7 +82,7 @@ async function loadCDKStatus() {
82
82
  }
83
83
  return false;
84
84
  }
85
- async function bootstrapSST() {
85
+ export async function bootstrapSST(tags) {
86
86
  // Create bootstrap stack
87
87
  const project = useProject();
88
88
  const app = new App();
@@ -92,7 +92,6 @@ async function bootstrapSST() {
92
92
  },
93
93
  });
94
94
  // Add tags to stack
95
- const tags = {};
96
95
  for (const [key, value] of Object.entries(tags)) {
97
96
  Tags.of(app).add(key, value);
98
97
  }
@@ -10,4 +10,6 @@ export declare const bootstrap: (program: Program) => import("yargs").Argv<{
10
10
  verbose: boolean | undefined;
11
11
  } & {
12
12
  role: string | undefined;
13
+ } & {
14
+ tags: string[] | undefined;
13
15
  }>;
@@ -1,11 +1,21 @@
1
- export const bootstrap = (program) => program.command("bootstrap", "Create the SST bootstrap stack", (yargs) => yargs, async () => {
1
+ export const bootstrap = (program) => program.command("bootstrap", "Create the SST bootstrap stack", (yargs) => yargs.option("tags", {
2
+ type: "array",
3
+ string: true,
4
+ describe: "Tags to add for the bootstrap stack",
5
+ }), async (args) => {
6
+ const { createSpinner } = await import("../spinner.js");
2
7
  const { Colors } = await import("../colors.js");
3
8
  const { useProject } = await import("../../project.js");
4
- const { useBootstrap } = await import("../../bootstrap.js");
9
+ const { bootstrapSST } = await import("../../bootstrap.js");
5
10
  const { useSTSIdentity } = await import("../../credentials.js");
6
11
  const project = useProject();
7
12
  const identity = await useSTSIdentity();
8
- await useBootstrap();
9
- Colors.line(Colors.success(`✔`), Colors.bold(` Bootstrapped account ${identity.Account} in region ${project.config.region}`));
13
+ const tags = Object.fromEntries(args.tags?.map((t) => t.split("=")) || []);
14
+ if (args.tags?.length) {
15
+ Colors.line(`${Colors.primary(`➜`)} Using tags`, tags);
16
+ }
17
+ const spinner = createSpinner(" Deploying bootstrap stack").start();
18
+ await bootstrapSST(tags);
19
+ spinner.succeed(Colors.bold(` Bootstrapped account ${identity.Account} in region ${project.config.region}`));
10
20
  process.exit(0);
11
21
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sst",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "bin": {
5
5
  "sst": "cli/sst.js"
6
6
  },
package/sst.mjs CHANGED
@@ -2553,6 +2553,7 @@ var init_iot2 = __esm({
2553
2553
  // src/bootstrap.ts
2554
2554
  var bootstrap_exports = {};
2555
2555
  __export(bootstrap_exports, {
2556
+ bootstrapSST: () => bootstrapSST,
2556
2557
  useBootstrap: () => useBootstrap
2557
2558
  });
2558
2559
  import url3 from "url";
@@ -2603,7 +2604,7 @@ async function loadCDKStatus() {
2603
2604
  }
2604
2605
  return false;
2605
2606
  }
2606
- async function bootstrapSST() {
2607
+ async function bootstrapSST(tags) {
2607
2608
  const project = useProject();
2608
2609
  const app = new App();
2609
2610
  const stack = new Stack(app, STACK_NAME, {
@@ -2611,7 +2612,6 @@ async function bootstrapSST() {
2611
2612
  region: project.config.region
2612
2613
  }
2613
2614
  });
2614
- const tags = {};
2615
2615
  for (const [key, value] of Object.entries(tags)) {
2616
2616
  Tags.of(app).add(key, value);
2617
2617
  }
@@ -2792,7 +2792,7 @@ var init_bootstrap = __esm({
2792
2792
  await bootstrapCDK();
2793
2793
  }
2794
2794
  if (needToBootstrapSST) {
2795
- await bootstrapSST();
2795
+ await bootstrapSST({});
2796
2796
  sstStatus = await loadSSTStatus();
2797
2797
  if (!sstStatus)
2798
2798
  throw new VisibleError("Failed to load bootstrap stack status");
@@ -7297,17 +7297,28 @@ var telemetry = (program2) => program2.command(
7297
7297
  var bootstrap = (program2) => program2.command(
7298
7298
  "bootstrap",
7299
7299
  "Create the SST bootstrap stack",
7300
- (yargs2) => yargs2,
7301
- async () => {
7300
+ (yargs2) => yargs2.option("tags", {
7301
+ type: "array",
7302
+ string: true,
7303
+ describe: "Tags to add for the bootstrap stack"
7304
+ }),
7305
+ async (args) => {
7306
+ const { createSpinner: createSpinner2 } = await Promise.resolve().then(() => (init_spinner(), spinner_exports));
7302
7307
  const { Colors: Colors2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
7303
7308
  const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
7304
- const { useBootstrap: useBootstrap2 } = await Promise.resolve().then(() => (init_bootstrap(), bootstrap_exports));
7309
+ const { bootstrapSST: bootstrapSST2 } = await Promise.resolve().then(() => (init_bootstrap(), bootstrap_exports));
7305
7310
  const { useSTSIdentity: useSTSIdentity2 } = await Promise.resolve().then(() => (init_credentials(), credentials_exports));
7306
7311
  const project = useProject2();
7307
7312
  const identity = await useSTSIdentity2();
7308
- await useBootstrap2();
7309
- Colors2.line(
7310
- Colors2.success(`\u2714`),
7313
+ const tags = Object.fromEntries(
7314
+ args.tags?.map((t) => t.split("=")) || []
7315
+ );
7316
+ if (args.tags?.length) {
7317
+ Colors2.line(`${Colors2.primary(`\u279C`)} Using tags`, tags);
7318
+ }
7319
+ const spinner = createSpinner2(" Deploying bootstrap stack").start();
7320
+ await bootstrapSST2(tags);
7321
+ spinner.succeed(
7311
7322
  Colors2.bold(
7312
7323
  ` Bootstrapped account ${identity.Account} in region ${project.config.region}`
7313
7324
  )