MCPcopy Create free account
hub / github.com/dethcrypto/dethcode / main

Function main

packages/vscode-host/src/scripts/code-web-deth.js:19–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17const DETH_EXTENSIONS_ROOT = path.join(APP_ROOT, '../dist/extensions');
18
19async function main() {
20 const args = minimist(process.argv.slice(2), {
21 boolean: [
22 'help',
23 'playground'
24 ],
25 string: [
26 'host',
27 'port',
28 'extensionPath',
29 'browser',
30 'browserType'
31 ],
32 });
33
34 if (args.help) {
35 console.log(
36 './scripts/code-web.sh|bat[, folderMountPath[, options]]\n' +
37 ' Start with an empty workspace and no folder opened in explorer\n' +
38 ' folderMountPath Open local folder (eg: use `.` to open current directory)\n'
39 );
40 startServer(['--help']);
41 return;
42 }
43
44 const serverArgs = [];
45
46 const HOST = args['host'] ?? 'localhost';
47 const PORT = args['port'] ?? '8080';
48
49 if (args['host'] === undefined) {
50 serverArgs.push('--host', HOST);
51 }
52 if (args['port'] === undefined) {
53 serverArgs.push('--port', PORT);
54 }
55
56 console.log("Serving extensions from:", DETH_EXTENSIONS_ROOT);
57 serverArgs.push('--extensionPath', DETH_EXTENSIONS_ROOT);
58
59 let openSystemBrowser = false;
60 if (!args['browser'] && !args['browserType']) {
61 serverArgs.push('--browserType', 'none');
62 openSystemBrowser = true;
63 }
64
65 serverArgs.push('--sourcesPath', APP_ROOT);
66
67 serverArgs.push(...process.argv.slice(2).filter(v => !v.startsWith('--playground') && v !== '--no-playground'));
68
69 startServer(serverArgs);
70 if (openSystemBrowser) {
71 opn(`http://${HOST}:${PORT}/`);
72 }
73}
74
75function startServer(runnerArguments) {
76 const env = { ...process.env };

Callers 1

code-web-deth.jsFile · 0.70

Calls 1

startServerFunction · 0.85

Tested by

no test coverage detected