VTAdmin
Getting started
- Install node v.14.15.3. (Using a Node version manager like nvm is highly recommended.)
- From the
vitess/web/vtadmin/
directory, install dependencies withnpm install
. - Run
npm start
to start vtadmin-web on http://localhost:3000
Have fun! π
Developer guide
This section contains notes for those that want to build and run vtadmin-web locally.
Available scripts
Scripts for common and not-so-common tasks. These are always run from the vitess/web/vtadmin
directory (although some of them have counterparts in vitess/Makefile
):
Command | Description |
---|---|
npm start | Start vtadmin-web on http://localhost:3000 with the development server. Changes you make will be automatically picked up in the browser, no need to refresh. |
npm run test | Launches the test runner in the interactive watch mode. See the create-react-app documentation about running tests for more information. |
npm run lint | Run all of the linters and formatters. The package.json file defines a bunch more scripts to run individual linters, if you prefer, like npm run lint:eslint . |
npm run lint:fix | Run all of the linters and fix errors (where possible) in place. Note that this will overwrite your files so you may want to consider committing your work beforehand! |
npm run build | Generates a build of vtadmin-web for production and outputs the files to the vitess/web/vtadmin/build folder. In most cases, you won't need to run this locally, but it can be useful for debugging production-specific issues. See the create-react-app documentation about deployment for more information. |
Toolchain
- React
- create-react-app (generated with v.4.0.1)
- TypeScript
- protobufjs
Configuring your editor
VS Code
To set up automatic formatting on save:
- Install the Prettier VS Code plugin.
- Add the following to your VS Code workspace:
{ // ... other workspace config ... "settings": { // ... other settings .. "prettier.useEditorConfig": false, // You may have to adjust this depending on which folder is the root of your workspace. // By default, this configuration assumes that you have your workspace settings // at `vitess/.vscode/settings.json`. "prettier.configPath": "web/vtadmin/.prettiercc", "[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, }, "[css]": { "editor.codeActionsOnSave": { "source.fixAll.stylelint": true } }, "[scss]": { "editor.codeActionsOnSave": { "source.fixAll.stylelint": true } } } }
For more, check out "Setting Up Your Editor" in the create-react-app docs.
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.
This file was thieved directly from https://github.com/vitessio/vitess/pull/7187/files#diff-eeea62c2adbce1061fd9db0eb38fcb936efb2e158ed0d332bfa5568db563a1c3