sst 2.0.0-rc.49 → 2.0.0-rc.50
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/console.js +2 -1
- package/cli/commands/dev.js +2 -1
- package/cli/terminal.d.ts +1 -0
- package/cli/terminal.js +8 -0
- package/credentials.js +14 -0
- package/package.json +1 -1
- package/project.js +5 -5
- package/sst.mjs +38 -6
package/cli/commands/console.js
CHANGED
|
@@ -3,6 +3,7 @@ export const consoleCommand = async (program) => program.command("console", "Sta
|
|
|
3
3
|
const { useRuntimeServer } = await import("../../runtime/server.js");
|
|
4
4
|
const { useLocalServer } = await import("../local/server.js");
|
|
5
5
|
const { printHeader } = await import("../ui/header.js");
|
|
6
|
+
const { clear } = await import("../terminal.js");
|
|
6
7
|
await Promise.all([
|
|
7
8
|
useRuntimeServer(),
|
|
8
9
|
useLocalServer({
|
|
@@ -11,6 +12,6 @@ export const consoleCommand = async (program) => program.command("console", "Sta
|
|
|
11
12
|
live: false,
|
|
12
13
|
}),
|
|
13
14
|
]);
|
|
14
|
-
|
|
15
|
+
clear();
|
|
15
16
|
printHeader({ console: true, hint: "ready!" });
|
|
16
17
|
});
|
package/cli/commands/dev.js
CHANGED
|
@@ -31,6 +31,7 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
|
|
|
31
31
|
const { useRDSWarmer } = await import("./plugins/warmer.js");
|
|
32
32
|
const { useProject } = await import("../../project.js");
|
|
33
33
|
const { useMetadata } = await import("../../stacks/metadata.js");
|
|
34
|
+
const { clear } = await import("../terminal.js");
|
|
34
35
|
if (args._[0] === "start") {
|
|
35
36
|
console.log(yellow(`Warning: ${bold(`sst start`)} has been renamed to ${bold(`sst dev`)}`));
|
|
36
37
|
}
|
|
@@ -218,7 +219,7 @@ export const dev = (program) => program.command(["dev", "start"], "Work on your
|
|
|
218
219
|
cert: "",
|
|
219
220
|
live: true,
|
|
220
221
|
});
|
|
221
|
-
|
|
222
|
+
clear();
|
|
222
223
|
await printHeader({ console: true, hint: "ready!" });
|
|
223
224
|
/*
|
|
224
225
|
console.log(` ${primary(`➜`)} ${bold(dim(`Outputs:`))}`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function clear(): void;
|
package/cli/terminal.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function clear() {
|
|
2
|
+
// console.clear() removes the content in the viewport in VSCode
|
|
3
|
+
// and on Windows. This is a workaround to preserve the viewport.
|
|
4
|
+
for (let i = 0, l = process.stdout.rows; i < l - 1; i++) {
|
|
5
|
+
console.log("");
|
|
6
|
+
}
|
|
7
|
+
console.clear();
|
|
8
|
+
}
|
package/credentials.js
CHANGED
|
@@ -31,6 +31,16 @@ export function useAWSClient(client, force = false) {
|
|
|
31
31
|
if (existing && !force)
|
|
32
32
|
return existing;
|
|
33
33
|
const [project, credentials] = [useProject(), useAWSCredentialsProvider()];
|
|
34
|
+
const printNoInternet = (() => {
|
|
35
|
+
let lastPrinted = 0;
|
|
36
|
+
return () => {
|
|
37
|
+
const now = Date.now();
|
|
38
|
+
if (now - lastPrinted > 5000) {
|
|
39
|
+
console.log("Waiting for internet connection...");
|
|
40
|
+
lastPrinted = now;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
34
44
|
const result = new client({
|
|
35
45
|
region: project.config.region,
|
|
36
46
|
credentials: credentials,
|
|
@@ -42,6 +52,10 @@ export function useAWSClient(client, force = false) {
|
|
|
42
52
|
return false;
|
|
43
53
|
if (err.message === "Could not load credentials from any providers")
|
|
44
54
|
return false;
|
|
55
|
+
// Handle no internet connection
|
|
56
|
+
if (err.code === "ENOTFOUND") {
|
|
57
|
+
printNoInternet();
|
|
58
|
+
}
|
|
45
59
|
return true;
|
|
46
60
|
},
|
|
47
61
|
delayDecider: (_, attempts) => {
|
package/package.json
CHANGED
package/project.js
CHANGED
|
@@ -43,8 +43,8 @@ export async function initProject(globals) {
|
|
|
43
43
|
throw new VisibleError("Could not found a configuration file", "Make sure one of the following exists", ...CONFIG_EXTENSIONS.map((x) => ` - sst${x}`));
|
|
44
44
|
})();
|
|
45
45
|
const config = await Promise.resolve(sstConfig.config(globals));
|
|
46
|
-
const stage =
|
|
47
|
-
|
|
46
|
+
const stage = globals.stage ||
|
|
47
|
+
config.stage ||
|
|
48
48
|
(await usePersonalStage(out)) ||
|
|
49
49
|
(await promptPersonalStage(out));
|
|
50
50
|
const [version, cdkVersion] = await (async () => {
|
|
@@ -64,9 +64,9 @@ export async function initProject(globals) {
|
|
|
64
64
|
config: {
|
|
65
65
|
...config,
|
|
66
66
|
stage,
|
|
67
|
-
profile:
|
|
68
|
-
region:
|
|
69
|
-
role:
|
|
67
|
+
profile: globals.profile || config.profile,
|
|
68
|
+
region: globals.region || config.region,
|
|
69
|
+
role: globals.role || config.role,
|
|
70
70
|
ssmPrefix: config.ssmPrefix || `/sst/${config.name}/${stage}/`,
|
|
71
71
|
},
|
|
72
72
|
stacks: sstConfig.stacks,
|
package/sst.mjs
CHANGED
|
@@ -1003,6 +1003,16 @@ function useAWSClient(client, force = false) {
|
|
|
1003
1003
|
if (existing && !force)
|
|
1004
1004
|
return existing;
|
|
1005
1005
|
const [project, credentials] = [useProject(), useAWSCredentialsProvider()];
|
|
1006
|
+
const printNoInternet = (() => {
|
|
1007
|
+
let lastPrinted = 0;
|
|
1008
|
+
return () => {
|
|
1009
|
+
const now = Date.now();
|
|
1010
|
+
if (now - lastPrinted > 5e3) {
|
|
1011
|
+
console.log("Waiting for internet connection...");
|
|
1012
|
+
lastPrinted = now;
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
1015
|
+
})();
|
|
1006
1016
|
const result = new client({
|
|
1007
1017
|
region: project.config.region,
|
|
1008
1018
|
credentials,
|
|
@@ -1014,6 +1024,9 @@ function useAWSClient(client, force = false) {
|
|
|
1014
1024
|
return false;
|
|
1015
1025
|
if (err.message === "Could not load credentials from any providers")
|
|
1016
1026
|
return false;
|
|
1027
|
+
if (err.code === "ENOTFOUND") {
|
|
1028
|
+
printNoInternet();
|
|
1029
|
+
}
|
|
1017
1030
|
return true;
|
|
1018
1031
|
},
|
|
1019
1032
|
delayDecider: (_, attempts) => {
|
|
@@ -4320,7 +4333,7 @@ async function initProject(globals) {
|
|
|
4320
4333
|
);
|
|
4321
4334
|
}();
|
|
4322
4335
|
const config = await Promise.resolve(sstConfig.config(globals));
|
|
4323
|
-
const stage =
|
|
4336
|
+
const stage = globals.stage || config.stage || await usePersonalStage(out) || await promptPersonalStage(out);
|
|
4324
4337
|
const [version2, cdkVersion] = await (async () => {
|
|
4325
4338
|
try {
|
|
4326
4339
|
const packageJson = JSON.parse(
|
|
@@ -4339,9 +4352,9 @@ async function initProject(globals) {
|
|
|
4339
4352
|
config: {
|
|
4340
4353
|
...config,
|
|
4341
4354
|
stage,
|
|
4342
|
-
profile:
|
|
4343
|
-
region:
|
|
4344
|
-
role:
|
|
4355
|
+
profile: globals.profile || config.profile,
|
|
4356
|
+
region: globals.region || config.region,
|
|
4357
|
+
role: globals.role || config.role,
|
|
4345
4358
|
ssmPrefix: config.ssmPrefix || `/sst/${config.name}/${stage}/`
|
|
4346
4359
|
},
|
|
4347
4360
|
stacks: sstConfig.stacks,
|
|
@@ -5713,6 +5726,23 @@ var init_warmer = __esm({
|
|
|
5713
5726
|
}
|
|
5714
5727
|
});
|
|
5715
5728
|
|
|
5729
|
+
// src/cli/terminal.ts
|
|
5730
|
+
var terminal_exports = {};
|
|
5731
|
+
__export(terminal_exports, {
|
|
5732
|
+
clear: () => clear
|
|
5733
|
+
});
|
|
5734
|
+
function clear() {
|
|
5735
|
+
for (let i = 0, l = process.stdout.rows; i < l - 1; i++) {
|
|
5736
|
+
console.log("");
|
|
5737
|
+
}
|
|
5738
|
+
console.clear();
|
|
5739
|
+
}
|
|
5740
|
+
var init_terminal = __esm({
|
|
5741
|
+
"src/cli/terminal.ts"() {
|
|
5742
|
+
"use strict";
|
|
5743
|
+
}
|
|
5744
|
+
});
|
|
5745
|
+
|
|
5716
5746
|
// src/config.ts
|
|
5717
5747
|
var config_exports = {};
|
|
5718
5748
|
__export(config_exports, {
|
|
@@ -6050,6 +6080,7 @@ var dev = (program2) => program2.command(
|
|
|
6050
6080
|
const { useRDSWarmer: useRDSWarmer2 } = await Promise.resolve().then(() => (init_warmer(), warmer_exports));
|
|
6051
6081
|
const { useProject: useProject2 } = await Promise.resolve().then(() => (init_project(), project_exports));
|
|
6052
6082
|
const { useMetadata: useMetadata2 } = await Promise.resolve().then(() => (init_metadata(), metadata_exports));
|
|
6083
|
+
const { clear: clear2 } = await Promise.resolve().then(() => (init_terminal(), terminal_exports));
|
|
6053
6084
|
if (args._[0] === "start") {
|
|
6054
6085
|
console.log(
|
|
6055
6086
|
yellow(
|
|
@@ -6267,7 +6298,7 @@ var dev = (program2) => program2.command(
|
|
|
6267
6298
|
cert: "",
|
|
6268
6299
|
live: true
|
|
6269
6300
|
});
|
|
6270
|
-
|
|
6301
|
+
clear2();
|
|
6271
6302
|
await printHeader({ console: true, hint: "ready!" });
|
|
6272
6303
|
await Promise.all([
|
|
6273
6304
|
useRuntimeWorkers2(),
|
|
@@ -6479,6 +6510,7 @@ var consoleCommand = async (program2) => program2.command(
|
|
|
6479
6510
|
const { useRuntimeServer: useRuntimeServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
6480
6511
|
const { useLocalServer: useLocalServer2 } = await Promise.resolve().then(() => (init_server2(), server_exports2));
|
|
6481
6512
|
const { printHeader: printHeader2 } = await Promise.resolve().then(() => (init_header(), header_exports));
|
|
6513
|
+
const { clear: clear2 } = await Promise.resolve().then(() => (init_terminal(), terminal_exports));
|
|
6482
6514
|
await Promise.all([
|
|
6483
6515
|
useRuntimeServer2(),
|
|
6484
6516
|
useLocalServer2({
|
|
@@ -6487,7 +6519,7 @@ var consoleCommand = async (program2) => program2.command(
|
|
|
6487
6519
|
live: false
|
|
6488
6520
|
})
|
|
6489
6521
|
]);
|
|
6490
|
-
|
|
6522
|
+
clear2();
|
|
6491
6523
|
printHeader2({ console: true, hint: "ready!" });
|
|
6492
6524
|
}
|
|
6493
6525
|
);
|