Merge pull request #33 from nestjs/update/version-5
chore: update to nest v5
This commit is contained in:
commit
b428240559
|
|
@ -389,3 +389,4 @@ Temporary Items
|
||||||
# Local
|
# Local
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
.env
|
.env
|
||||||
|
dist
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||||
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||||
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
|
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
|
||||||
<img src="https://img.shields.io/badge/👌-Production Ready-78c7ff.svg"/>
|
|
||||||
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||||
</p>
|
</p>
|
||||||
<!--[](https://opencollective.com/nest#backer)
|
<!--[](https://opencollective.com/nest#backer)
|
||||||
|
|
@ -44,6 +43,10 @@ $ npm run start
|
||||||
# watch mode
|
# watch mode
|
||||||
$ npm run start:dev
|
$ npm run start:dev
|
||||||
|
|
||||||
|
# incremental rebuild (webpack)
|
||||||
|
$ npm run webpack
|
||||||
|
$ npm run start:hmr
|
||||||
|
|
||||||
# production mode
|
# production mode
|
||||||
npm run start:prod
|
npm run start:prod
|
||||||
```
|
```
|
||||||
|
|
@ -63,7 +66,7 @@ $ npm run test:cov
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://opencollective.com/nest).
|
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||||
|
|
||||||
## Stay in touch
|
## Stay in touch
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
38
package.json
38
package.json
|
|
@ -4,24 +4,28 @@
|
||||||
"description": "Nest TypeScript starter repository",
|
"description": "Nest TypeScript starter repository",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "prettier --write \"**/*.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",
|
||||||
"prestart:prod": "rimraf dist && tsc",
|
"prestart:prod": "rimraf dist && tsc",
|
||||||
"start:prod": "node dist/main.js",
|
"start:prod": "node dist/main.js",
|
||||||
|
"start:hmr": "node dist/server",
|
||||||
|
"lint": "tslint -p tsconfig.json -c tslint.json",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
|
"test:watch": "jest --watch",
|
||||||
"test:cov": "jest --coverage",
|
"test:cov": "jest --coverage",
|
||||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
"test:e2e": "jest --config ./test/jest-e2e.json",
|
||||||
|
"webpack": "webpack --config webpack.config.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nestjs/common": "^4.5.9",
|
"@nestjs/common": "^5.0.0",
|
||||||
"@nestjs/core": "^4.5.10",
|
"@nestjs/core": "^5.0.0",
|
||||||
"@nestjs/microservices": "^4.5.8",
|
"@nestjs/microservices": "^5.0.0",
|
||||||
"@nestjs/testing": "^4.5.5",
|
"@nestjs/testing": "^5.0.0",
|
||||||
"@nestjs/websockets": "^4.5.8",
|
"@nestjs/websockets": "^5.0.0",
|
||||||
"reflect-metadata": "^0.1.12",
|
"reflect-metadata": "^0.1.12",
|
||||||
"rxjs": "^5.5.6",
|
"rxjs": "^6.0.0",
|
||||||
"typescript": "^2.6.2"
|
"typescript": "^2.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.0.39",
|
"@types/express": "^4.0.39",
|
||||||
|
|
@ -34,12 +38,20 @@
|
||||||
"rimraf": "^2.6.2",
|
"rimraf": "^2.6.2",
|
||||||
"supertest": "^3.0.0",
|
"supertest": "^3.0.0",
|
||||||
"ts-jest": "^21.2.4",
|
"ts-jest": "^21.2.4",
|
||||||
"ts-node": "^4.1.0",
|
"ts-loader": "^4.1.0",
|
||||||
"tsconfig-paths": "^3.1.1",
|
"ts-node": "^6.0.0",
|
||||||
"tslint": "5.3.2"
|
"tsconfig-paths": "^3.3.1",
|
||||||
|
"tslint": "5.3.2",
|
||||||
|
"webpack": "^4.2.0",
|
||||||
|
"webpack-cli": "^2.0.13",
|
||||||
|
"webpack-node-externals": "^1.6.0"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"moduleFileExtensions": ["js", "json", "ts"],
|
"moduleFileExtensions": [
|
||||||
|
"js",
|
||||||
|
"json",
|
||||||
|
"ts"
|
||||||
|
],
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"testRegex": ".spec.ts$",
|
"testRegex": ".spec.ts$",
|
||||||
"transform": {
|
"transform": {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { Test, TestingModule } from '@nestjs/testing';
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
import { INestApplication } from '@nestjs/common';
|
import { INestApplication } from '@nestjs/common';
|
||||||
import { AppController } from './app.controller';
|
import { AppController } from './app.controller';
|
||||||
|
import { AppService } from './app.service';
|
||||||
|
|
||||||
describe('AppController', () => {
|
describe('AppController', () => {
|
||||||
let app: TestingModule;
|
let app: TestingModule;
|
||||||
|
|
@ -8,6 +9,7 @@ describe('AppController', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
app = await Test.createTestingModule({
|
app = await Test.createTestingModule({
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
|
providers: [AppService],
|
||||||
}).compile();
|
}).compile();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
import { Get, Controller } from '@nestjs/common';
|
import { Get, Controller } from '@nestjs/common';
|
||||||
|
import { AppService } from './app.service';
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
export class AppController {
|
export class AppController {
|
||||||
|
constructor(private readonly appService: AppService) {}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
root(): string {
|
root(): string {
|
||||||
return 'Hello World!';
|
return this.appService.root();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { AppController } from './app.controller';
|
import { AppController } from './app.controller';
|
||||||
|
import { AppService } from './app.service';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [],
|
imports: [],
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
components: [],
|
providers: [AppService],
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class AppService {
|
||||||
|
root(): string {
|
||||||
|
return 'Hello World!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { NestFactory } from '@nestjs/core';
|
||||||
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
|
declare const module: any;
|
||||||
|
|
||||||
|
async function bootstrap() {
|
||||||
|
const app = await NestFactory.create(AppModule);
|
||||||
|
await app.listen(3000);
|
||||||
|
|
||||||
|
if (module.hot) {
|
||||||
|
module.hot.accept();
|
||||||
|
module.hot.dispose(() => app.close());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bootstrap();
|
||||||
|
|
@ -15,7 +15,7 @@ describe('AppController (e2e)', () => {
|
||||||
await app.init();
|
await app.init();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('/GET /', () => {
|
it('/ (GET)', () => {
|
||||||
return request(app.getHttpServer())
|
return request(app.getHttpServer())
|
||||||
.get('/')
|
.get('/')
|
||||||
.expect(200)
|
.expect(200)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"declaration": false,
|
"declaration": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
"noLib": false,
|
"noLib": false,
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"allowJs": true,
|
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"baseUrl": "./src"
|
"baseUrl": "./src"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"extends": "tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"types": ["jest", "node"]
|
||||||
|
},
|
||||||
|
"include": ["**/*.spec.ts", "**/*.d.ts"]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const path = require('path');
|
||||||
|
const nodeExternals = require('webpack-node-externals');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: ['webpack/hot/poll?1000', './src/main.hmr.ts'],
|
||||||
|
watch: true,
|
||||||
|
target: 'node',
|
||||||
|
externals: [
|
||||||
|
nodeExternals({
|
||||||
|
whitelist: ['webpack/hot/poll?1000'],
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.tsx?$/,
|
||||||
|
use: 'ts-loader',
|
||||||
|
exclude: /node_modules/,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
mode: "development",
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.tsx', '.ts', '.js'],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
|
],
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, 'dist'),
|
||||||
|
filename: 'server.js',
|
||||||
|
},
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue