Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate to deno #22

Merged
merged 6 commits into from
Sep 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .eslintrc

This file was deleted.

File renamed without changes.
19 changes: 9 additions & 10 deletions README.md → .github/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
# AnimeDB-tgbot
# AnimeDB-tgbot

A [Telegram Bot](https://telegram.dog/animedb_bot) to Search Anime & Manga Details using [AniList](https://anilist.co) API
A [Telegram Bot](https://telegram.dog/animedb_bot) to Search Anime & Manga
Details using [AniList](https://anilist.co) API

[![CI](https://github.com/ArnabXD/AnimeDB-tgbot/actions/workflows/CI.yml/badge.svg)](https://github.com/ArnabXD/AnimeDB-tgbot/actions/workflows/CI.yml)

### Run Locally

```shell
git clone https://github.com/ArnabXD/AnimeDB-tgbot.git
cd AnimeDB-tgbot
pnpm install
pnpm run build
vim .env
pnpm run start
deno task start
```

#### .env File

```
BOT_TOKEN=YOUR BOT TOKEN FROM @BOTFATHER

# OPTIONAL FOR WEBHOOK
PORT=yourWebhookPort
```

### License & Copyright :

- This Project is [GNU General Public License v3.0](https://github.com/ArnabXD/AnimeDB-tgbot/blob/main/LICENSE) Licensed
- This Project is
[GNU General Public License v3.0](https://github.com/ArnabXD/AnimeDB-tgbot/blob/main/LICENSE)
Licensed
- Copyright 2021 by [ArnabXD](https://telegram.dog/Arnab431)
4 changes: 0 additions & 4 deletions .github/renovate.json

This file was deleted.

72 changes: 17 additions & 55 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,78 +12,40 @@ jobs:
if: "!contains(github.event.head_commit.message, '#skip-lint')"
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.2
- uses: denoland/setup-deno@v1
with:
version: 7.0.0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
cache: pnpm

- name: Install dependencies
run: pnpm install --no-frozen-lockfile
deno-version: vx.x.x
- name: Linter Check
run: deno lint

- name: Run Linter
run: pnpm run lint

test:
fmt:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '#skip-test')"
if: "!contains(github.event.head_commit.message, '#skip-fmt')"
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.2
with:
version: 7.0.0
- name: Setup Node
uses: actions/setup-node@v3
- uses: denoland/setup-deno@v1
with:
node-version: "16"
cache: pnpm

- name: Install dependencies
run: pnpm install --no-frozen-lockfile

- name: Run Ava Tests
run: pnpm run test
deno-version: vx.x.x
- name: Formatter Check
run: deno fmt --check

build:
test:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '#skip-build')"
if: "!contains(github.event.head_commit.message, '#skip-test')"
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.2
- uses: denoland/setup-deno@v1
with:
version: 7.0.0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
cache: pnpm

- name: Install dependencies
run: pnpm install --no-frozen-lockfile

- name: Build
run: pnpm run build
deno-version: vx.x.x
- name: Run Tests
run: deno test --allow-all

release:
runs-on: ubuntu-latest
needs: [ lint, build, test ]
needs: [ lint, fmt, test ]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.2
with:
version: 7.0.0
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: pnpm

- name: Install dependencies
run: pnpm install --no-frozen-lockfile

- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
build/
node_modules/
.env
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"deno.enable": true,
"deno.lint": true,
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"prettier.enable": false,
"editor.formatOnSave": true
}
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

9 changes: 0 additions & 9 deletions ava.config.ts

This file was deleted.

7 changes: 7 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"importMap": "./import_map.json",
"tasks": {
"server": "deno run --allow-net --allow-read --allow-env server.ts",
"serverless": "deno run --allow-net --allow-read --allow-env serverless.ts"
}
}
8 changes: 8 additions & 0 deletions env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { config } from "dotenv";
import { cleanEnv, str } from "envalid";

await config({ export: true });

export default cleanEnv(Deno.env.toObject(), {
BOT_TOKEN: str(),
});
11 changes: 11 additions & 0 deletions import_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"imports": {
"grammy": "https://deno.land/x/grammy@v1.11.0/mod.ts",
"grammy/": "https://deno.land/x/grammy@v1.11.0/",
"gql": "https://raw.githubusercontent.com/ArnabXD/graphql-request/temp/mod.ts",
"dotenv": "https://deno.land/std@0.154.0/dotenv/mod.ts",
"envalid": "https://deno.land/x/envalid@0.1.2/mod.ts",
"server": "https://deno.land/std@0.154.0/http/server.ts",
"testing/": "https://deno.land/std@0.154.0/testing/"
}
}
47 changes: 0 additions & 47 deletions package.json

This file was deleted.

Loading