-
Notifications
You must be signed in to change notification settings - Fork 20k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd, dashboard: use webpack dev server, remove custom assets #16263
cmd, dashboard: use webpack dev server, remove custom assets #16263
Conversation
.gitignore
Outdated
@@ -42,3 +42,5 @@ profile.cov | |||
/dashboard/assets/node_modules | |||
/dashboard/assets/stats.json | |||
/dashboard/assets/bundle.js | |||
/dashboard/assets/yarn-error.log | |||
/dashboard/assets/package-lock.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want package lock committed to the repo. That's what ensures reproducible builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, there's yarn.lock. sry
dashboard/README.md
Outdated
$ (cd dashboard/assets && ./node_modules/.bin/flow-typed install) | ||
``` | ||
|
||
Normally the dashboard assets are bundled into Geth via `go-bindata` to avoid external dependencies. Rebuilding Geth after each UI modification however is not feasible from a developer perspective. Instead, we can run `webpack` in watch mode to automatically rebundle the UI, and ask `geth` to use external assets to not rely on compiled resources: | ||
Normally the dashboard assets are bundled into Geth via `go-bindata` to avoid external dependencies. Rebuilding Geth after each UI modification however is not feasible from a developer perspective. Instead, we can run `webpack-dev-server` to run a `geth` independent server which automatically rebundles the UI, and uses external assets to make connection with `geth`, which this way does not rely on compiled resources: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally the dashboard assets are bundled into Geth via go-bindata
to avoid external dependencies. Rebuilding Geth after each UI modification however is not feasible from a developer perspective. Instead, we can run yarn dev
to watch for file system changes and refresh the browser automatically.
dashboard/README.md
Outdated
$ (cd dashboard/assets && ./node_modules/.bin/webpack --watch) | ||
$ geth --dashboard --dashboard.assets=dashboard/assets --vmodule=dashboard=5 | ||
$ geth --dashboard --vmodule=dashboard=5 | ||
$ (cd dashboard/assets && ./node_modules/.bin/webpack-dev-server) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yarn dev
// gethHost is the host of geth. | ||
const gethHost = 'localhost'; | ||
// gethPort is the port of geth. | ||
const gethPort = 8080; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only do this for dev mode.
@@ -178,7 +183,7 @@ class Dashboard extends Component<Props, State> { | |||
// reconnect establishes a websocket connection with the server, listens for incoming messages | |||
// and tries to reconnect on connection loss. | |||
reconnect = () => { | |||
const server = new WebSocket(`${((window.location.protocol === 'https:') ? 'wss://' : 'ws://') + window.location.host}/api`); | |||
const server = new WebSocket(`${((window.location.protocol === 'https:') ? 'wss://' : 'ws://')}${gethHost}:${gethPort}/api`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only do this for dev mode.
log: [], | ||
|
||
version: null, | ||
commit: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to keep the network message independent of UI layout.
const TRAFFIC = 'traffic'; | ||
|
||
const TOP = 'Top'; | ||
const BOTTOM = 'Bottom'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls align :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…m#16263) * cmd, dashboard: remove custom assets, webpack dev server * dashboard: yarn commands, small fixes
…m#16263) * cmd, dashboard: remove custom assets, webpack dev server * dashboard: yarn commands, small fixes
…m#16263) * cmd, dashboard: remove custom assets, webpack dev server * dashboard: yarn commands, small fixes
…m#16263) * cmd, dashboard: remove custom assets, webpack dev server * dashboard: yarn commands, small fixes
yarn
instead ofnpm
(comparison)webpack-dev-server
instead ofgeth
serving custom resourcesAssets
config fromgeth
KB
toKiB
inCustomTooltip
(explanation)yarn
scripts