mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Switch to Bun instead of Deno (or Yarn) for faster web app builds
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
yarn run lint-staged
|
||||
yarn test
|
||||
bun run lint-staged
|
||||
bun run test
|
||||
|
||||
@@ -5,19 +5,19 @@ This is a [Next.js](https://nextjs.org/) project.
|
||||
First, install the dependencies:
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
bun install
|
||||
```
|
||||
|
||||
In case you run into any dependency linking issues, you can try running:
|
||||
|
||||
```bash
|
||||
yarn add next
|
||||
bun add next
|
||||
```
|
||||
|
||||
### Run the development server:
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
bun dev
|
||||
```
|
||||
|
||||
Make sure the `rewrites` in `next.config.mjs` are set up correctly for your environment. The rewrites are used to proxy requests to the API server.
|
||||
@@ -44,27 +44,30 @@ You can start editing the page by modifying any of the `.tsx` pages. The page au
|
||||
We've setup a utility command for building and serving the built files. This is useful for testing the production build locally.
|
||||
|
||||
1. Exporting code
|
||||
To build the files once and serve them, run:
|
||||
To build the files once and serve them, run:
|
||||
|
||||
```bash
|
||||
yarn export
|
||||
bun export
|
||||
```
|
||||
|
||||
If you're using Windows:
|
||||
```bash
|
||||
yarn windowsexport
|
||||
```
|
||||
|
||||
```bash
|
||||
bun windowsexport
|
||||
```
|
||||
|
||||
2. Continuously building code
|
||||
|
||||
To keep building the files and serving them, run:
|
||||
|
||||
```bash
|
||||
yarn watch
|
||||
bun watch
|
||||
```
|
||||
|
||||
If you're using Windows:
|
||||
|
||||
```bash
|
||||
yarn windowswatch
|
||||
bun windowswatch
|
||||
```
|
||||
|
||||
Now you should be able to load your custom pages from the Khoj app at http://localhost:42110/. To server any of the built files, you should update the routes in the `web_client.py` like so, where `new_file` is the new page you've added in this repo:
|
||||
|
||||
1568
src/interface/web/bun.lock
Normal file
1568
src/interface/web/bun.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"tasks": {
|
||||
"hook": "deno run --allow-read --allow-run --allow-write https://deno.land/x/deno_hooks@0.1.1/mod.ts"
|
||||
},
|
||||
"fmt": {
|
||||
"indentWidth": 4,
|
||||
"lineWidth": 100,
|
||||
"proseWrap": "preserve"
|
||||
}
|
||||
}
|
||||
5251
src/interface/web/deno.lock
generated
5251
src/interface/web/deno.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -6,16 +6,16 @@
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "deno fmt",
|
||||
"lint": "next lint",
|
||||
"collectstatic": "bash -c 'pushd ../../../ && source .venv/bin/activate && python3 src/khoj/manage.py collectstatic --noinput && deactivate && popd'",
|
||||
"cicollectstatic": "bash -c 'pushd ../../../ && python3 src/khoj/manage.py collectstatic --noinput && popd'",
|
||||
"export": "yarn build && cp -r out/ ../../khoj/interface/built && yarn collectstatic",
|
||||
"ciexport": "yarn build && cp -r out/ ../../khoj/interface/built && yarn cicollectstatic",
|
||||
"pypiciexport": "yarn build && cp -r out/ /opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/site-packages/khoj/interface/compiled && yarn cicollectstatic",
|
||||
"watch": "nodemon --watch . --ext js,jsx,ts,tsx,css --ignore 'out/**/*' --exec 'yarn export'",
|
||||
"windowswatch": "nodemon --watch . --ext js,jsx,ts,tsx,css --ignore 'out/**/*' --exec 'yarn windowsexport'",
|
||||
"cicollectstatic": "bash -c 'pushd ../../../ && uv run python src/khoj/manage.py collectstatic --noinput && popd'",
|
||||
"export": "bun run build && cp -r out/ ../../khoj/interface/built && bun run collectstatic",
|
||||
"ciexport": "bun run build && cp -r out/ ../../khoj/interface/built && bun run cicollectstatic",
|
||||
"pypiciexport": "bun run build && mkdir -p ../../khoj/interface/compiled && cp -r out/. ../../khoj/interface/compiled && bun run cicollectstatic",
|
||||
"watch": "nodemon --watch . --ext js,jsx,ts,tsx,css --ignore 'out/**/*' --exec 'bun run export'",
|
||||
"windowswatch": "nodemon --watch . --ext js,jsx,ts,tsx,css --ignore 'out/**/*' --exec 'bun run windowsexport'",
|
||||
"windowscollectstatic": "cd ..\\..\\.. && .\\.venv\\Scripts\\Activate.bat && py .\\src\\khoj\\manage.py collectstatic --noinput && .\\.venv\\Scripts\\deactivate.bat && cd ..",
|
||||
"windowsexport": "yarn build && xcopy out ..\\..\\khoj\\interface\\built /E /Y && yarn windowscollectstatic",
|
||||
"windowsexport": "bun run build && xcopy out ..\\..\\khoj\\interface\\built /E /Y && bun run windowscollectstatic",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -100,6 +100,6 @@
|
||||
"printWidth": 100
|
||||
},
|
||||
"lint-staged": {
|
||||
"*": "yarn lint --fix"
|
||||
"*": "bun run lint"
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user