mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-04-08 17:23:44 +03:00
improvement(workflow): rewrite all workflow
This commit is contained in:
parent
ec99dcd65f
commit
3412edcdf5
19
.gitignore
vendored
19
.gitignore
vendored
@ -1,2 +1,19 @@
|
|||||||
node_modules
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
/.idea
|
||||||
|
/.awcache
|
||||||
|
/.vscode
|
||||||
|
|
||||||
|
# misc
|
||||||
|
npm-debug.log
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# tests
|
||||||
|
/test
|
||||||
|
/coverage
|
||||||
|
/.nyc_output
|
||||||
|
|
||||||
|
# source
|
||||||
dist
|
dist
|
7
.npmignore
Normal file
7
.npmignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# source
|
||||||
|
lib
|
||||||
|
index.ts
|
||||||
|
package-lock.json
|
||||||
|
tslint.json
|
||||||
|
tsconfig.json
|
||||||
|
.prettierrc
|
4
.prettierrc
Normal file
4
.prettierrc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"trailingComma": "none",
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
1
index.d.ts
vendored
Normal file
1
index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './dist';
|
6
index.js
Normal file
6
index.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
"use strict";
|
||||||
|
function __export(m) {
|
||||||
|
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||||
|
}
|
||||||
|
exports.__esModule = true;
|
||||||
|
__export(require("./dist"));
|
@ -1,7 +1,13 @@
|
|||||||
import { Module, DynamicModule, Provider } from '@nestjs/common'
|
import { Module, DynamicModule, Provider } from '@nestjs/common';
|
||||||
import { TelegrafModuleAsyncOptions, TelegrafOptionsFactory } from './interfaces'
|
import {
|
||||||
import { TELEGRAF_MODULE_OPTIONS, TokenInjectionToken } from './telegraf.constants'
|
TelegrafModuleAsyncOptions,
|
||||||
import { TelegrafService, TelegrafTelegramService } from './'
|
TelegrafOptionsFactory
|
||||||
|
} from './interfaces';
|
||||||
|
import {
|
||||||
|
TELEGRAF_MODULE_OPTIONS,
|
||||||
|
TokenInjectionToken
|
||||||
|
} from './telegraf.constants';
|
||||||
|
import { TelegrafService, TelegrafTelegramService } from './';
|
||||||
|
|
||||||
@Module({})
|
@Module({})
|
||||||
export class TelegrafModule {
|
export class TelegrafModule {
|
||||||
@ -15,43 +21,43 @@ export class TelegrafModule {
|
|||||||
TelegrafTelegramService,
|
TelegrafTelegramService,
|
||||||
{
|
{
|
||||||
provide: TokenInjectionToken,
|
provide: TokenInjectionToken,
|
||||||
useClass: options.useClass,
|
useClass: options.useClass
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
exports: [TelegrafService, TelegrafTelegramService],
|
exports: [TelegrafService, TelegrafTelegramService]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static createAsyncProviders(
|
private static createAsyncProviders(
|
||||||
options: TelegrafModuleAsyncOptions,
|
options: TelegrafModuleAsyncOptions
|
||||||
): Provider[] {
|
): Provider[] {
|
||||||
if (options.useExisting || options.useFactory) {
|
if (options.useExisting || options.useFactory) {
|
||||||
return [this.createAsyncOptionsProvider(options)]
|
return [this.createAsyncOptionsProvider(options)];
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
this.createAsyncOptionsProvider(options),
|
this.createAsyncOptionsProvider(options),
|
||||||
{
|
{
|
||||||
provide: options.useClass,
|
provide: options.useClass,
|
||||||
useClass: options.useClass,
|
useClass: options.useClass
|
||||||
},
|
}
|
||||||
]
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static createAsyncOptionsProvider(
|
private static createAsyncOptionsProvider(
|
||||||
options: TelegrafModuleAsyncOptions,
|
options: TelegrafModuleAsyncOptions
|
||||||
): Provider {
|
): Provider {
|
||||||
if (options.useFactory) {
|
if (options.useFactory) {
|
||||||
return {
|
return {
|
||||||
provide: TELEGRAF_MODULE_OPTIONS,
|
provide: TELEGRAF_MODULE_OPTIONS,
|
||||||
useFactory: options.useFactory,
|
useFactory: options.useFactory,
|
||||||
inject: options.inject || [],
|
inject: options.inject || []
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
provide: TELEGRAF_MODULE_OPTIONS,
|
provide: TELEGRAF_MODULE_OPTIONS,
|
||||||
useFactory: async (optionsFactory: TelegrafOptionsFactory) =>
|
useFactory: async (optionsFactory: TelegrafOptionsFactory) =>
|
||||||
await optionsFactory.createTelegrafOptions(),
|
await optionsFactory.createTelegrafOptions(),
|
||||||
inject: [options.useExisting || options.useClass],
|
inject: [options.useExisting || options.useClass]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1811
package-lock.json
generated
Normal file
1811
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
54
package.json
54
package.json
@ -1,38 +1,44 @@
|
|||||||
{
|
{
|
||||||
"name": "nestjs-telegraf",
|
"name": "nestjs-telegraf",
|
||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"main": "dist/index.js",
|
|
||||||
"types": "dist/index.d.ts",
|
|
||||||
"repository": "git@github.com:igorkamyshev/nest-telegram.git",
|
"repository": "git@github.com:igorkamyshev/nest-telegram.git",
|
||||||
"author": "Igor Kamyshev <igor@kamyshev.me>",
|
"author": "Igor Kamyshev <igor@kamyshev.me>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"lodash": "^4.17.13"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@nestjs/common": "^6.7.0",
|
||||||
|
"@nestjs/core": "^6.7.0",
|
||||||
|
"reflect-metadata": "^0.1.13",
|
||||||
|
"telegraf": "^3.35.0"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@solid-soda/scripts": "^1.2.4",
|
"@nestjs/common": "^6.7.0",
|
||||||
"@team-griffin/install-self-peers": "^1.1.1",
|
"@nestjs/core": "^6.7.0",
|
||||||
"@types/lodash": "^4.14.121"
|
"@types/lodash": "^4.14.121",
|
||||||
|
"husky": "^4.0.7",
|
||||||
|
"lint-staged": "^9.5.0",
|
||||||
|
"prettier": "^1.19.1",
|
||||||
|
"reflect-metadata": "^0.1.13",
|
||||||
|
"telegraf": "^3.35.0",
|
||||||
|
"typescript": "^3.7.4"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "rm -rf dist && tsc -p tsconfig.json",
|
||||||
|
"precommit": "lint-staged",
|
||||||
|
"prepublish:npm": "npm run build",
|
||||||
|
"publish:npm": "npm publish --access public"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"pre-commit": "yarn soda lint-staged",
|
"pre-commit": "lint-staged"
|
||||||
"commit-msg": "yarn soda commitlint"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"lint-staged": {
|
||||||
"access": "public"
|
"*.ts": [
|
||||||
},
|
"prettier --write",
|
||||||
"scripts": {
|
"git add"
|
||||||
"build": "rimraf dist && tsc",
|
]
|
||||||
"prepare": "install-self-peers -- --ignore-scripts && yarn build",
|
|
||||||
"ci": "yarn soda lint",
|
|
||||||
"s": "yarn soda"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@nestjs/common": "^5.7.3",
|
|
||||||
"@nestjs/core": "^5.7.3",
|
|
||||||
"reflect-metadata": "^0.1.13"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"lodash": "^4.17.13",
|
|
||||||
"telegraf": "^3.27.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": ["es2017"],
|
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
"noLib": false,
|
"noLib": false,
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"sourceMap": true,
|
"sourceMap": false,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"baseUrl": "./lib"
|
"rootDir": "./lib",
|
||||||
|
"skipLibCheck": true
|
||||||
},
|
},
|
||||||
"include": ["lib/**/*"],
|
"include": ["lib/**/*", "../index.ts"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules", "**/*.spec.ts"]
|
||||||
}
|
}
|
||||||
|
29
tslint.json
Normal file
29
tslint.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"defaultSeverity": "error",
|
||||||
|
"extends": ["tslint:recommended"],
|
||||||
|
"jsRules": {},
|
||||||
|
"rules": {
|
||||||
|
"quotemark": [true, "single", "avoid-escape"],
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"ordered-imports": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
"import-sources-order": "any",
|
||||||
|
"named-imports-order": "any"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-console": [false],
|
||||||
|
"interface-name": [true, "never-prefix"],
|
||||||
|
"eofline": false,
|
||||||
|
"linebreak-style": [false],
|
||||||
|
"indent": false,
|
||||||
|
"member-access": false,
|
||||||
|
"ban-types": false,
|
||||||
|
"max-classes-per-file": [false],
|
||||||
|
"member-ordering": [false],
|
||||||
|
"no-var-requires": false,
|
||||||
|
"one-line": [false],
|
||||||
|
"array-type": [false]
|
||||||
|
},
|
||||||
|
"rulesDirectory": []
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user