From 35ff184071be91dfbe9075bcb7d373e94c9c40bb Mon Sep 17 00:00:00 2001 From: deptyped Date: Fri, 17 May 2024 01:28:05 +0300 Subject: [PATCH] Add Bun example --- README.md | 74 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index df838ebc..3da3aa39 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,13 @@ Bot starter template based on [grammY](https://grammy.dev/) bot framework. - [Docker](#docker-dockercom) - [Vercel](#vercel-vercelcom) - Examples: - - [Prisma ORM](#prisma-orm-prismaio) - grammY plugins: - [Conversations](#grammy-conversations-grammydevpluginsconversations) - [Runner](#grammy-runner-grammydevpluginsrunner) + - Databases: + - [Prisma ORM](#prisma-orm-prismaio) + - Runtimes: + - [Bun](#bun-bunsh) ## Usage @@ -155,11 +158,11 @@ git merge template/deploy/vercel -X theirs --squash --no-commit --allow-unrelate ## Examples -### Prisma ORM ([prisma.io](https://prisma.io)) +### grammY conversations ([grammy.dev/plugins/conversations](https://grammy.dev/plugins/conversations)) Branch: -[example/orm-prisma](https://github.com/bot-base/telegram-bot-template/tree/example/orm-prisma) -([open diff](https://github.com/bot-base/telegram-bot-template/compare/example/orm-prisma)) +[example/plugin-conversations](https://github.com/bot-base/telegram-bot-template/tree/example/plugin-conversations) +([open diff](https://github.com/bot-base/telegram-bot-template/compare/example/plugin-conversations)) Use in your project: @@ -173,21 +176,20 @@ git remote update 2. Merge example ```sh -git merge template/example/orm-prisma -X theirs --squash --no-commit --allow-unrelated-histories +git merge template/example/plugin-conversations -X theirs --squash --no-commit --allow-unrelated-histories ``` 3. Install dependencies ```sh -npm i -D prisma -npm i @prisma/client +npm i @grammyjs/conversations ``` -### grammY conversations ([grammy.dev/plugins/conversations](https://grammy.dev/plugins/conversations)) +### grammY runner ([grammy.dev/plugins/runner](https://grammy.dev/plugins/runner)) Branch: -[example/plugin-conversations](https://github.com/bot-base/telegram-bot-template/tree/example/plugin-conversations) -([open diff](https://github.com/bot-base/telegram-bot-template/compare/example/plugin-conversations)) +[example/plugin-runner](https://github.com/bot-base/telegram-bot-template/tree/example/plugin-runner) +([open diff](https://github.com/bot-base/telegram-bot-template/compare/example/plugin-runner)) Use in your project: @@ -201,20 +203,20 @@ git remote update 2. Merge example ```sh -git merge template/example/plugin-conversations -X theirs --squash --no-commit --allow-unrelated-histories +git merge template/example/plugin-runner -X theirs --squash --no-commit --allow-unrelated-histories ``` 3. Install dependencies ```sh -npm i @grammyjs/conversations +npm i @grammyjs/runner ``` -### grammY runner ([grammy.dev/plugins/runner](https://grammy.dev/plugins/runner)) +### Prisma ORM ([prisma.io](https://prisma.io)) Branch: -[example/plugin-runner](https://github.com/bot-base/telegram-bot-template/tree/example/plugin-runner) -([open diff](https://github.com/bot-base/telegram-bot-template/compare/example/plugin-runner)) +[example/orm-prisma](https://github.com/bot-base/telegram-bot-template/tree/example/orm-prisma) +([open diff](https://github.com/bot-base/telegram-bot-template/compare/example/orm-prisma)) Use in your project: @@ -228,13 +230,51 @@ git remote update 2. Merge example ```sh -git merge template/example/plugin-runner -X theirs --squash --no-commit --allow-unrelated-histories +git merge template/example/orm-prisma -X theirs --squash --no-commit --allow-unrelated-histories ``` 3. Install dependencies ```sh -npm i @grammyjs/runner +npm i -D prisma +npm i @prisma/client +``` + +### Bun ([bun.sh](https://bun.sh)) + +Branch: +[example/runtime-bun](https://github.com/bot-base/telegram-bot-template/tree/example/runtime-bun) +([open diff](https://github.com/bot-base/telegram-bot-template/compare/example/runtime-bun)) + +Use in your project: + +1. Add the template repository as a remote + +```sh +git remote add template git@github.com:bot-base/telegram-bot-template.git +git remote update +``` + +2. Merge example + +```sh +git merge template/example/runtime-bun -X theirs --squash --no-commit --allow-unrelated-histories +``` + +3. Install dependencies + +```sh +# remove Node-related dependencies +npm r @types/node tsx tsc-watch + +# install dependencies +bun i + +# remove npm lockfile +rm package-lock.json + +# install bun typings +bun add -d @types/bun ``` ## Environment Variables