improvement(workflow): rewrite all workflow

This commit is contained in:
Aleksandr Bukhalo 2020-01-12 14:18:48 +03:00
parent ec99dcd65f
commit 3412edcdf5
12 changed files with 1936 additions and 4056 deletions

19
.gitignore vendored
View File

@ -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

7
.npmignore Normal file
View File

@ -0,0 +1,7 @@
# source
lib
index.ts
package-lock.json
tslint.json
tsconfig.json
.prettierrc

4
.prettierrc Normal file
View File

@ -0,0 +1,4 @@
{
"trailingComma": "none",
"singleQuote": true
}

1
index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './dist';

6
index.js Normal file
View 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
index.ts Normal file
View File

@ -0,0 +1 @@
export * from './dist';

View File

@ -1,7 +1,13 @@
import { Module, DynamicModule, Provider } from '@nestjs/common'
import { TelegrafModuleAsyncOptions, TelegrafOptionsFactory } from './interfaces'
import { TELEGRAF_MODULE_OPTIONS, TokenInjectionToken } from './telegraf.constants'
import { TelegrafService, TelegrafTelegramService } from './'
import { Module, DynamicModule, Provider } from '@nestjs/common';
import {
TelegrafModuleAsyncOptions,
TelegrafOptionsFactory
} from './interfaces';
import {
TELEGRAF_MODULE_OPTIONS,
TokenInjectionToken
} from './telegraf.constants';
import { TelegrafService, TelegrafTelegramService } from './';
@Module({})
export class TelegrafModule {
@ -15,43 +21,43 @@ export class TelegrafModule {
TelegrafTelegramService,
{
provide: TokenInjectionToken,
useClass: options.useClass,
},
useClass: options.useClass
}
],
exports: [TelegrafService, TelegrafTelegramService],
}
exports: [TelegrafService, TelegrafTelegramService]
};
}
private static createAsyncProviders(
options: TelegrafModuleAsyncOptions,
options: TelegrafModuleAsyncOptions
): Provider[] {
if (options.useExisting || options.useFactory) {
return [this.createAsyncOptionsProvider(options)]
return [this.createAsyncOptionsProvider(options)];
}
return [
this.createAsyncOptionsProvider(options),
{
provide: options.useClass,
useClass: options.useClass,
},
]
useClass: options.useClass
}
];
}
private static createAsyncOptionsProvider(
options: TelegrafModuleAsyncOptions,
options: TelegrafModuleAsyncOptions
): Provider {
if (options.useFactory) {
return {
provide: TELEGRAF_MODULE_OPTIONS,
useFactory: options.useFactory,
inject: options.inject || [],
}
inject: options.inject || []
};
}
return {
provide: TELEGRAF_MODULE_OPTIONS,
useFactory: async (optionsFactory: TelegrafOptionsFactory) =>
await optionsFactory.createTelegrafOptions(),
inject: [options.useExisting || options.useClass],
}
inject: [options.useExisting || options.useClass]
};
}
}

1811
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,38 +1,44 @@
{
"name": "nestjs-telegraf",
"version": "0.5.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "git@github.com:igorkamyshev/nest-telegram.git",
"author": "Igor Kamyshev <igor@kamyshev.me>",
"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": {
"@solid-soda/scripts": "^1.2.4",
"@team-griffin/install-self-peers": "^1.1.1",
"@types/lodash": "^4.14.121"
"@nestjs/common": "^6.7.0",
"@nestjs/core": "^6.7.0",
"@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": {
"hooks": {
"pre-commit": "yarn soda lint-staged",
"commit-msg": "yarn soda commitlint"
"pre-commit": "lint-staged"
}
},
"publishConfig": {
"access": "public"
},
"scripts": {
"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"
"lint-staged": {
"*.ts": [
"prettier --write",
"git add"
]
}
}

View File

@ -1,19 +1,18 @@
{
"compilerOptions": {
"lib": ["es2017"],
"module": "commonjs",
"declaration": true,
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es6",
"sourceMap": true,
"sourceMap": false,
"outDir": "./dist",
"baseUrl": "./lib"
"rootDir": "./lib",
"skipLibCheck": true
},
"include": ["lib/**/*"],
"exclude": ["node_modules"]
"include": ["lib/**/*", "../index.ts"],
"exclude": ["node_modules", "**/*.spec.ts"]
}

29
tslint.json Normal file
View 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": []
}

4007
yarn.lock

File diff suppressed because it is too large Load Diff