Skip to content

Commit c958d43

Browse files
authored
chore: improve highlight and gendata (#685)
* remove duckdb deps * update * update * update * update * update * update * update * update * add highlight * improve gendata * improve gendata * migrate to nextjs * migrate to nextjs * migrate to nextjs * migrate to nextjs * migrate to nextjs * migrate to nextjs * update ui * update ui
1 parent 654a943 commit c958d43

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+4560
-11593
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ CLAUDE.md
1616
pnpm-lock.yaml
1717
package-lock.json
1818
yarn.lock
19+
frontend/build
20+
frontend/.next/
21+
22+
# Frontend build artifacts now use fixed filenames, included in git
23+
# cli/frontend/build/ will be committed to ensure cargo install has full UI
1924

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@ build-frontend:
2020
mkdir -p cli/frontend
2121
cd frontend && \
2222
if [ ! -d node_modules ]; then pnpm install; fi && \
23-
pnpm build && cp -rf build ../cli/frontend/
23+
pnpm run build && cp -rf build ../cli/frontend/
2424

2525
run:
2626
make build-frontend
2727
cargo run
2828

29+
dev-run:
30+
@echo "Starting development mode..."
31+
@echo "1. Make sure to run 'cd frontend && pnpm run dev' in another terminal"
32+
@echo "2. Frontend will be available at http://localhost:3000"
33+
@echo "3. BendSQL CLI will proxy to frontend dev server"
34+
BENDSQL_DEV_MODE=1 cargo run
35+
2936
build:
3037
make build-frontend
3138
cargo build --release

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ prompt = ":) "
151151
- Settings section
152152

153153
| Parameter | Description |
154-
| -------------------- |---------------------------------------------------------------------------------------------------------------------|
154+
| -------------------- | ------------------------------------------------------------------------------------------------------------------- |
155155
| `display_pretty_sql` | Whether to display SQL queries in a formatted way. |
156156
| `prompt` | The prompt to display before asking for input. |
157157
| `progress_color` | The color to use for the progress bar. |
@@ -251,6 +251,12 @@ see: [Databend Query Settings](https://databend.rs/doc/sql-commands/show/show-se
251251
make check
252252
```
253253

254+
### Development mode
255+
256+
- For fast development: Run `cd frontend && pnpm run dev` in one terminal, then `make dev-run` in another
257+
- For production builds: Use `make build-frontend` to create embedded assets
258+
- Development mode uses `BENDSQL_DEV_MODE=1` environment variable to proxy requests to Next.js dev server
259+
254260
### Unit tests
255261

256262
```bash

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ mime_guess = "2.0"
3333
nom = "8.0.0"
3434
once_cell = "1.21"
3535
percent-encoding = "2.3"
36+
reqwest = "0.12"
3637
rust-embed = "8.7.0"
3738
rustyline = "15.0"
3839
serde = { version = "1.0", features = ["derive"] }
@@ -54,7 +55,6 @@ tracing-appender = "0.2"
5455
unicode-segmentation = "1.12"
5556
unicode-width = "0.2.2"
5657
url = { version = "2.5", default-features = false }
57-
webbrowser = "1.0.4"
5858

5959
[build-dependencies]
6060
vergen-gix = { version = "1.0.9", features = ["build"] }

cli/frontend/build/404.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>404: This page could not be found</title><meta name="next-head-count" content="3"/><meta charSet="utf-8"/><link rel="icon" href="/logo.svg"/><meta name="theme-color" content="#000000"/><link rel="preload" href="/_next/static/css/c90327669f0e5321.css" as="style"/><link rel="stylesheet" href="/_next/static/css/c90327669f0e5321.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/js/webpack.js" defer=""></script><script src="/_next/static/js/framework.js" defer=""></script><script src="/_next/static/js/vendor.js" defer=""></script><script src="/_next/static/js/main.js" defer=""></script><script src="/_next/static/js/pages/_app.js" defer=""></script><script src="/_next/static/js/pages/_error.js" defer=""></script><script src="/_next/static/stable-build-id/_buildManifest.js" defer=""></script><script src="/_next/static/stable-build-id/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div class="flex h-screen bg-gray-200"><div class="bg-white border-r border-gray-200 transition-all duration-300 w-32"><div class="p-4 border-b"><div class="flex items-center justify-between"><h1 class="text-lg font-bold text-gray-800">BendSQL</h1><button class="p-1 rounded hover:bg-gray-100 transition-colors" title="Collapse sidebar"></button></div></div><nav class="p-2"><a class="flex items-center p-3 rounded-lg mb-1 transition-colors text-gray-600 hover:bg-gray-50" href="/"><span class="text-lg">📊</span><span class="ml-3 font-medium">Query</span></a><a class="flex items-center p-3 rounded-lg mb-1 transition-colors text-gray-600 hover:bg-gray-50" href="/perf/0"><span class="text-lg"></span><span class="ml-3 font-medium">Perf</span></a></nav></div><div class="flex-1 flex flex-col overflow-hidden"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"stable-build-id","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>

cli/frontend/build/[...slug].html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>Databend</title><meta name="next-head-count" content="3"/><meta charSet="utf-8"/><link rel="icon" href="/logo.svg"/><meta name="theme-color" content="#000000"/><link rel="preload" href="/_next/static/css/c90327669f0e5321.css" as="style"/><link rel="stylesheet" href="/_next/static/css/c90327669f0e5321.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/js/webpack.js" defer=""></script><script src="/_next/static/js/framework.js" defer=""></script><script src="/_next/static/js/vendor.js" defer=""></script><script src="/_next/static/js/main.js" defer=""></script><script src="/_next/static/js/pages/_app.js" defer=""></script><script src="/_next/static/js/0ba37d83.js" defer=""></script><script src="/_next/static/js/pages/%5B...slug%5D.js" defer=""></script><script src="/_next/static/stable-build-id/_buildManifest.js" defer=""></script><script src="/_next/static/stable-build-id/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div class="flex h-screen bg-gray-200"><div class="bg-white border-r border-gray-200 transition-all duration-300 w-32"><div class="p-4 border-b"><div class="flex items-center justify-between"><h1 class="text-lg font-bold text-gray-800">BendSQL</h1><button class="p-1 rounded hover:bg-gray-100 transition-colors" title="Collapse sidebar"></button></div></div><nav class="p-2"><a class="flex items-center p-3 rounded-lg mb-1 transition-colors text-gray-600 hover:bg-gray-50" href="/"><span class="text-lg">📊</span><span class="ml-3 font-medium">Query</span></a><a class="flex items-center p-3 rounded-lg mb-1 transition-colors text-gray-600 hover:bg-gray-50" href="/perf/0"><span class="text-lg"></span><span class="ml-3 font-medium">Perf</span></a></nav></div><div class="flex-1 flex flex-col overflow-hidden"><div class="h-full bg-gray-100"><div class="bg-yellow-400 px-4 py-2 flex items-center justify-between"><div class="flex items-center gap-4"><span class="font-bold">SQL Query</span><button class="bg-indigo-600 hover:bg-indigo-700 disabled:opacity-60 disabled:cursor-not-allowed text-white px-4 py-1.5 rounded-md flex items-center gap-2 text-sm">▶ RUN QUERY</button></div></div><div class="h-[calc(100vh-48px)] border border-gray-300"><div class="h-full" style="display:flex;flex-direction:row;height:100%;overflow:hidden;width:100%" data-panel-group="" data-panel-group-direction="horizontal" data-panel-group-id=":Rl6:"><div class="h-full" id=":R3l6:" style="flex-basis:0;flex-grow:50.000;flex-shrink:1;overflow:hidden" data-panel-group-id=":Rl6:" data-panel="" data-panel-id=":R3l6:" data-panel-size="50.0"><div class="h-full border-r border-gray-300 relative"><div class="cm-theme" style="height:100%;font-size:14px"></div></div></div><div class="w-1 bg-gray-300 hover:bg-gray-400 cursor-col-resize" role="separator" style="touch-action:none;user-select:none" tabindex="0" data-panel-group-direction="horizontal" data-panel-group-id=":Rl6:" data-resize-handle="" data-panel-resize-handle-enabled="true" data-panel-resize-handle-id=":R5l6:" data-resize-handle-state="inactive"></div><div class="h-full" id=":R7l6:" style="flex-basis:0;flex-grow:50.000;flex-shrink:1;overflow:hidden" data-panel-group-id=":Rl6:" data-panel="" data-panel-id=":R7l6:" data-panel-size="50.0"><div class="h-full overflow-auto bg-white relative"><div class="p-2 h-full"><div class="flex items-center justify-center h-full text-gray-500">Execute a query to see results</div></div></div></div></div></div></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/[...slug]","query":{},"buildId":"stable-build-id","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>

cli/frontend/build/_next/static/chunks/polyfills-42372ed130431b0a.js

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

0 commit comments

Comments
 (0)