Skip to content

Commit 51a86bc

Browse files
committed
wip
1 parent 971c86d commit 51a86bc

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/plugins/setup.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
saveAuthToken,
88
readAuthToken,
99
} from "../utils/authenticate.ts";
10+
import { findLocalStack } from "../utils/cli.ts";
1011
import { configureAwsProfiles } from "../utils/configure-aws.ts";
1112
import { runInstallProcess } from "../utils/install.ts";
1213
import {
@@ -18,6 +19,14 @@ import { minDelay } from "../utils/promises.ts";
1819
import { updateDockerImage } from "../utils/setup.ts";
1920
import { get_setup_ended } from "../utils/telemetry.ts";
2021

22+
async function getValidCliPath() {
23+
const cli = await findLocalStack()
24+
if (!cli.cliPath || !cli.executable || !cli.found || !cli.upToDate) {
25+
return
26+
}
27+
return cli.cliPath
28+
}
29+
2130
export default createPlugin(
2231
"setup",
2332
({
@@ -225,10 +234,14 @@ export default createPlugin(
225234
/////////////////////////////////////////////////////////////////////
226235
progress.report({ message: "Checking LocalStack license..." });
227236

228-
const cliPath = cliStatusTracker.cliPath();
237+
// If the CLI status tracker doesn't have a valid CLI path yet,
238+
// we must find it manually. This may occur when installing the
239+
// CLI as part of the setup process: the CLI status tracker will
240+
// detect the CLI path the next tick.
241+
const cliPath = cliStatusTracker.cliPath() ?? await getValidCliPath();
229242
if (!cliPath) {
230243
void window.showErrorMessage(
231-
"LocalStack CLI is not configured. Please set it up before running the setup wizard.",
244+
"Could not access the LocalStack CLI.",
232245
);
233246
return;
234247
}

src/utils/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ interface CliCheckResult {
8484
upToDate: boolean | undefined;
8585
}
8686

87-
async function findLocalStack(): Promise<CliCheckResult> {
87+
export async function findLocalStack(): Promise<CliCheckResult> {
8888
// Check if a custom path is configured
8989
const config = workspace.getConfiguration("localstack");
9090
const customLocation = config.get<string | null>("cli.location");

0 commit comments

Comments
 (0)