sst 2.0.0-rc.28 → 2.0.0-rc.29

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.
@@ -1,12 +1,15 @@
1
- import { useProject } from "../../project.js";
2
- export const bind = (program) => program.command("bind <command>", "Binds blah", (yargs) => yargs.positional("command", {
1
+ export const bind = (program) => program.command("bind <command>", "Bind your app's resources to a command", (yargs) => yargs
2
+ .positional("command", {
3
3
  type: "string",
4
- describe: "Command to bind to",
4
+ describe: "The command to bind to",
5
5
  demandOption: true,
6
- }), async (args) => {
6
+ })
7
+ .example(`sst bind "vitest run"`, "Bind your resources to your tests")
8
+ .example(`sst bind "tsx scripts/myscript.ts"`, "Bind your resources to a script"), async (args) => {
7
9
  const { Config } = await import("../../config.js");
8
- const { spawnSync, spawn } = await import("child_process");
10
+ const { spawnSync } = await import("child_process");
9
11
  const { useAWSCredentials } = await import("../../credentials.js");
12
+ const { useProject } = await import("../../project.js");
10
13
  const env = await Config.env();
11
14
  const project = useProject();
12
15
  const credentials = await useAWSCredentials();
@@ -1,5 +1,5 @@
1
1
  /// <reference types="yargs" />
2
- import { Program } from "../program.js";
2
+ import type { Program } from "../program.js";
3
3
  export declare const build: (program: Program) => import("yargs").Argv<{
4
4
  stage: string | undefined;
5
5
  } & {
@@ -7,5 +7,5 @@ export declare const build: (program: Program) => import("yargs").Argv<{
7
7
  } & {
8
8
  region: string | undefined;
9
9
  } & {
10
- from: string | undefined;
10
+ to: string | undefined;
11
11
  }>;
@@ -1,10 +1,14 @@
1
- import { useProject } from "../../project.js";
2
- import { createSpinner } from "../spinner.js";
3
- export const build = (program) => program.command("build", "Build stacks code", (yargs) => yargs.option("from", { type: "string" }), async () => {
1
+ export const build = (program) => program.command("build", "Build your app", (yargs) => yargs.option("to", {
2
+ type: "string",
3
+ describe: "Output directory, defaults to .sst/dist",
4
+ }), async (args) => {
5
+ const { useProject } = await import("../../project.js");
6
+ const { createSpinner } = await import("../spinner.js");
4
7
  const { Stacks } = await import("../../stacks/index.js");
5
8
  const spinner = createSpinner("Building stacks").start();
6
9
  await Stacks.synth({
7
10
  fn: useProject().stacks,
11
+ buildDir: args.to,
8
12
  mode: "deploy",
9
13
  });
10
14
  spinner.succeed();
@@ -1,5 +1,5 @@
1
1
  /// <reference types="yargs" />
2
- import { Program } from "../program.js";
2
+ import type { Program } from "../program.js";
3
3
  export declare const consoleCommand: (program: Program) => Promise<import("yargs").Argv<{
4
4
  stage: string | undefined;
5
5
  } & {
@@ -1,7 +1,7 @@
1
- import { blue } from "colorette";
2
- import { useRuntimeServer } from "../../runtime/server.js";
3
- import { useLocalServer } from "../local/server.js";
4
- export const consoleCommand = async (program) => program.command("console", "Start the sst console", (yargs) => yargs, async () => {
1
+ export const consoleCommand = async (program) => program.command("console", "Start the SST Console", (yargs) => yargs, async () => {
2
+ const { blue } = await import("colorette");
3
+ const { useRuntimeServer } = await import("../../runtime/server.js");
4
+ const { useLocalServer } = await import("../local/server.js");
5
5
  await Promise.all([
6
6
  useRuntimeServer(),
7
7
  useLocalServer({
@@ -1,14 +1,20 @@
1
- import { printDeploymentResults } from "../ui/deploy.js";
2
- import { createSpinner } from "../spinner.js";
3
- export const deploy = (program) => program.command("deploy [filter]", "Work on your SST app locally", (yargs) => yargs
4
- .option("from", { type: "string" })
1
+ export const deploy = (program) => program.command("deploy [filter]", "Deploy your app to AWS", (yargs) => yargs
2
+ .option("from", {
3
+ type: "string",
4
+ describe: "Deploy using previously built output",
5
+ })
5
6
  .option("fullscreen", {
6
7
  type: "boolean",
7
8
  describe: "Disable full screen UI",
8
9
  default: true,
9
10
  })
10
- .positional("filter", { type: "string" }), async (args) => {
11
+ .positional("filter", {
12
+ type: "string",
13
+ describe: "Optionally filter stacks to deploy",
14
+ }), async (args) => {
11
15
  const React = await import("react");
16
+ const { printDeploymentResults } = await import("../ui/deploy.js");
17
+ const { createSpinner } = await import("../spinner.js");
12
18
  const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
13
19
  const { blue, bold } = await import("colorette");
14
20
  const { useProject } = await import("../../project.js");
@@ -34,7 +40,6 @@ export const deploy = (program) => program.command("deploy [filter]", "Work on y
34
40
  if (!target.length) {
35
41
  console.log(`No stacks found matching ${blue(args.filter)}`);
36
42
  process.exit(1);
37
- return;
38
43
  }
39
44
  console.log(`Deploying ${bold(target.length + " stacks")} for stage ${blue(project.config.stage)}...`);
40
45
  const cleanup = (() => {
@@ -1,16 +1,4 @@
1
- import path from "path";
2
- import fs from "fs/promises";
3
- import crypto from "crypto";
4
- import { printDeploymentResults } from "../ui/deploy.js";
5
- import { useFunctions } from "../../constructs/Function.js";
6
- import { dim, gray, yellow } from "colorette";
7
- import { SiteEnv } from "../../site-env.js";
8
- import { usePothosBuilder } from "./plugins/pothos.js";
9
- import { useKyselyTypeGenerator } from "./plugins/kysely.js";
10
- import { useRDSWarmer } from "./plugins/warmer.js";
11
- import { useProject } from "../../project.js";
12
- import { useMetadata } from "../../stacks/metadata.js";
13
- export const dev = (program) => program.command(["start", "dev"], "Work on your SST app locally", (yargs) => yargs.option("fullscreen", {
1
+ export const dev = (program) => program.command(["dev", "start"], "Work on your app locally", (yargs) => yargs.option("fullscreen", {
14
2
  type: "boolean",
15
3
  describe: "Disable full screen UI",
16
4
  default: true,
@@ -29,6 +17,18 @@ export const dev = (program) => program.command(["start", "dev"], "Work on your
29
17
  const { Context } = await import("../../context/context.js");
30
18
  const { DeploymentUI } = await import("../ui/deploy.js");
31
19
  const { useLocalServer } = await import("../local/server.js");
20
+ const path = await import("path");
21
+ const fs = await import("fs/promises");
22
+ const crypto = await import("crypto");
23
+ const { printDeploymentResults } = await import("../ui/deploy.js");
24
+ const { useFunctions } = await import("../../constructs/Function.js");
25
+ const { dim, gray, yellow } = await import("colorette");
26
+ const { SiteEnv } = await import("../../site-env.js");
27
+ const { usePothosBuilder } = await import("./plugins/pothos.js");
28
+ const { useKyselyTypeGenerator } = await import("./plugins/kysely.js");
29
+ const { useRDSWarmer } = await import("./plugins/warmer.js");
30
+ const { useProject } = await import("../../project.js");
31
+ const { useMetadata } = await import("../../stacks/metadata.js");
32
32
  if (args._[0] === "start") {
33
33
  console.log(yellow(`Warning: ${bold(`sst start`)} has been renamed to ${bold(`sst dev`)}`));
34
34
  }
@@ -7,5 +7,5 @@ export declare const diff: (program: Program) => import("yargs").Argv<{
7
7
  } & {
8
8
  region: string | undefined;
9
9
  } & {
10
- mode: string;
10
+ dev: boolean | undefined;
11
11
  }>;
@@ -1,19 +1,18 @@
1
- import { useProject } from "../../project.js";
2
- import { Stacks } from "../../stacks/index.js";
3
- import { printStackDiff } from "aws-cdk/lib/diff.js";
4
- import { useAWSClient } from "../../credentials.js";
5
- import { CloudFormationClient, GetTemplateCommand, } from "@aws-sdk/client-cloudformation";
6
- import { createSpinner } from "../spinner.js";
7
- export const diff = (program) => program.command("diff", "", (yargs) => yargs.option("mode", {
8
- type: "string",
9
- describe: "deploy or dev",
10
- default: "deploy",
1
+ export const diff = (program) => program.command("diff", "Compare your app with what is deployed on AWS", (yargs) => yargs.option("dev", {
2
+ type: "boolean",
3
+ describe: "Compare in dev mode",
11
4
  }), async (args) => {
5
+ const { printStackDiff } = await import("aws-cdk/lib/diff.js");
6
+ const { useProject } = await import("../../project.js");
7
+ const { Stacks } = await import("../../stacks/index.js");
8
+ const { useAWSClient } = await import("../../credentials.js");
9
+ const { CloudFormationClient, GetTemplateCommand } = await import("@aws-sdk/client-cloudformation");
10
+ const { createSpinner } = await import("../spinner.js");
12
11
  const spinner = createSpinner("Building stacks");
13
12
  const project = useProject();
14
13
  const assembly = await Stacks.synth({
15
14
  fn: project.stacks,
16
- mode: args.mode,
15
+ mode: args.dev ? "dev" : "deploy",
17
16
  });
18
17
  spinner.succeed();
19
18
  const cfn = useAWSClient(CloudFormationClient);
@@ -1,5 +1,5 @@
1
1
  /// <reference types="yargs" />
2
- import { Program } from "../program.js";
2
+ import type { Program } from "../program.js";
3
3
  export declare const env: (program: Program) => import("yargs").Argv<{
4
4
  stage: string | undefined;
5
5
  } & {
@@ -1,14 +1,15 @@
1
- import { useProject } from "../../project.js";
2
- import { createSpinner } from "../spinner.js";
3
- import fs from "fs/promises";
4
- import { SiteEnv } from "../../site-env.js";
5
- import { spawnSync } from "child_process";
6
- export const env = (program) => program.command("env <command>", "description", (yargs) => yargs.positional("command", {
1
+ export const env = (program) => program.command("env <command>", "Load environment variables and start your frontend", (yargs) => yargs
2
+ .positional("command", {
7
3
  type: "string",
8
- describe: "Command to run with environment variabels loaded",
4
+ describe: "The command to start your frontend",
9
5
  demandOption: true,
10
- }), async (args) => {
11
- const project = useProject();
6
+ })
7
+ .example(`sst env "next dev"`, "Start Next.js with your environment variables")
8
+ .example(`sst env "vite dev"`, "Start Vite with your environment variables"), async (args) => {
9
+ const { createSpinner } = await import("../spinner.js");
10
+ const fs = await import("fs/promises");
11
+ const { SiteEnv } = await import("../../site-env.js");
12
+ const { spawnSync } = await import("child_process");
12
13
  let spinner;
13
14
  while (true) {
14
15
  const exists = await fs
@@ -1,13 +1,14 @@
1
- import { createSpinner } from "../spinner.js";
2
- import { printDeploymentResults } from "../ui/deploy.js";
3
- export const remove = (program) => program.command("remove [filter]", "Remove all stacks for this app", (yargs) => yargs
1
+ export const remove = (program) => program.command("remove [filter]", "Remove your app from AWS", (yargs) => yargs
4
2
  .option("from", { type: "string" })
5
3
  .option("fullscreen", {
6
4
  type: "boolean",
7
5
  describe: "Disable full screen UI",
8
6
  default: true,
9
7
  })
10
- .positional("filter", { type: "string" }), async (args) => {
8
+ .positional("filter", {
9
+ type: "string",
10
+ describe: "Optionally filter stacks to remove",
11
+ }), async (args) => {
11
12
  const React = await import("react");
12
13
  const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
13
14
  const { blue, bold } = await import("colorette");
@@ -15,6 +16,8 @@ export const remove = (program) => program.command("remove [filter]", "Remove al
15
16
  const { Stacks } = await import("../../stacks/index.js");
16
17
  const { render } = await import("ink");
17
18
  const { DeploymentUI } = await import("../ui/deploy.js");
19
+ const { printDeploymentResults } = await import("../ui/deploy.js");
20
+ const { createSpinner } = await import("../spinner.js");
18
21
  const assembly = await (async function () {
19
22
  if (args.from) {
20
23
  const result = new CloudAssembly(args.from);
@@ -1,6 +1,6 @@
1
1
  /// <reference types="yargs" />
2
2
  import { Program } from "../../program.js";
3
- export declare const get: (program: Program) => import("yargs").Argv<import("yargs").Omit<{
3
+ export declare const get: (program: Program) => import("yargs").Argv<{
4
4
  stage: string | undefined;
5
5
  } & {
6
6
  profile: string | undefined;
@@ -8,6 +8,6 @@ export declare const get: (program: Program) => import("yargs").Argv<import("yar
8
8
  region: string | undefined;
9
9
  } & {
10
10
  name: string;
11
- }, "name"> & {
12
- name: string;
11
+ } & {
12
+ fallback: boolean | undefined;
13
13
  }>;
@@ -1,33 +1,20 @@
1
- import { red } from "colorette";
2
- export const get = (program) => program
3
- .command("get <name>", "Get secret value", (yargs) => yargs.positional("name", {
1
+ export const get = (program) => program.command("get <name>", "Get the value of a secret", (yargs) => yargs
2
+ .positional("name", {
4
3
  type: "string",
5
- describe: "Name of secret",
4
+ describe: "Name of the secret",
6
5
  demandOption: true,
7
- }), async (args) => {
8
- const { Config } = await import("../../../config.js");
9
- const { bold } = await import("colorette");
10
- try {
11
- const result = await Config.getSecret({
12
- key: args.name,
13
- });
14
- console.log(bold(result));
15
- }
16
- catch {
17
- console.log(red(`${bold(args.name)} is not set`));
18
- }
19
6
  })
20
- .command("get-fallback <name>", "Get secret value", (yargs) => yargs.positional("name", {
21
- type: "string",
22
- describe: "Name of secret",
23
- demandOption: true,
7
+ .option("fallback", {
8
+ type: "boolean",
9
+ describe: "Get the fallback value",
24
10
  }), async (args) => {
11
+ const { red } = await import("colorette");
25
12
  const { Config } = await import("../../../config.js");
26
13
  const { bold } = await import("colorette");
27
14
  try {
28
15
  const result = await Config.getSecret({
29
16
  key: args.name,
30
- fallback: true,
17
+ fallback: args.fallback === true,
31
18
  });
32
19
  console.log(bold(result));
33
20
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="yargs" />
2
- import { Program } from "../../program.js";
2
+ import type { Program } from "../../program.js";
3
3
  export declare const list: (program: Program) => import("yargs").Argv<{
4
4
  stage: string | undefined;
5
5
  } & {
@@ -7,5 +7,5 @@ export declare const list: (program: Program) => import("yargs").Argv<{
7
7
  } & {
8
8
  region: string | undefined;
9
9
  } & {
10
- format: string;
10
+ format: string | undefined;
11
11
  }>;
@@ -1,8 +1,11 @@
1
- import { Config } from "../../../config.js";
2
- import { gray } from "colorette";
3
- export const list = (program) => program.command("list [format]", "Fetch and decrypt all secrets", yargs => yargs.positional("format", { type: "string", default: "table" }), async (args) => {
1
+ export const list = (program) => program.command("list [format]", "Fetch all the secrets", (yargs) => yargs.positional("format", {
2
+ type: "string",
3
+ choices: ["table", "env"],
4
+ }), async (args) => {
5
+ const { Config } = await import("../../../config.js");
6
+ const { gray } = await import("colorette");
4
7
  const secrets = await Config.secrets();
5
- switch (args.format) {
8
+ switch (args.format || "table") {
6
9
  case "env":
7
10
  for (const [key, value] of Object.entries(secrets)) {
8
11
  console.log(`${key}=${value.value || value.fallback}`);
@@ -10,8 +13,8 @@ export const list = (program) => program.command("list [format]", "Fetch and dec
10
13
  break;
11
14
  case "table":
12
15
  const keys = Object.keys(secrets);
13
- const keyLen = Math.max("Secrets".length, ...keys.map(key => key.length));
14
- const valueLen = Math.max("Values".length, ...keys.map(key => secrets[key].value
16
+ const keyLen = Math.max("Secrets".length, ...keys.map((key) => key.length));
17
+ const valueLen = Math.max("Values".length, ...keys.map((key) => secrets[key].value
15
18
  ? secrets[key].value.length
16
19
  : `${secrets[key].fallback} (fallback)`.length));
17
20
  console.log("┌".padEnd(keyLen + 3, "─") +
@@ -23,7 +26,7 @@ export const list = (program) => program.command("list [format]", "Fetch and dec
23
26
  "┼" +
24
27
  "".padEnd(valueLen + 2, "─") +
25
28
  "┤");
26
- keys.sort().forEach(key => {
29
+ keys.sort().forEach((key) => {
27
30
  const value = secrets[key].value
28
31
  ? secrets[key].value
29
32
  : `${secrets[key].fallback} ${gray("(fallback)")}`;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="yargs" />
2
- import { Program } from "../../program.js";
3
- export declare const remove: (program: Program) => import("yargs").Argv<import("yargs").Omit<{
2
+ import type { Program } from "../../program.js";
3
+ export declare const remove: (program: Program) => import("yargs").Argv<{
4
4
  stage: string | undefined;
5
5
  } & {
6
6
  profile: string | undefined;
@@ -8,6 +8,6 @@ export declare const remove: (program: Program) => import("yargs").Argv<import("
8
8
  region: string | undefined;
9
9
  } & {
10
10
  name: string;
11
- }, "name"> & {
12
- name: string;
11
+ } & {
12
+ fallback: boolean | undefined;
13
13
  }>;
@@ -1,21 +1,16 @@
1
- import { Config } from "../../../config.js";
2
- export const remove = (program) => program
3
- .command("remove <name>", "Remove secret", (yargs) => yargs.positional("name", {
4
- describe: "Name of secret to remove",
1
+ export const remove = (program) => program.command("remove <name>", "Remove a secret", (yargs) => yargs
2
+ .positional("name", {
3
+ describe: "Name of the secret",
5
4
  type: "string",
6
5
  demandOption: true,
7
- }), async (args) => {
8
- await Config.removeSecret({
9
- key: args.name,
10
- });
11
6
  })
12
- .command("remove-fallback <name>", "Remove secret", (yargs) => yargs.positional("name", {
13
- describe: "Name of secret to remove",
14
- type: "string",
15
- demandOption: true,
7
+ .option("fallback", {
8
+ type: "boolean",
9
+ describe: "Remove the fallback value",
16
10
  }), async (args) => {
11
+ const { Config } = await import("../../../config.js");
17
12
  await Config.removeSecret({
18
13
  key: args.name,
19
- fallback: true,
14
+ fallback: args.fallback === true,
20
15
  });
21
16
  });
@@ -1,14 +1,11 @@
1
- import { get } from "./get.js";
2
- import { list } from "./list.js";
3
- import { remove } from "./remove.js";
4
1
  import { set } from "./set.js";
5
2
  export function secrets(program) {
6
- program.command("secrets", "Manage secrets", (yargs) => {
3
+ program.command("secrets", "Manage the secrets in your app", (yargs) => {
7
4
  yargs.demandCommand(1);
8
- remove(yargs);
9
- get(yargs);
10
- list(yargs);
11
5
  set(yargs);
6
+ // get(yargs);
7
+ // list(yargs);
8
+ // remove(yargs);
12
9
  return yargs;
13
10
  });
14
11
  }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="yargs" />
2
- import { Program } from "../../program.js";
3
- export declare const set: (program: Program) => import("yargs").Argv<import("yargs").Omit<import("yargs").Omit<{
2
+ import type { Program } from "../../program.js";
3
+ export declare const set: (program: Program) => import("yargs").Argv<{
4
4
  stage: string | undefined;
5
5
  } & {
6
6
  profile: string | undefined;
@@ -10,8 +10,6 @@ export declare const set: (program: Program) => import("yargs").Argv<import("yar
10
10
  name: string;
11
11
  } & {
12
12
  value: string;
13
- }, "name"> & {
14
- name: string;
15
- }, "value"> & {
16
- value: string;
13
+ } & {
14
+ fallback: boolean | undefined;
17
15
  }>;
@@ -1,46 +1,29 @@
1
- import { Config } from "../../../config.js";
2
- import { blue } from "colorette";
3
- import { createSpinner } from "../../spinner.js";
4
- export const set = (program) => program
5
- .command("set <name> <value>", "Set secret value", yargs => yargs
1
+ export const set = (program) => program.command("set <name> <value>", "Set the value of a secret", (yargs) => yargs
6
2
  .positional("name", {
7
3
  type: "string",
8
- describe: "Name of secret",
9
- demandOption: true
4
+ describe: "Name of the secret",
5
+ demandOption: true,
10
6
  })
11
7
  .positional("value", {
12
8
  type: "string",
13
- describe: "Value to set",
14
- demandOption: true
9
+ describe: "Value of the secret",
10
+ demandOption: true,
11
+ })
12
+ .option("fallback", {
13
+ type: "boolean",
14
+ describe: "Set the fallback value",
15
15
  }), async (args) => {
16
+ const { Config } = await import("../../../config.js");
17
+ const { blue } = await import("colorette");
18
+ const { createSpinner } = await import("../../spinner.js");
16
19
  const setting = createSpinner(`Setting secret ${blue(args.name)}`).start();
17
20
  await Config.setSecret({
18
21
  key: args.name,
19
- value: args.value
22
+ value: args.value,
23
+ fallback: args.fallback === true,
20
24
  });
21
25
  setting.succeed();
22
26
  const restarting = createSpinner(`Restarting all functions using ${blue(args.name)}...`).start();
23
27
  const count = await Config.restart(args.name);
24
28
  restarting.succeed(`Restarted ${blue(count)} functions`);
25
- })
26
- .command("set-fallback <name> <value>", "Set a fallback value for secret", yargs => yargs
27
- .positional("name", {
28
- type: "string",
29
- describe: "Name of secret",
30
- demandOption: true
31
- })
32
- .positional("value", {
33
- type: "string",
34
- describe: "Value to set",
35
- demandOption: true
36
- }), async (args) => {
37
- console.log("Setting", `${blue(args.name)}...`);
38
- await Config.setSecret({
39
- key: args.name,
40
- value: args.value,
41
- fallback: true
42
- });
43
- console.log("Restarting all functions using", `${blue(args.name)}...`);
44
- const count = await Config.restart(args.name);
45
- console.log("✅ Restarted", `${blue(count)}`, "functions");
46
29
  });
@@ -1,5 +1,5 @@
1
1
  /// <reference types="yargs" />
2
- import { Program } from "../program.js";
2
+ import type { Program } from "../program.js";
3
3
  export declare const update: (program: Program) => import("yargs").Argv<{
4
4
  stage: string | undefined;
5
5
  } & {
@@ -7,5 +7,5 @@ export declare const update: (program: Program) => import("yargs").Argv<{
7
7
  } & {
8
8
  region: string | undefined;
9
9
  } & {
10
- ver: string | undefined;
10
+ version: string | undefined;
11
11
  }>;
@@ -1,17 +1,35 @@
1
- import { green, yellow } from "colorette";
2
- import fs from "fs/promises";
3
- import path from "path";
4
1
  const PACKAGE_MATCH = ["sst", "aws-cdk", "@aws-cdk", "constructs"];
5
2
  const FIELDS = ["dependencies", "devDependencies"];
6
- export const update = (program) => program.command("update [ver]", "Update SST and CDK packages to another version", (yargs) => yargs.positional("ver", {
3
+ export const update = (program) => program.command("update [version]", "Update your SST and CDK packages", (yargs) => yargs.positional("version", {
7
4
  type: "string",
8
- describe: "Optional SST version to update to",
5
+ describe: "Optionally specify a version to update to",
9
6
  }), async (args) => {
7
+ const { green, yellow } = await import("colorette");
8
+ const fs = await import("fs/promises");
9
+ const path = await import("path");
10
10
  const { fetch } = await import("undici");
11
11
  const { useProject } = await import("../../project.js");
12
+ async function find(dir) {
13
+ const children = await fs.readdir(dir);
14
+ const tasks = children.map(async (item) => {
15
+ if (item === "node_modules")
16
+ return [];
17
+ // Ignore hidden paths
18
+ if (/(^|\/)\.[^\/\.]/g.test(item))
19
+ return [];
20
+ const full = path.join(dir, item);
21
+ if (item === "package.json")
22
+ return [full];
23
+ const stat = await fs.stat(full);
24
+ if (stat.isDirectory())
25
+ return find(full);
26
+ return [];
27
+ });
28
+ return (await Promise.all(tasks)).flat();
29
+ }
12
30
  const project = useProject();
13
31
  const files = await find(project.paths.root);
14
- const metadata = await fetch(`https://registry.npmjs.org/sst/${args.ver || "latest"}`).then((resp) => resp.json());
32
+ const metadata = await fetch(`https://registry.npmjs.org/sst/${args.version || "latest"}`).then((resp) => resp.json());
15
33
  const results = new Map();
16
34
  const tasks = files.map(async (file) => {
17
35
  const data = await fs
@@ -60,21 +78,3 @@ export const update = (program) => program.command("update [ver]", "Update SST a
60
78
  }
61
79
  console.log(yellow("Don't forget to run your package manager to install the packages"));
62
80
  });
63
- async function find(dir) {
64
- const children = await fs.readdir(dir);
65
- const tasks = children.map(async (item) => {
66
- if (item === "node_modules")
67
- return [];
68
- // Ignore hidden paths
69
- if (/(^|\/)\.[^\/\.]/g.test(item))
70
- return [];
71
- const full = path.join(dir, item);
72
- if (item === "package.json")
73
- return [full];
74
- const stat = await fs.stat(full);
75
- if (stat.isDirectory())
76
- return find(full);
77
- return [];
78
- });
79
- return (await Promise.all(tasks)).flat();
80
- }
@@ -0,0 +1,11 @@
1
+ /// <reference types="yargs" />
2
+ import { Program } from "../program.js";
3
+ export declare const env: (program: Program) => import("yargs").Argv<{
4
+ stage: string | undefined;
5
+ } & {
6
+ profile: string | undefined;
7
+ } & {
8
+ region: string | undefined;
9
+ } & {
10
+ command: string;
11
+ }>;