Skip to content

Commit

Permalink
feat!: use new Bun v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
zAlweNy26 committed Jan 23, 2025
1 parent 2743f4e commit 60dcc2f
Show file tree
Hide file tree
Showing 8 changed files with 2,897 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM oven/bun AS build
WORKDIR /app

# Cache packages installation
COPY package.json bun.lockb ./
COPY package.json bun.lock ./
COPY ./patches ./patches

RUN bun install --ignore-scripts --production
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM oven/bun
WORKDIR /app

# Cache packages installation
COPY package.json bun.lockb ./
COPY package.json bun.lock ./
COPY ./patches ./patches

RUN bun install --ignore-scripts
Expand Down
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,22 @@ Check out the [linked project](https://github.com/zAlweNy26/ts-cat/projects?quer
- [x] Supports streaming both in WebSocket and HTTP
- [x] Tokens usage visible through model interactions
- [x] Cache support for LLM and Embedder responses
- [ ] External plugins registry support
- [ ] Built-in CLI
- [ ] External plugins registry support
- [ ] Add multi-modality support
- [ ] Add multi-agent support
- [ ] Add multi-chat support

## Pre-requisites

- Bun (>= 1.0.0) (for local development)
- Bun (>= 1.2) (for local development)
- Docker

## Installation

```bash
# (for development)
bun install
rm -f .git/hooks/pre-commit && ln -s ../../pre-commit .git/hooks/pre-commit

# (for production)
docker compose build --no-cache
Expand All @@ -66,19 +65,32 @@ docker compose build --no-cache
# (for development)
docker run -p 6333:6333 qdrant/qdrant
bun run dev
# OR
docker compose build -f compose.dev.yml --no-cache # (if you want to use Docker for development)
# OR (if you are using the dev docker compose)
docker compose -f compose.dev.yml build --no-cache
docker compose -f compose.dev.yml up -d

# (for production)
docker compose up
```

## How to run CLI

```bash
bun run cli <command>
# OR (if you are using the dev compose)
docker exec ccat_ts_dev bun run cli <command>
# OR (if you are using the prod compose)
docker exec ccat_ts bun run cli <command>
```

## How to test

```bash
bun run test
# OR
docker compose -f compose.dev.yml exec ccat-ts-dev bun run test
# OR (if you are using the dev compose)
docker exec ccat_ts_dev bun run test
# OR (if you are using the prod compose)
docker exec ccat_ts bun run test
```

## License
Expand Down
2,871 changes: 2,871 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

Binary file removed bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { parsedEnv } from './utils.ts'
const inDocker = isDocker()
const { watch, verbose } = parsedEnv

if (!Bun.semver.satisfies(Bun.version, '>=1.1.19')) {
log.error('The Cat requires Bun version 1.1.19 or higher.')
if (!Bun.semver.satisfies(Bun.version, '>=1.2')) {
log.error('This project requires Bun v1.2 or higher.')
process.exit(1)
}

Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const app = new Elysia()
allowedHeaders: '*',
credentials: true,
}))
.use(await staticPlugin({ // TODO: NOT_FOUND error reference at https://github.com/elysiajs/elysia/issues/739
.use(await staticPlugin({ // BUG: NOT_FOUND error reference at https://github.com/elysiajs/elysia/issues/739
prefix: '/assets',
assets: resolve(process.cwd(), 'src', 'assets'),
}))
Expand Down
13 changes: 2 additions & 11 deletions src/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,10 @@ To let the Cheshire Cat detect your plugin, you need to create at least one `.ts
To scaffold a new plugin, you can use the following command:

```bash
# inside the plugins directory
cp -r ../../.bun-create/plugin <your_plugin_id> # linux/macos
xcopy ..\..\.bun-create\plugin <your_plugin_id> /E /I /H /K # windows (cmd)
Copy-Item -Recurse -Force ..\..\.bun-create\plugin <your_plugin_id> # windows (powershell)
# inside the root project directory
bun create ./plugin ./src/plugins/<your_plugin_id>
```

<!-- TODO: When Bun fixes `bun create` command, use this instead:
```bash
# inside the plugins directory
bun create /plugin <your_plugin_id>
```
-->

This will create for you all the necessary files to start creating your plugin!

## How to import the methods
Expand Down

0 comments on commit 60dcc2f

Please sign in to comment.