From d6104f9a4081bca9d158bbcc248903a3a770a58b Mon Sep 17 00:00:00 2001 From: Aleksandr Bukhalo Date: Sat, 28 Mar 2020 10:54:05 +0300 Subject: [PATCH 1/4] ci: try to configure build & test workflow --- .github/workflows/build-test.yml | 27 +++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-test.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..b49ea91 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,27 @@ +name: Build & Test + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x, 13.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run build --if-present + - run: npm test + env: + CI: true diff --git a/package.json b/package.json index f3e6164..1b93128 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "build": "rm -rf dist && tsc -p tsconfig.json", "precommit": "lint-staged", "prepublish:npm": "npm run build", - "publish:npm": "npm publish --access public" + "publish:npm": "npm publish --access public", + "test": "" }, "dependencies": { "telegraf": "3.36.0" From 177e53b73bf4df0f2acabcd26a15cac4a8d521dd Mon Sep 17 00:00:00 2001 From: Aleksandr Bukhalo Date: Sat, 28 Mar 2020 11:00:33 +0300 Subject: [PATCH 2/4] fix: ts-ignore error in telegraf.provider.ts --- lib/telegraf.provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/telegraf.provider.ts b/lib/telegraf.provider.ts index b13626f..ed1f90a 100644 --- a/lib/telegraf.provider.ts +++ b/lib/telegraf.provider.ts @@ -21,7 +21,7 @@ export class TelegrafProvider } onApplicationBootstrap() { - this.catch(e => { + this.catch((e) => { this.logger.error(e); }); this.startPolling(); From e1727c28c1e04b6bb6ecc885985335c9101625c9 Mon Sep 17 00:00:00 2001 From: Aleksandr Bukhalo Date: Sat, 28 Mar 2020 11:10:10 +0300 Subject: [PATCH 3/4] fix: dirty hack for fix wrong telegraf package typings --- lib/telegraf.provider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/telegraf.provider.ts b/lib/telegraf.provider.ts index ed1f90a..80e4851 100644 --- a/lib/telegraf.provider.ts +++ b/lib/telegraf.provider.ts @@ -5,12 +5,12 @@ import { Logger, OnApplicationShutdown, } from '@nestjs/common'; -import Telegraf, { ContextMessageUpdate } from 'telegraf'; +const Telegraf = require('telegraf'); +import { ContextMessageUpdate } from 'telegraf'; import { TELEGRAF_MODULE_OPTIONS } from './telegraf.constants'; import { TelegrafModuleOptions } from './interfaces'; @Injectable() -// @ts-ignore export class TelegrafProvider extends Telegraf implements OnApplicationBootstrap, OnApplicationShutdown { From a30b7cdf68702265ebf716f1de6fc8c2d070c1c2 Mon Sep 17 00:00:00 2001 From: Aleksandr Bukhalo Date: Sat, 28 Mar 2020 11:47:34 +0300 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20add=20telegraf.provider.ts=20into=20?= =?UTF-8?q?.prettierignore=20=F0=9F=A4=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierignore | 1 + lib/telegraf.explorer.ts | 3 +-- lib/telegraf.provider.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5b74740 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +lib/telegraf.provider.ts diff --git a/lib/telegraf.explorer.ts b/lib/telegraf.explorer.ts index 503d68b..036679f 100644 --- a/lib/telegraf.explorer.ts +++ b/lib/telegraf.explorer.ts @@ -2,11 +2,10 @@ import { Injectable, OnModuleInit } from '@nestjs/common'; import { DiscoveryService, ModuleRef } from '@nestjs/core'; import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper'; import { MetadataScanner } from '@nestjs/core/metadata-scanner'; -import Telegraf from 'telegraf'; import { TelegrafMetadataAccessor } from './telegraf-metadata.accessor'; import { TelegrafProvider } from './telegraf.provider'; import { TELEGRAF_PROVIDER } from './telegraf.constants'; -import { ContextMessageUpdate } from 'telegraf'; +import { Telegraf, ContextMessageUpdate } from 'telegraf'; import { TelegrafActionMetadata, TelegrafCashtagMetadata, diff --git a/lib/telegraf.provider.ts b/lib/telegraf.provider.ts index 80e4851..14d02f1 100644 --- a/lib/telegraf.provider.ts +++ b/lib/telegraf.provider.ts @@ -5,13 +5,13 @@ import { Logger, OnApplicationShutdown, } from '@nestjs/common'; -const Telegraf = require('telegraf'); -import { ContextMessageUpdate } from 'telegraf'; +import { Telegraf, ContextMessageUpdate } from 'telegraf'; import { TELEGRAF_MODULE_OPTIONS } from './telegraf.constants'; import { TelegrafModuleOptions } from './interfaces'; @Injectable() export class TelegrafProvider + // @ts-ignore extends Telegraf implements OnApplicationBootstrap, OnApplicationShutdown { private logger = new Logger('Telegraf');