Skip to content

Commit

Permalink
feat: add filters for user/chat requests and callback data
Browse files Browse the repository at this point in the history
  • Loading branch information
deptyped committed Feb 14, 2023
1 parent 83ced58 commit 66cb6f3
Show file tree
Hide file tree
Showing 16 changed files with 1,070 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/README.md
29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Format
run: deno fmt --check

- name: Lint
run: deno lint

- name: Check
run: deno check src/mod.ts

- name: Backport
run: deno task build-npm
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"deno.enable": true,
"deno.lint": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": { "source.fixAll": true },
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"deno.config": "./deno.jsonc",
"deno.suggest.imports.hosts": {
"https://deno.land": true,
"https://x.nest.land": true,
"https://crux.land": true,
"https://lib.deno.dev": false
}
}
20 changes: 20 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"tasks": {
"dev": "deno fmt && deno lint && deno run --watch src/mod.ts",
"build-npm": "deno run --allow-run --allow-net --allow-read --allow-write --allow-env ./scripts/build_npm.ts"
},
"fmt": {
"files": {
"exclude": [
"./npm/"
]
}
},
"lint": {
"files": {
"exclude": [
"./npm/"
]
}
}
}
41 changes: 41 additions & 0 deletions scripts/build_npm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { build, emptyDir } from "https://deno.land/x/dnt/mod.ts";

import package_ from "./package.json" assert { type: "json" };

await emptyDir("./npm");

await build({
entryPoints: ["./src/mod.ts"],
outDir: "./npm",
shims: {
deno: true,
},
esModule: true,
scriptModule: "cjs",
test: false,
package: {
...package_,
version: Deno.args[0],
},
mappings: {
"https://lib.deno.dev/x/[email protected]/mod.ts": {
name: "grammy",
version: "^1.10.0",
peerDependency: true,
},
"https://lib.deno.dev/x/[email protected]/types.ts": {
name: "grammy",
version: "^1.10.0",
subPath: "out/types",
peerDependency: true,
},
"https://lib.deno.dev/x/[email protected]/mod.ts": {
name: "callback-data",
version: "^1.0.0",
},
},
});

// post build steps
Deno.copyFileSync("src/LICENSE", "npm/LICENSE");
Deno.copyFileSync("src/README.md", "npm/README.md");
21 changes: 21 additions & 0 deletions scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "grammy-guard",
"description": "Guard middlewares for grammY",
"homepage": "https://github.com/deptyped/grammy-guard#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/deptyped/grammy-guard.git"
},
"author": "deptyped <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/deptyped/grammy-guard/issues"
},
"keywords": [
"grammy",
"bot",
"telegram",
"telegram-bot",
"telegram-bot-api"
]
}
Loading

0 comments on commit 66cb6f3

Please sign in to comment.