Skip to content

Commit 84d62ea

Browse files
committed
Add launch config/task for "yarn web"
1 parent 43e85c2 commit 84d62ea

3 files changed

Lines changed: 36 additions & 1 deletion

File tree

.vscode/launch.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@
167167
"web"
168168
],
169169
},
170+
{
171+
"type": "chrome",
172+
"request": "launch",
173+
"name": "Launch Chrome",
174+
"url": "http://localhost:8080",
175+
"preLaunchTask": "Run web"
176+
},
170177
{
171178
"type": "node",
172179
"request": "launch",

.vscode/tasks.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,24 @@
8585
"task": "hygiene",
8686
"problemMatcher": []
8787
},
88+
{
89+
"type": "shell",
90+
"command": "yarn web -- --no-launch",
91+
"label": "Run web",
92+
"isBackground": true,
93+
// This section to make error go away when launching the debug config
94+
"problemMatcher": {
95+
"pattern": {
96+
"regexp": ""
97+
},
98+
"background": {
99+
"beginsPattern": ".*node.*",
100+
"endsPattern": "Web UI available at .*"
101+
}
102+
},
103+
"presentation": {
104+
"reveal": "never"
105+
}
106+
},
88107
]
89108
}

scripts/code-web.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,18 @@ const fs = require('fs');
1313
const path = require('path');
1414
const util = require('util');
1515
const opn = require('opn');
16+
const minimist = require('vscode-minimist');
1617

1718
const APP_ROOT = path.dirname(__dirname);
1819
const WEB_MAIN = path.join(APP_ROOT, 'src', 'vs', 'code', 'browser', 'workbench', 'workbench-dev.html');
1920
const PORT = 8080;
2021

22+
const args = minimist(process.argv, {
23+
string: [
24+
'no-launch'
25+
]
26+
});
27+
2128
const server = http.createServer((req, res) => {
2229
const parsedUrl = url.parse(req.url, true);
2330
const pathname = parsedUrl.pathname;
@@ -213,4 +220,6 @@ async function serveFile(req, res, filePath, responseHeaders = Object.create(nul
213220
}
214221
}
215222

216-
opn(`http://localhost:${PORT}`);
223+
if (args.launch !== false) {
224+
opn(`http://localhost:${PORT}`);
225+
}

0 commit comments

Comments
 (0)