@nestjs/schematics 7.1.2 → 7.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/application/files/js/package.json +1 -1
- package/dist/lib/application/files/ts/.eslintrc.js +1 -2
- package/dist/lib/application/files/ts/package.json +27 -24
- package/dist/lib/defaults.d.ts +1 -0
- package/dist/lib/defaults.js +2 -1
- package/dist/lib/resource/files/ts/__name__.controller.ts +4 -4
- package/dist/lib/resource/files/ts/dto/create-__name@singular__.dto.ts +1 -1
- package/dist/lib/resource/files/ts/dto/create-__name@singular__.input.ts +1 -1
- package/dist/lib/resource/files/ts/dto/update-__name@singular__.dto.ts +1 -1
- package/dist/lib/resource/files/ts/dto/update-__name@singular__.input.ts +3 -3
- package/dist/lib/sub-app/files/ts/src/__name__.controller.spec.ts +22 -0
- package/dist/lib/sub-app/files/ts/src/__name__.controller.ts +12 -0
- package/dist/lib/sub-app/files/ts/src/__name__.module.ts +10 -0
- package/dist/lib/sub-app/files/ts/src/{app.service.ts → __name__.service.ts} +1 -1
- package/dist/lib/sub-app/files/ts/src/main.ts +2 -2
- package/dist/lib/sub-app/files/ts/test/app.e2e-spec.ts +5 -4
- package/dist/lib/sub-app/sub-app.factory.js +1 -1
- package/package.json +18 -18
- package/dist/lib/sub-app/files/ts/src/app.controller.spec.ts +0 -22
- package/dist/lib/sub-app/files/ts/src/app.controller.ts +0 -12
- package/dist/lib/sub-app/files/ts/src/app.module.ts +0 -10
|
@@ -6,10 +6,9 @@ module.exports = {
|
|
|
6
6
|
},
|
|
7
7
|
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
8
8
|
extends: [
|
|
9
|
-
'plugin:@typescript-eslint/eslint-recommended',
|
|
10
9
|
'plugin:@typescript-eslint/recommended',
|
|
11
|
-
'prettier',
|
|
12
10
|
'prettier/@typescript-eslint',
|
|
11
|
+
'plugin:prettier/recommended',
|
|
13
12
|
],
|
|
14
13
|
root: true,
|
|
15
14
|
env: {
|
|
@@ -21,34 +21,34 @@
|
|
|
21
21
|
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@nestjs/common": "^7.
|
|
25
|
-
"@nestjs/core": "^7.
|
|
26
|
-
"@nestjs/platform-express": "^7.
|
|
24
|
+
"@nestjs/common": "^7.5.1",
|
|
25
|
+
"@nestjs/core": "^7.5.1",
|
|
26
|
+
"@nestjs/platform-express": "^7.5.1",
|
|
27
27
|
"reflect-metadata": "^0.1.13",
|
|
28
28
|
"rimraf": "^3.0.2",
|
|
29
|
-
"rxjs": "^6.
|
|
29
|
+
"rxjs": "^6.6.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@nestjs/cli": "^7.
|
|
33
|
-
"@nestjs/schematics": "^7.
|
|
34
|
-
"@nestjs/testing": "^7.
|
|
35
|
-
"@types/express": "^4.17.
|
|
36
|
-
"@types/jest": "26.0.
|
|
37
|
-
"@types/node": "^
|
|
38
|
-
"@types/supertest": "^2.0.
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "
|
|
40
|
-
"@typescript-eslint/parser": "
|
|
41
|
-
"eslint": "7.
|
|
42
|
-
"eslint-config-prettier": "^6.
|
|
43
|
-
"eslint-plugin-
|
|
44
|
-
"jest": "26.
|
|
45
|
-
"prettier": "^1.
|
|
46
|
-
"supertest": "^
|
|
47
|
-
"ts-jest": "26.
|
|
48
|
-
"ts-loader": "^
|
|
49
|
-
"ts-node": "9.0.0",
|
|
32
|
+
"@nestjs/cli": "^7.5.1",
|
|
33
|
+
"@nestjs/schematics": "^7.1.3",
|
|
34
|
+
"@nestjs/testing": "^7.5.1",
|
|
35
|
+
"@types/express": "^4.17.8",
|
|
36
|
+
"@types/jest": "^26.0.15",
|
|
37
|
+
"@types/node": "^14.14.6",
|
|
38
|
+
"@types/supertest": "^2.0.10",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^4.6.1",
|
|
40
|
+
"@typescript-eslint/parser": "^4.6.1",
|
|
41
|
+
"eslint": "^7.12.1",
|
|
42
|
+
"eslint-config-prettier": "^6.15.0",
|
|
43
|
+
"eslint-plugin-prettier": "^3.1.4",
|
|
44
|
+
"jest": "^26.6.3",
|
|
45
|
+
"prettier": "^2.1.2",
|
|
46
|
+
"supertest": "^6.0.0",
|
|
47
|
+
"ts-jest": "^26.4.3",
|
|
48
|
+
"ts-loader": "^8.0.8",
|
|
49
|
+
"ts-node": "^9.0.0",
|
|
50
50
|
"tsconfig-paths": "^3.9.0",
|
|
51
|
-
"typescript": "^
|
|
51
|
+
"typescript": "^4.0.5"
|
|
52
52
|
},
|
|
53
53
|
"jest": {
|
|
54
54
|
"moduleFileExtensions": [
|
|
@@ -57,10 +57,13 @@
|
|
|
57
57
|
"ts"
|
|
58
58
|
],
|
|
59
59
|
"rootDir": "src",
|
|
60
|
-
"testRegex": "
|
|
60
|
+
"testRegex": ".*\\.spec\\.ts$",
|
|
61
61
|
"transform": {
|
|
62
62
|
"^.+\\.(t|j)s$": "ts-jest"
|
|
63
63
|
},
|
|
64
|
+
"collectCoverageFrom": [
|
|
65
|
+
"**/*.(t|j)s"
|
|
66
|
+
],
|
|
64
67
|
"coverageDirectory": "../coverage",
|
|
65
68
|
"testEnvironment": "node"
|
|
66
69
|
}
|
package/dist/lib/defaults.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const DEFAULT_VERSION = "0.0.1";
|
|
|
5
5
|
export declare const DEFAULT_PATH_NAME = "src";
|
|
6
6
|
export declare const DEFAULT_LIB_PATH = "libs";
|
|
7
7
|
export declare const DEFAULT_APPS_PATH = "apps";
|
|
8
|
+
export declare const DEFAULT_APP_NAME = "app";
|
|
8
9
|
export declare const DEFAULT_DIR_ENTRY_APP = "main";
|
|
9
10
|
export declare const TEST_ENV = "test";
|
|
10
11
|
export declare const PROJECT_TYPE: {
|
package/dist/lib/defaults.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PROJECT_TYPE = exports.TEST_ENV = exports.DEFAULT_DIR_ENTRY_APP = exports.DEFAULT_APPS_PATH = exports.DEFAULT_LIB_PATH = exports.DEFAULT_PATH_NAME = exports.DEFAULT_VERSION = exports.DEFAULT_LANGUAGE = exports.DEFAULT_DESCRIPTION = exports.DEFAULT_AUTHOR = void 0;
|
|
3
|
+
exports.PROJECT_TYPE = exports.TEST_ENV = exports.DEFAULT_DIR_ENTRY_APP = exports.DEFAULT_APP_NAME = exports.DEFAULT_APPS_PATH = exports.DEFAULT_LIB_PATH = exports.DEFAULT_PATH_NAME = exports.DEFAULT_VERSION = exports.DEFAULT_LANGUAGE = exports.DEFAULT_DESCRIPTION = exports.DEFAULT_AUTHOR = void 0;
|
|
4
4
|
exports.DEFAULT_AUTHOR = '';
|
|
5
5
|
exports.DEFAULT_DESCRIPTION = '';
|
|
6
6
|
exports.DEFAULT_LANGUAGE = 'ts';
|
|
@@ -8,6 +8,7 @@ exports.DEFAULT_VERSION = '0.0.1';
|
|
|
8
8
|
exports.DEFAULT_PATH_NAME = 'src';
|
|
9
9
|
exports.DEFAULT_LIB_PATH = 'libs';
|
|
10
10
|
exports.DEFAULT_APPS_PATH = 'apps';
|
|
11
|
+
exports.DEFAULT_APP_NAME = 'app';
|
|
11
12
|
exports.DEFAULT_DIR_ENTRY_APP = 'main';
|
|
12
13
|
exports.TEST_ENV = 'test';
|
|
13
14
|
exports.PROJECT_TYPE = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<% if (crud && type === 'rest') { %>import { Controller, Get, Post, Body, Put, Param, Delete } from '@nestjs/common';<%
|
|
1
|
+
<% if (crud && type === 'rest') { %>import { Controller, Get, Post, Body, Put, Param, Delete } from '@nestjs/common';<%
|
|
2
2
|
} else if (crud && type === 'microservice') { %>import { Controller } from '@nestjs/common';
|
|
3
|
-
import { MessagePattern, Payload } from '@nestjs/microservices';<%
|
|
4
|
-
} else { %>import { Controller } from '@nestjs/common';<%
|
|
3
|
+
import { MessagePattern, Payload } from '@nestjs/microservices';<%
|
|
4
|
+
} else { %>import { Controller } from '@nestjs/common';<%
|
|
5
5
|
} %>
|
|
6
6
|
import { <%= classify(name) %>Service } from './<%= name %>.service';<% if (crud) { %>
|
|
7
7
|
import { Create<%= singular(classify(name)) %>Dto } from './dto/create-<%= singular(name) %>.dto';
|
|
@@ -10,7 +10,7 @@ import { Update<%= singular(classify(name)) %>Dto } from './dto/update-<%= singu
|
|
|
10
10
|
<% if (type === 'rest') { %>@Controller('<%= dasherize(name) %>')<% } else { %>@Controller()<% } %>
|
|
11
11
|
export class <%= classify(name) %>Controller {
|
|
12
12
|
constructor(private readonly <%= lowercased(name) %>Service: <%= classify(name) %>Service) {}<% if (type === 'rest' && crud) { %>
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
@Post()
|
|
15
15
|
create(@Body() create<%= singular(classify(name)) %>Dto: Create<%= singular(classify(name)) %>Dto) {
|
|
16
16
|
return this.<%= lowercased(name) %>Service.create(create<%= singular(classify(name)) %>Dto);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export class Create<%= singular(classify(name)) %>Dto {}
|
|
1
|
+
export class Create<%= singular(classify(name)) %>Dto {}
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
export class Create<%= singular(classify(name)) %>Input {
|
|
5
5
|
@Field(() => Int, { description: 'Example field (placeholder)' })
|
|
6
6
|
exampleField: number;
|
|
7
|
-
}<% } else { %>export class Create<%= singular(classify(name)) %>Input {}<% } %>
|
|
7
|
+
}<% } else { %>export class Create<%= singular(classify(name)) %>Input {}<% } %>
|
|
@@ -3,4 +3,4 @@ import { Create<%= singular(classify(name)) %>Dto } from './create-<%= singular(
|
|
|
3
3
|
|
|
4
4
|
export class Update<%= singular(classify(name)) %>Dto extends PartialType(Create<%= singular(classify(name)) %>Dto) {<% if ((type === 'microservice' || type === 'ws') && crud) { %>
|
|
5
5
|
id: number;
|
|
6
|
-
<% }%>}
|
|
6
|
+
<% }%>}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { PartialType } from '@nestjs/mapped-types';
|
|
2
1
|
import { Create<%= singular(classify(name)) %>Input } from './create-<%= singular(name) %>.input';<% if (type === 'graphql-code-first') { %>
|
|
3
|
-
import { InputType, Field, Int } from '@nestjs/graphql';
|
|
2
|
+
import { InputType, Field, Int, PartialType } from '@nestjs/graphql';
|
|
4
3
|
|
|
5
4
|
@InputType()
|
|
6
5
|
export class Update<%= singular(classify(name)) %>Input extends PartialType(Create<%= singular(classify(name)) %>Input) {
|
|
7
6
|
@Field(() => Int)
|
|
8
7
|
id: number;
|
|
9
8
|
}<% } else { %>
|
|
9
|
+
import { PartialType } from '@nestjs/graphql';
|
|
10
10
|
|
|
11
11
|
export class Update<%= singular(classify(name)) %>Input extends PartialType(Create<%= singular(classify(name)) %>Input) {
|
|
12
12
|
id: number;
|
|
13
|
-
}<% } %>
|
|
13
|
+
}<% } %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
import { <%= classify(name) %>Controller } from './<%= name %>.controller';
|
|
3
|
+
import { <%= classify(name) %>Service } from './<%= name %>.service';
|
|
4
|
+
|
|
5
|
+
describe('<%= classify(name) %>Controller', () => {
|
|
6
|
+
let <%= camelize(name) %>Controller: <%= classify(name) %>Controller;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
const app: TestingModule = await Test.createTestingModule({
|
|
10
|
+
controllers: [<%= classify(name) %>Controller],
|
|
11
|
+
providers: [<%= classify(name) %>Service],
|
|
12
|
+
}).compile();
|
|
13
|
+
|
|
14
|
+
<%= camelize(name) %>Controller = app.get<<%= classify(name) %>Controller>(<%= classify(name) %>Controller);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('root', () => {
|
|
18
|
+
it('should return "Hello World!"', () => {
|
|
19
|
+
expect(<%= camelize(name) %>Controller.getHello()).toBe('Hello World!');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Controller, Get } from '@nestjs/common';
|
|
2
|
+
import { <%= classify(name) %>Service } from './<%= name %>.service';
|
|
3
|
+
|
|
4
|
+
@Controller()
|
|
5
|
+
export class <%= classify(name) %>Controller {
|
|
6
|
+
constructor(private readonly <%= camelize(name) %>Service: <%= classify(name) %>Service) {}
|
|
7
|
+
|
|
8
|
+
@Get()
|
|
9
|
+
getHello(): string {
|
|
10
|
+
return this.<%= camelize(name) %>Service.getHello();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Module } from '@nestjs/common';
|
|
2
|
+
import { <%= classify(name) %>Controller } from './<%= name %>.controller';
|
|
3
|
+
import { <%= classify(name) %>Service } from './<%= name %>.service';
|
|
4
|
+
|
|
5
|
+
@Module({
|
|
6
|
+
imports: [],
|
|
7
|
+
controllers: [<%= classify(name) %>Controller],
|
|
8
|
+
providers: [<%= classify(name) %>Service],
|
|
9
|
+
})
|
|
10
|
+
export class <%= classify(name) %>Module {}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { NestFactory } from '@nestjs/core';
|
|
2
|
-
import {
|
|
2
|
+
import { <%= classify(name) %>Module } from './<%= name %>.module';
|
|
3
3
|
|
|
4
4
|
async function bootstrap() {
|
|
5
|
-
const app = await NestFactory.create(
|
|
5
|
+
const app = await NestFactory.create(<%= classify(name) %>Module);
|
|
6
6
|
await app.listen(3000);
|
|
7
7
|
}
|
|
8
8
|
bootstrap();
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
+
import { INestApplication } from '@nestjs/common';
|
|
2
3
|
import * as request from 'supertest';
|
|
3
|
-
import {
|
|
4
|
+
import { <%= classify(name)%>Module } from './../src/<%= classify(name)%>.module';
|
|
4
5
|
|
|
5
|
-
describe('
|
|
6
|
-
let app;
|
|
6
|
+
describe('<%= classify(name)%>Controller (e2e)', () => {
|
|
7
|
+
let app: INestApplication;
|
|
7
8
|
|
|
8
9
|
beforeEach(async () => {
|
|
9
10
|
const moduleFixture: TestingModule = await Test.createTestingModule({
|
|
10
|
-
imports: [
|
|
11
|
+
imports: [<%= classify(name)%>Module],
|
|
11
12
|
}).compile();
|
|
12
13
|
|
|
13
14
|
app = moduleFixture.createNestApplication();
|
|
@@ -43,7 +43,7 @@ function transform(options) {
|
|
|
43
43
|
const target = Object.assign({}, options);
|
|
44
44
|
const defaultSourceRoot = options.rootDir !== undefined ? options.rootDir : defaults_1.DEFAULT_APPS_PATH;
|
|
45
45
|
if (!target.name) {
|
|
46
|
-
|
|
46
|
+
target.name = defaults_1.DEFAULT_APP_NAME;
|
|
47
47
|
}
|
|
48
48
|
target.language = !!target.language ? target.language : defaults_1.DEFAULT_LANGUAGE;
|
|
49
49
|
target.name = core_1.strings.dasherize(target.name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/schematics",
|
|
3
|
-
"version": "7.1
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@schematics)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -40,35 +40,35 @@
|
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/nestjs/schematics#readme",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@angular-devkit/core": "
|
|
44
|
-
"@angular-devkit/schematics": "
|
|
43
|
+
"@angular-devkit/core": "10.2.0",
|
|
44
|
+
"@angular-devkit/schematics": "10.2.0",
|
|
45
45
|
"fs-extra": "9.0.1",
|
|
46
46
|
"pluralize": "8.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@commitlint/cli": "^
|
|
50
|
-
"@commitlint/config-angular": "^
|
|
51
|
-
"@types/fs-extra": "9.0.
|
|
52
|
-
"@types/jest": "26.0.
|
|
53
|
-
"@types/node": "
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "
|
|
55
|
-
"@typescript-eslint/parser": "
|
|
49
|
+
"@commitlint/cli": "^11.0.0",
|
|
50
|
+
"@commitlint/config-angular": "^11.0.0",
|
|
51
|
+
"@types/fs-extra": "9.0.3",
|
|
52
|
+
"@types/jest": "26.0.15",
|
|
53
|
+
"@types/node": "14.14.6",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "4.6.1",
|
|
55
|
+
"@typescript-eslint/parser": "4.6.1",
|
|
56
56
|
"cpx": "1.5.0",
|
|
57
|
-
"eslint": "7.
|
|
58
|
-
"eslint-config-prettier": "6.
|
|
59
|
-
"eslint-plugin-import": "2.22.
|
|
57
|
+
"eslint": "7.12.1",
|
|
58
|
+
"eslint-config-prettier": "6.15.0",
|
|
59
|
+
"eslint-plugin-import": "2.22.1",
|
|
60
60
|
"gulp": "4.0.2",
|
|
61
61
|
"gulp-clean": "0.4.0",
|
|
62
|
-
"husky": "4.
|
|
63
|
-
"jest": "26.
|
|
62
|
+
"husky": "4.3.0",
|
|
63
|
+
"jest": "26.6.3",
|
|
64
64
|
"nyc": "15.1.0",
|
|
65
|
-
"release-it": "^
|
|
66
|
-
"ts-jest": "26.
|
|
65
|
+
"release-it": "^14.2.1",
|
|
66
|
+
"ts-jest": "26.4.3",
|
|
67
67
|
"ts-node": "9.0.0",
|
|
68
68
|
"typescript": "3.9.7"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"typescript": "^3.4.5"
|
|
71
|
+
"typescript": "^3.4.5 || ^4.0.0"
|
|
72
72
|
},
|
|
73
73
|
"schematics": "./dist/collection.json",
|
|
74
74
|
"husky": {
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Test, TestingModule } from '@nestjs/testing';
|
|
2
|
-
import { AppController } from './app.controller';
|
|
3
|
-
import { AppService } from './app.service';
|
|
4
|
-
|
|
5
|
-
describe('AppController', () => {
|
|
6
|
-
let appController: AppController;
|
|
7
|
-
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
const app: TestingModule = await Test.createTestingModule({
|
|
10
|
-
controllers: [AppController],
|
|
11
|
-
providers: [AppService],
|
|
12
|
-
}).compile();
|
|
13
|
-
|
|
14
|
-
appController = app.get<AppController>(AppController);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
describe('root', () => {
|
|
18
|
-
it('should return "Hello World!"', () => {
|
|
19
|
-
expect(appController.getHello()).toBe('Hello World!');
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Controller, Get } from '@nestjs/common';
|
|
2
|
-
import { AppService } from './app.service';
|
|
3
|
-
|
|
4
|
-
@Controller()
|
|
5
|
-
export class AppController {
|
|
6
|
-
constructor(private readonly appService: AppService) {}
|
|
7
|
-
|
|
8
|
-
@Get()
|
|
9
|
-
getHello(): string {
|
|
10
|
-
return this.appService.getHello();
|
|
11
|
-
}
|
|
12
|
-
}
|