Skip to content

Commit 6313c42

Browse files
authored
refactor(dashboard): ignore dashboard/proto/gen and gen them during npm i (risingwavelabs#8695)
Signed-off-by: TennyZhuang <[email protected]>
1 parent 3a06226 commit 6313c42

27 files changed

+41
-26001
lines changed

.gitattributes

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
src/tests/regress/data/** linguist-vendored
33
# source test data
44
scripts/source/test_data/** linguist-vendored
5-
# generated proto for dashboard
6-
dashboard/proto/gen/** linguist-generated
75
# generated grafana dashboard
86
grafana/risingwave-dashboard.json linguist-generated

dashboard/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@
2323
npm-debug.log*
2424
yarn-debug.log*
2525
yarn-error.log*
26+
27+
# generated proto
28+
proto/gen

dashboard/README.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
# Dashboard
2+
13
The framework: [Next.js](https://nextjs.org).
24

35
Next.js supports SPA, SSG and SSR. With this feature, the dashboard ui can be deployed in
6+
47
1. Standalone machine serving only dashboard UI with a backend. (e.g. Dashboard for cloud product)
58
2. Meta service node. (e.g. Static HTML files integrated in meta service without any other dependencies like node.js)
69

710
## Files
8-
```
11+
12+
```plain
913
dashboard/
1014
--.next/ (generated by nextjs)
1115
--node_modules/ (development dependencies)
@@ -19,47 +23,67 @@ dashboard/
1923
```
2024

2125
## Testing
26+
2227
TODO: Find a suitable testing framework
2328

2429
## Development
30+
2531
Start the RisingWave database, remove drop tables from `tpch_snapshot.slt`
32+
2633
```bash
2734
./risedev d
2835
sqllogictest -p 4566 -d dev './e2e_test/streaming/tpch_snapshot.slt'
2936
```
37+
3038
Install Dependencies.
39+
3140
```bash
3241
npm i
3342
```
43+
3444
The website will be served at port 3000.
45+
3546
```bash
3647
npm run dev
3748
```
49+
3850
You should also run:
39-
```
51+
52+
```bash
4053
node mock-server.js
4154
```
55+
4256
To start a mock API server when developing. You can use `fetch.sh` to update the mock APIs.
4357

4458
## Test with RisingWave meta node
45-
To replace the built static files in RisingWave with your newest code,
59+
60+
To replace the built static files in RisingWave with your newest code,
4661
run the following scripts in the root directory.
47-
```
62+
63+
```bash
4864
./risedev export-dashboard-v2
4965
```
5066

51-
5267
## Deployment
53-
#### Static HTML files
68+
69+
### Generate the protos
70+
71+
Running `npm i` will generate the proto files under `proto/gen` automatically. In case there are modifications to the protos, you can regenerate them using the command npm run gen-proto.
72+
73+
### Static HTML files
74+
5475
Build static files for standalone deployment without node.js. The built files are generated at `./out`.
5576
Check more details at [Static HTML Export](https://nextjs.org/docs/advanced-features/static-html-export).
77+
5678
```bash
5779
npm run build-static
5880
```
5981

6082
#### Next.js app
83+
6184
The built files are generated at `./.next`.
85+
6286
```bash
6387
npm run build
6488
npm run start
65-
```
89+
```

dashboard/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dashboard/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"gen-proto": "./scripts/generate_proto.sh",
99
"lint": "prettier --check . && next lint",
1010
"format": "prettier --write . && next lint --fix",
11-
"mock-server": "node ./mock-server.js"
11+
"mock-server": "node ./mock-server.js",
12+
"postinstall": "npm run gen-proto"
1213
},
1314
"dependencies": {
1415
"@chakra-ui/react": "^2.3.1",

0 commit comments

Comments
 (0)