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/.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 b13626f..14d02f1 100644 --- a/lib/telegraf.provider.ts +++ b/lib/telegraf.provider.ts @@ -5,13 +5,13 @@ import { Logger, OnApplicationShutdown, } from '@nestjs/common'; -import Telegraf, { ContextMessageUpdate } from 'telegraf'; +import { Telegraf, ContextMessageUpdate } from 'telegraf'; import { TELEGRAF_MODULE_OPTIONS } from './telegraf.constants'; import { TelegrafModuleOptions } from './interfaces'; @Injectable() -// @ts-ignore export class TelegrafProvider + // @ts-ignore extends Telegraf implements OnApplicationBootstrap, OnApplicationShutdown { private logger = new Logger('Telegraf'); @@ -21,7 +21,7 @@ export class TelegrafProvider } onApplicationBootstrap() { - this.catch(e => { + this.catch((e) => { this.logger.error(e); }); this.startPolling(); diff --git a/package.json b/package.json index ca6c8d7..8e4c94f 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"