MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / startProjectService

Function startProjectService

packages/vscode-extension/extension.js:91–118  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

89}
90
91async function startProjectService(context) {
92 const config = vscode.workspace.getConfiguration("simdeck");
93 const cliPath = resolveCliPath(context, config.get("cliPath", ""));
94 const port = String(config.get("port", 4311));
95 const bindAddress = config.get("bindAddress", "127.0.0.1");
96 const args = ["service", "start", "--port", port, "--bind", bindAddress];
97
98 outputChannel.appendLine(`Starting SimDeck project service using ${cliPath}`);
99 const result = await runCli(context, cliPath, args);
100 outputChannel.append(result.stderr);
101
102 const deadline = Date.now() + 15000;
103 const metadata = parseJsonOutput(result.stdout, "simdeck service start");
104 const serviceUrl = metadata.url;
105 if (typeof serviceUrl !== "string" || serviceUrl.length === 0) {
106 throw new Error("simdeck service start did not return a service URL.");
107 }
108
109 while (Date.now() < deadline) {
110 if (await isServerHealthy(serviceUrl)) {
111 outputChannel.appendLine(`SimDeck service ready at ${serviceUrl}`);
112 return serviceUrl;
113 }
114 await delay(250);
115 }
116
117 throw new Error(`Timed out waiting for SimDeck at ${serviceUrl}.`);
118}
119
120async function stopProjectService(context) {
121 const config = vscode.workspace.getConfiguration("simdeck");

Callers 1

resolveSimulatorUrlFunction · 0.85

Calls 7

resolveCliPathFunction · 0.85
runCliFunction · 0.85
parseJsonOutputFunction · 0.85
isServerHealthyFunction · 0.85
delayFunction · 0.85
getMethod · 0.65
appendMethod · 0.65

Tested by

no test coverage detected