Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion common/config/rush-plugins/rush-serve-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
"phasedCommands": ["start"],
"portParameterLongName": "--port",
"buildStatusWebSocketPath": "/ws",
"logServePath": "/logs"
"logServePath": "/logs",
"globalRouting": [
{
"workspaceRelativeFolder": "rush-plugins/rush-serve-plugin/lib-commonjs/dashboard",
"servePath": "/dashboard",
"immutable": false
}
]
}
19 changes: 19 additions & 0 deletions rush-plugins/rush-serve-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ This plugin also provides a web socket server that notifies clients of the build

The recommended way to connect to the web socket is to serve a static HTML page from the serve plugin using the `globalRouting` configuration.

This package includes a ready-made dashboard whose source lives under `src/dashboard/` and whose built assets are emitted to `lib-commonjs/dashboard/`. Because the HTML references sibling `dashboard.css` and `dashboard.ts` files, serve the built folder rather than a single file:

```json
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-serve-plugin-options.schema.json",
"phasedCommands": ["start"],
"buildStatusWebSocketPath": "/ws",
"globalRouting": [
{
"workspaceRelativeFolder": "rush-plugins/rush-serve-plugin/lib-commonjs/dashboard",
"servePath": "/dashboard",
"immutable": false
}
]
}
```

Then open `https://localhost:<port>/dashboard/dashboard.html`.

To use the socket:

```ts
Expand Down
16 changes: 16 additions & 0 deletions rush-plugins/rush-serve-plugin/config/heft.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@
]
}
}
},
"copy-dashboard-assets": {
"taskPlugin": {
"pluginPackage": "@rushstack/heft",
"pluginName": "copy-files-plugin",
"options": {
"copyOperations": [
{
"sourcePath": "src/dashboard",
"destinationFolders": ["lib-commonjs/dashboard", "lib-esm/dashboard"],
"fileExtensions": [".html", ".css"],
"hardlink": true
}
]
}
}
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions rush-plugins/rush-serve-plugin/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,25 @@ module.exports = [
...nodeProfile,
...friendlyLocalsMixin,
...tsdocMixin,
{
files: ['src/dashboard/**/*.ts'],
languageOptions: {
sourceType: 'module',
globals: {
URL: 'readonly',
URLSearchParams: 'readonly',
WebSocket: 'readonly',
document: 'readonly',
history: 'readonly',
location: 'readonly',
localStorage: 'readonly',
navigator: 'readonly',
requestAnimationFrame: 'readonly',
self: 'readonly',
window: 'readonly'
}
}
},
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
Expand Down
Loading
Loading