Skip to content

Commit ccba849

Browse files
committed
feat(@angular-devkit/build-angular): support keyboard command shortcuts in application dev server
When using the `application` or `browser-esbuild` builders with the `dev-server`, interactive key shortcuts are now available to use while the server is active. Once the build has successfully completed and the development server has initialized, typing a single letter key followed by enter will execute the associated action. These actions include forcing a browser full reload, clearing the console, or quitting. More actions may be added in the future. The following actions are currently available: ``` press r + enter to force reload browser press u + enter to show server url press o + enter to open in browser press c + enter to clear console press q + enter to quit ``` The `h` action is also available which will display the above list at runtime.
1 parent 9681657 commit ccba849

File tree

1 file changed

+16
-0
lines changed
  • packages/angular_devkit/build_angular/src/builders/dev-server

1 file changed

+16
-0
lines changed

packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,22 @@ export async function* serveWithVite(
270270

271271
// log connection information
272272
server.printUrls();
273+
274+
server.bindCLIShortcuts({
275+
print: true,
276+
customShortcuts: [
277+
{
278+
key: 'r',
279+
description: 'force reload browser',
280+
action(server) {
281+
server.ws.send({
282+
type: 'full-reload',
283+
path: '*',
284+
});
285+
},
286+
},
287+
],
288+
});
273289
}
274290

275291
// TODO: adjust output typings to reflect both development servers

0 commit comments

Comments
 (0)