feature: compatibility with various IDEs

This commit is contained in:
Kamil Myśliwiec 2018-12-07 12:51:42 +01:00
parent 1bbfc970c8
commit 1b81bde89e
No known key found for this signature in database
GPG Key ID: 75F02E89A1A1092B
8 changed files with 30 additions and 64 deletions

View File

@ -4,7 +4,7 @@
"description": "Nest TypeScript starter repository", "description": "Nest TypeScript starter repository",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"build": "tsc", "build": "tsc -p tsconfig.build.json",
"format": "prettier --write \"src/**/*.ts\"", "format": "prettier --write \"src/**/*.ts\"",
"start": "ts-node -r tsconfig-paths/register src/main.ts", "start": "ts-node -r tsconfig-paths/register src/main.ts",
"start:dev": "nodemon", "start:dev": "nodemon",
@ -23,7 +23,6 @@
"@nestjs/microservices": "^5.4.0", "@nestjs/microservices": "^5.4.0",
"@nestjs/testing": "^5.4.0", "@nestjs/testing": "^5.4.0",
"@nestjs/websockets": "^5.4.0", "@nestjs/websockets": "^5.4.0",
"@types/node": "^10.7.1",
"reflect-metadata": "^0.1.12", "reflect-metadata": "^0.1.12",
"rimraf": "^2.6.2", "rimraf": "^2.6.2",
"rxjs": "^6.2.2" "rxjs": "^6.2.2"
@ -31,6 +30,7 @@
"devDependencies": { "devDependencies": {
"@types/express": "^4.16.0", "@types/express": "^4.16.0",
"@types/jest": "^23.3.1", "@types/jest": "^23.3.1",
"@types/node": "^10.7.1",
"@types/supertest": "^2.0.5", "@types/supertest": "^2.0.5",
"jest": "^23.5.0", "jest": "^23.5.0",
"nodemon": "^1.18.3", "nodemon": "^1.18.3",

View File

@ -1,5 +1,4 @@
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import { AppController } from './app.controller'; import { AppController } from './app.controller';
import { AppService } from './app.service'; import { AppService } from './app.service';
@ -13,10 +12,10 @@ describe('AppController', () => {
}).compile(); }).compile();
}); });
describe('root', () => { describe('getHello', () => {
it('should return "Hello World!"', () => { it('should return "Hello World!"', () => {
const appController = app.get<AppController>(AppController); const appController = app.get<AppController>(AppController);
expect(appController.root()).toBe('Hello World!'); expect(appController.getHello()).toBe('Hello World!');
}); });
}); });
}); });

View File

@ -6,7 +6,7 @@ export class AppController {
constructor(private readonly appService: AppService) {} constructor(private readonly appService: AppService) {}
@Get() @Get()
root(): string { getHello(): string {
return this.appService.root(); return this.appService.getHello();
} }
} }

View File

@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
@Injectable() @Injectable()
export class AppService { export class AppService {
root(): string { getHello(): string {
return 'Hello World!'; return 'Hello World!';
} }
} }

5
tsconfig.build.json Normal file
View File

@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}

View File

@ -13,6 +13,5 @@
"outDir": "./dist", "outDir": "./dist",
"baseUrl": "./" "baseUrl": "./"
}, },
"include": ["src/**/*"], "exclude": ["node_modules"]
"exclude": ["node_modules", "**/*.spec.ts"]
} }

View File

@ -1,5 +1,5 @@
{ {
"extends": "tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"types": ["jest", "node"] "types": ["jest", "node"]
}, },

View File

@ -1,55 +1,18 @@
{ {
"defaultSeverity": "error", "defaultSeverity": "error",
"extends": [ "extends": ["tslint:recommended"],
"tslint:recommended"
],
"jsRules": { "jsRules": {
"no-unused-expression": true "no-unused-expression": true
}, },
"rules": { "rules": {
"eofline": false, "quotemark": [true, "single"],
"quotemark": [ "member-access": [false],
true, "ordered-imports": [false],
"single" "max-line-length": [true, 150],
], "member-ordering": [false],
"indent": false, "interface-name": [false],
"member-access": [
false
],
"ordered-imports": [
false
],
"max-line-length": [
true,
150
],
"member-ordering": [
false
],
"curly": false,
"interface-name": [
false
],
"array-type": [
false
],
"no-empty-interface": false,
"no-empty": false,
"arrow-parens": false, "arrow-parens": false,
"object-literal-sort-keys": false, "object-literal-sort-keys": false
"no-unused-expression": false,
"max-classes-per-file": [
false
],
"variable-name": [
false
],
"one-line": [
false
],
"one-variable-per-declaration": [
false
]
}, },
"rulesDirectory": [] "rulesDirectory": []
} }