Skip to content

Commit 726412a

Browse files
authoredDec 16, 2024··
Add launch tasks for VS Code (#17772)
* feat: add two launch tasks to start a vite server and attach to an existing vite server * build(deps-dev): install and use cross-env for vite commands * build: add mocked launch task * build: add prompt to check if msw should be on or off * build: defaults * build: rename launch task * build: add compound to start backend and frontend at the same time
1 parent 838294e commit 726412a

File tree

3 files changed

+144
-35
lines changed

3 files changed

+144
-35
lines changed
 

‎.vscode/launch.json

+121-33
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,123 @@
11
{
2-
"version": "0.2.0",
3-
"configurations": [
4-
{
5-
// Use IntelliSense to find out which attributes exist for C# debugging
6-
// Use hover for the description of the existing attributes
7-
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8-
"name": ".NET Core Launch (web)",
9-
"type": "coreclr",
10-
"request": "launch",
11-
"program": "dotnet",
12-
"args": ["run"],
13-
"cwd": "${workspaceFolder}/src/Umbraco.Web.UI",
14-
"stopAtEntry": false,
15-
"requireExactSource": false,
16-
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
17-
"serverReadyAction": {
18-
"action": "openExternally",
19-
"pattern": "\\\\bNow listening on:\\\\s+(https?://\\\\S+)"
20-
},
21-
"env": {
22-
"ASPNETCORE_ENVIRONMENT": "Development"
23-
},
24-
"sourceFileMap": {
25-
"/Views": "${workspaceFolder}/Views"
26-
}
27-
},
28-
{
29-
"name": ".NET Core Attach",
30-
"type": "coreclr",
31-
"request": "attach",
32-
"processId": "${command:pickProcess}"
33-
}
34-
]
2+
"version": "0.2.0",
3+
"compounds": [
4+
{
5+
"name": "Backoffice Launch (Vite + .NET Core)",
6+
"configurations": [
7+
"Backoffice Launch Vite (Chrome)",
8+
".NET Core Serve with External Auth (web)"
9+
],
10+
"stopAll": true,
11+
"presentation": {
12+
"group": "1"
13+
}
14+
}
15+
],
16+
"configurations": [
17+
{
18+
"name": "Backoffice Launch Vite (Chrome)",
19+
"request": "launch",
20+
"env": {
21+
"VITE_UMBRACO_USE_MSW": "${input:AskForMockServer}"
22+
},
23+
"runtimeExecutable": "npx",
24+
"runtimeArgs": ["vite"],
25+
"type": "node",
26+
"cwd": "${workspaceFolder}/src/Umbraco.Web.UI.Client",
27+
"skipFiles": ["<node_internals>/**", "node_modules/**"],
28+
"smartStep": true,
29+
"autoAttachChildProcesses": true,
30+
"serverReadyAction": {
31+
"killOnServerStop": true,
32+
"action": "debugWithChrome",
33+
"pattern": "Local: http://localhost:([0-9]+)",
34+
"uriFormat": "http://localhost:%s",
35+
"webRoot": "${workspaceFolder}/src/Umbraco.Web.UI.Client"
36+
},
37+
"presentation": {
38+
"group": "2"
39+
}
40+
},
41+
{
42+
"name": "Backoffice Attach Vite (Chrome)",
43+
"request": "launch",
44+
"type": "chrome",
45+
"smartStep": true,
46+
"url": "http://localhost:5173/",
47+
"skipFiles": ["<node_internals>/**", "node_modules/**"],
48+
"webRoot": "${workspaceFolder}/src/Umbraco.Web.UI.Client",
49+
"presentation": {
50+
"group": "2"
51+
}
52+
},
53+
{
54+
// Use IntelliSense to find out which attributes exist for C# debugging
55+
// Use hover for the description of the existing attributes
56+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
57+
"name": ".NET Core Launch (web)",
58+
"type": "coreclr",
59+
"request": "launch",
60+
"program": "dotnet",
61+
"args": ["run"],
62+
"cwd": "${workspaceFolder}/src/Umbraco.Web.UI",
63+
"stopAtEntry": false,
64+
"requireExactSource": false,
65+
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
66+
"serverReadyAction": {
67+
"action": "openExternally",
68+
"pattern": "\\\\bNow listening on:\\\\s+(https?://\\\\S+)"
69+
},
70+
"env": {
71+
"ASPNETCORE_ENVIRONMENT": "Development"
72+
},
73+
"sourceFileMap": {
74+
"/Views": "${workspaceFolder}/Umbraco.Web.UI/Views"
75+
},
76+
"presentation": {
77+
"group": "3"
78+
}
79+
},
80+
{
81+
"name": ".NET Core Attach",
82+
"type": "coreclr",
83+
"request": "attach",
84+
"processId": "${command:pickProcess}",
85+
"presentation": {
86+
"group": "3"
87+
}
88+
},
89+
{
90+
"name": ".NET Core Serve with External Auth (web)",
91+
"type": "coreclr",
92+
"request": "launch",
93+
"program": "dotnet",
94+
"args": ["run"],
95+
"cwd": "${workspaceFolder}/src/Umbraco.Web.UI",
96+
"stopAtEntry": false,
97+
"requireExactSource": false,
98+
"checkForDevCert": true,
99+
"env": {
100+
"ASPNETCORE_ENVIRONMENT": "Development",
101+
"ASPNETCORE_URLS": "https://localhost:44339",
102+
"UMBRACO__CMS__SECURITY__BACKOFFICEHOST": "http://localhost:5173",
103+
"UMBRACO__CMS__SECURITY__AUTHORIZECALLBACKPATHNAME": "/oauth_complete",
104+
"UMBRACO__CMS__SECURITY__AUTHORIZECALLBACKLOGOUTPATHNAME": "/logout",
105+
"UMBRACO__CMS__SECURITY__AUTHORIZECALLBACKERRORPATHNAME": "/error"
106+
},
107+
"sourceFileMap": {
108+
"/Views": "${workspaceFolder}/Umbraco.Web.UI/Views"
109+
},
110+
"presentation": {
111+
"group": "3"
112+
}
113+
}
114+
],
115+
"inputs": [
116+
{
117+
"id": "AskForMockServer",
118+
"type": "promptString",
119+
"description": "Use Mock Service Worker (MSW) for Backoffice API calls (off requires a running server)?",
120+
"default": "off"
121+
}
122+
]
35123
}

‎src/Umbraco.Web.UI.Client/package-lock.json

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/Umbraco.Web.UI.Client/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@
161161
"check:circular": "madge --circular --warning --extensions ts ./src",
162162
"compile": "tsc",
163163
"dev": "vite",
164-
"dev:server": "VITE_UMBRACO_USE_MSW=off vite",
165-
"dev:mock": "VITE_UMBRACO_USE_MSW=on vite",
164+
"dev:server": "cross-env VITE_UMBRACO_USE_MSW=off vite",
165+
"dev:mock": "cross-env VITE_UMBRACO_USE_MSW=on vite",
166166
"example": "node ./devops/example-runner/index.js",
167167
"format:fix": "npm run format -- --write",
168168
"format": "prettier 'src/**/*.ts' --check",
@@ -253,6 +253,7 @@
253253
"@web/test-runner": "^0.19.0",
254254
"@web/test-runner-playwright": "^0.11.0",
255255
"babel-loader": "^9.2.1",
256+
"cross-env": "7.0.3",
256257
"eslint": "^9.15.0",
257258
"eslint-config-prettier": "^9.1.0",
258259
"eslint-plugin-import": "^2.31.0",

0 commit comments

Comments
 (0)
Please sign in to comment.