@nestjs/schematics 11.0.9 → 12.0.0-alpha.0

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.
Files changed (132) hide show
  1. package/dist/lib/application/files/js/package.json +10 -10
  2. package/dist/lib/application/files/ts/package.json +3 -3
  3. package/dist/lib/application/files/ts/tsconfig.json +0 -1
  4. package/dist/lib/application/files/ts-esm/.prettierrc +4 -0
  5. package/dist/lib/application/files/ts-esm/README.md +98 -0
  6. package/dist/lib/application/files/ts-esm/eslint.config.mjs +34 -0
  7. package/dist/lib/application/files/ts-esm/nest-cli.json +8 -0
  8. package/dist/lib/application/files/ts-esm/package.json +50 -0
  9. package/dist/lib/application/files/ts-esm/src/app.controller.__specFileSuffix__.ts +22 -0
  10. package/dist/lib/application/files/ts-esm/src/app.controller.ts +12 -0
  11. package/dist/lib/application/files/ts-esm/src/app.module.ts +10 -0
  12. package/dist/lib/application/files/ts-esm/src/app.service.ts +8 -0
  13. package/dist/lib/application/files/ts-esm/src/main.ts +8 -0
  14. package/dist/lib/application/files/ts-esm/test/app.e2e-__specFileSuffix__.ts +25 -0
  15. package/dist/lib/application/files/ts-esm/tsconfig.build.json +4 -0
  16. package/dist/lib/application/files/ts-esm/tsconfig.json +24 -0
  17. package/dist/lib/application/files/ts-esm/vitest.config.e2e.ts +10 -0
  18. package/dist/lib/application/files/ts-esm/vitest.config.ts +10 -0
  19. package/dist/lib/application/schema.json +14 -0
  20. package/dist/lib/library/files/ts/tsconfig.lib.json +1 -0
  21. package/dist/lib/sub-app/files/ts/tsconfig.app.json +1 -0
  22. package/dist/lib/sub-app/workspace/ts/tsconfig.app.json +1 -0
  23. package/dist/src/index.d.ts +2 -0
  24. package/dist/src/index.js +2 -0
  25. package/dist/{lib → src/lib}/application/application.factory.d.ts +1 -1
  26. package/dist/src/lib/application/application.factory.js +64 -0
  27. package/dist/{lib → src/lib}/class/class.factory.d.ts +1 -1
  28. package/dist/src/lib/class/class.factory.js +48 -0
  29. package/dist/{lib → src/lib}/client-app/angular/angular.factory.d.ts +1 -1
  30. package/dist/{lib → src/lib}/client-app/angular/angular.factory.js +23 -26
  31. package/dist/{lib → src/lib}/configuration/configuration.factory.d.ts +1 -1
  32. package/dist/src/lib/configuration/configuration.factory.js +24 -0
  33. package/dist/{lib → src/lib}/controller/controller.factory.d.ts +1 -1
  34. package/dist/src/lib/controller/controller.factory.js +69 -0
  35. package/dist/{lib → src/lib}/decorator/decorator.factory.d.ts +1 -1
  36. package/dist/src/lib/decorator/decorator.factory.js +32 -0
  37. package/dist/src/lib/defaults.js +14 -0
  38. package/dist/{lib → src/lib}/filter/filter.factory.d.ts +1 -1
  39. package/dist/src/lib/filter/filter.factory.js +40 -0
  40. package/dist/{lib → src/lib}/gateway/gateway.factory.d.ts +1 -1
  41. package/dist/src/lib/gateway/gateway.factory.js +69 -0
  42. package/dist/{lib → src/lib}/guard/guard.factory.d.ts +1 -1
  43. package/dist/src/lib/guard/guard.factory.js +40 -0
  44. package/dist/{lib → src/lib}/interceptor/interceptor.factory.d.ts +1 -1
  45. package/dist/src/lib/interceptor/interceptor.factory.js +41 -0
  46. package/dist/{lib → src/lib}/interface/interface.factory.d.ts +1 -1
  47. package/dist/src/lib/interface/interface.factory.js +31 -0
  48. package/dist/{lib → src/lib}/library/library.factory.d.ts +1 -1
  49. package/dist/{lib → src/lib}/library/library.factory.js +51 -64
  50. package/dist/{lib → src/lib}/middleware/middleware.factory.d.ts +1 -1
  51. package/dist/src/lib/middleware/middleware.factory.js +40 -0
  52. package/dist/{lib → src/lib}/module/module.factory.d.ts +1 -1
  53. package/dist/src/lib/module/module.factory.js +57 -0
  54. package/dist/{lib → src/lib}/pipe/pipe.factory.d.ts +1 -1
  55. package/dist/src/lib/pipe/pipe.factory.js +41 -0
  56. package/dist/{lib → src/lib}/provider/provider.factory.d.ts +1 -1
  57. package/dist/src/lib/provider/provider.factory.js +73 -0
  58. package/dist/{lib → src/lib}/readers/file-system.reader.d.ts +1 -1
  59. package/dist/{lib → src/lib}/readers/file-system.reader.js +3 -7
  60. package/dist/src/lib/readers/index.d.ts +2 -0
  61. package/dist/src/lib/readers/index.js +2 -0
  62. package/dist/src/lib/readers/reader.js +1 -0
  63. package/dist/{lib → src/lib}/resolver/resolver.factory.d.ts +1 -1
  64. package/dist/src/lib/resolver/resolver.factory.js +68 -0
  65. package/dist/{lib → src/lib}/resource/resource.factory.d.ts +1 -1
  66. package/dist/{lib → src/lib}/resource/resource.factory.js +35 -38
  67. package/dist/{lib → src/lib}/service/service.factory.d.ts +1 -1
  68. package/dist/src/lib/service/service.factory.js +71 -0
  69. package/dist/{lib → src/lib}/sub-app/sub-app.factory.d.ts +1 -1
  70. package/dist/{lib → src/lib}/sub-app/sub-app.factory.js +94 -69
  71. package/dist/{utils → src/utils}/dependencies.utils.js +7 -12
  72. package/dist/{utils → src/utils}/formatting.js +1 -4
  73. package/dist/src/utils/index.d.ts +11 -0
  74. package/dist/src/utils/index.js +11 -0
  75. package/dist/src/utils/jest-module-mapper.js +6 -0
  76. package/dist/{utils → src/utils}/json-file.util.js +9 -13
  77. package/dist/{utils → src/utils}/metadata.manager.d.ts +1 -1
  78. package/dist/{utils → src/utils}/metadata.manager.js +11 -15
  79. package/dist/{utils → src/utils}/module-import.declarator.d.ts +2 -2
  80. package/dist/{utils → src/utils}/module-import.declarator.js +6 -10
  81. package/dist/{utils → src/utils}/module-metadata.declarator.d.ts +1 -1
  82. package/dist/src/utils/module-metadata.declarator.js +8 -0
  83. package/dist/{utils → src/utils}/module.declarator.d.ts +2 -2
  84. package/dist/src/utils/module.declarator.js +30 -0
  85. package/dist/{utils → src/utils}/module.finder.js +3 -7
  86. package/dist/src/utils/name.parser.js +13 -0
  87. package/dist/{utils → src/utils}/object-sorting.js +1 -4
  88. package/dist/src/utils/path.solver.js +8 -0
  89. package/dist/src/utils/source-root.helpers.js +20 -0
  90. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  91. package/package.json +21 -49
  92. package/dist/index.d.ts +0 -2
  93. package/dist/index.js +0 -18
  94. package/dist/lib/application/application.factory.js +0 -63
  95. package/dist/lib/class/class.factory.js +0 -51
  96. package/dist/lib/configuration/configuration.factory.js +0 -27
  97. package/dist/lib/controller/controller.factory.js +0 -72
  98. package/dist/lib/decorator/decorator.factory.js +0 -35
  99. package/dist/lib/defaults.js +0 -17
  100. package/dist/lib/filter/filter.factory.js +0 -43
  101. package/dist/lib/gateway/gateway.factory.js +0 -72
  102. package/dist/lib/guard/guard.factory.js +0 -43
  103. package/dist/lib/interceptor/interceptor.factory.js +0 -44
  104. package/dist/lib/interface/interface.factory.js +0 -34
  105. package/dist/lib/middleware/middleware.factory.js +0 -43
  106. package/dist/lib/module/module.factory.js +0 -60
  107. package/dist/lib/pipe/pipe.factory.js +0 -44
  108. package/dist/lib/provider/provider.factory.js +0 -76
  109. package/dist/lib/readers/index.d.ts +0 -2
  110. package/dist/lib/readers/index.js +0 -18
  111. package/dist/lib/readers/reader.js +0 -2
  112. package/dist/lib/resolver/resolver.factory.js +0 -71
  113. package/dist/lib/service/service.factory.js +0 -74
  114. package/dist/utils/index.d.ts +0 -11
  115. package/dist/utils/index.js +0 -27
  116. package/dist/utils/jest-module-mapper.js +0 -9
  117. package/dist/utils/module-metadata.declarator.js +0 -12
  118. package/dist/utils/module.declarator.js +0 -34
  119. package/dist/utils/name.parser.js +0 -17
  120. package/dist/utils/path.solver.js +0 -12
  121. package/dist/utils/source-root.helpers.js +0 -24
  122. /package/dist/{lib → src/lib}/defaults.d.ts +0 -0
  123. /package/dist/{lib → src/lib}/readers/reader.d.ts +0 -0
  124. /package/dist/{utils → src/utils}/dependencies.utils.d.ts +0 -0
  125. /package/dist/{utils → src/utils}/formatting.d.ts +0 -0
  126. /package/dist/{utils → src/utils}/jest-module-mapper.d.ts +0 -0
  127. /package/dist/{utils → src/utils}/json-file.util.d.ts +0 -0
  128. /package/dist/{utils → src/utils}/module.finder.d.ts +0 -0
  129. /package/dist/{utils → src/utils}/name.parser.d.ts +0 -0
  130. /package/dist/{utils → src/utils}/object-sorting.d.ts +0 -0
  131. /package/dist/{utils → src/utils}/path.solver.d.ts +0 -0
  132. /package/dist/{utils → src/utils}/source-root.helpers.d.ts +0 -0
@@ -22,17 +22,17 @@
22
22
  },
23
23
  "devDependencies": {
24
24
  "@nestjs/testing": "^11.0.1",
25
- "@babel/core": "7.28.4",
26
- "@babel/node": "7.28.0",
27
- "@babel/plugin-proposal-decorators": "7.28.0",
28
- "@babel/plugin-transform-runtime": "7.28.3",
29
- "@babel/preset-env": "7.28.3",
30
- "@babel/register": "7.28.3",
31
- "@babel/runtime": "7.28.4",
25
+ "@babel/core": "7.29.0",
26
+ "@babel/node": "7.29.0",
27
+ "@babel/plugin-proposal-decorators": "7.29.0",
28
+ "@babel/plugin-transform-runtime": "7.29.0",
29
+ "@babel/preset-env": "7.29.0",
30
+ "@babel/register": "7.28.6",
31
+ "@babel/runtime": "7.28.6",
32
32
  "jest": "30.2.0",
33
- "nodemon": "3.1.10",
34
- "prettier": "3.6.2",
35
- "supertest": "7.1.4"
33
+ "nodemon": "3.1.14",
34
+ "prettier": "3.8.1",
35
+ "supertest": "7.2.2"
36
36
  },
37
37
  "jest": {
38
38
  "moduleFileExtensions": [
@@ -34,12 +34,12 @@
34
34
  "@nestjs/testing": "^11.0.1",
35
35
  "@types/express": "^5.0.0",
36
36
  "@types/jest": "^30.0.0",
37
- "@types/node": "^22.10.7",
38
- "@types/supertest": "^6.0.2",
37
+ "@types/node": "^24.0.0",
38
+ "@types/supertest": "^7.0.0",
39
39
  "eslint": "^9.18.0",
40
40
  "eslint-config-prettier": "^10.0.1",
41
41
  "eslint-plugin-prettier": "^5.2.2",
42
- "globals": "^16.0.0",
42
+ "globals": "^17.0.0",
43
43
  "jest": "^30.0.0",
44
44
  "prettier": "^3.4.2",
45
45
  "source-map-support": "^0.5.21",
@@ -13,7 +13,6 @@
13
13
  "target": "ES2023",
14
14
  "sourceMap": true,
15
15
  "outDir": "./dist",
16
- "baseUrl": "./",
17
16
  "incremental": true,
18
17
  "skipLibCheck": true,
19
18
  "strictNullChecks": true,
@@ -0,0 +1,4 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "all"
4
+ }
@@ -0,0 +1,98 @@
1
+ <p align="center">
2
+ <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
3
+ </p>
4
+
5
+ [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
6
+ [circleci-url]: https://circleci.com/gh/nestjs/nest
7
+
8
+ <p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
11
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
12
+ <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
13
+ <a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
14
+ <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
15
+ <a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
16
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
17
+ <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
18
+ <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
19
+ <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
20
+ </p>
21
+ <!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
22
+ [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
23
+
24
+ ## Description
25
+
26
+ [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
27
+
28
+ ## Project setup
29
+
30
+ ```bash
31
+ $ <%= packageManager %> install
32
+ ```
33
+
34
+ ## Compile and run the project
35
+
36
+ ```bash
37
+ # development
38
+ $ <%= packageManager %> run start
39
+
40
+ # watch mode
41
+ $ <%= packageManager %> run start:dev
42
+
43
+ # production mode
44
+ $ <%= packageManager %> run start:prod
45
+ ```
46
+
47
+ ## Run tests
48
+
49
+ ```bash
50
+ # unit tests
51
+ $ <%= packageManager %> run test
52
+
53
+ # e2e tests
54
+ $ <%= packageManager %> run test:e2e
55
+
56
+ # test coverage
57
+ $ <%= packageManager %> run test:cov
58
+ ```
59
+
60
+ ## Deployment
61
+
62
+ When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
63
+
64
+ If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
65
+
66
+ ```bash
67
+ $ <%= packageManager %> install -g @nestjs/mau
68
+ $ mau deploy
69
+ ```
70
+
71
+ With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
72
+
73
+ ## Resources
74
+
75
+ Check out a few resources that may come in handy when working with NestJS:
76
+
77
+ - Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
78
+ - For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
79
+ - To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
80
+ - Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
81
+ - Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
82
+ - Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
83
+ - To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
84
+ - Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
85
+
86
+ ## Support
87
+
88
+ 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).
89
+
90
+ ## Stay in touch
91
+
92
+ - Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
93
+ - Website - [https://nestjs.com](https://nestjs.com/)
94
+ - Twitter - [@nestframework](https://twitter.com/nestframework)
95
+
96
+ ## License
97
+
98
+ Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
@@ -0,0 +1,34 @@
1
+ // @ts-check
2
+ import eslint from '@eslint/js';
3
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4
+ import globals from 'globals';
5
+ import tseslint from 'typescript-eslint';
6
+
7
+ export default tseslint.config(
8
+ {
9
+ ignores: ['eslint.config.mjs'],
10
+ },
11
+ eslint.configs.recommended,
12
+ ...tseslint.configs.recommendedTypeChecked,
13
+ eslintPluginPrettierRecommended,
14
+ {
15
+ languageOptions: {
16
+ globals: {
17
+ ...globals.node,
18
+ },
19
+ sourceType: 'module',
20
+ parserOptions: {
21
+ projectService: true,
22
+ tsconfigRootDir: import.meta.dirname,
23
+ },
24
+ },
25
+ },
26
+ {
27
+ rules: {
28
+ '@typescript-eslint/no-explicit-any': 'off',
29
+ '@typescript-eslint/no-floating-promises': 'warn',
30
+ '@typescript-eslint/no-unsafe-argument': 'warn',
31
+ "prettier/prettier": ["error", { endOfLine: "auto" }],
32
+ },
33
+ },
34
+ );
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/nest-cli",
3
+ "collection": "@nestjs/schematics",
4
+ "sourceRoot": "src",
5
+ "compilerOptions": {
6
+ "deleteOutDir": true
7
+ }
8
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "<%= name %>",
3
+ "version": "<%= version %>",
4
+ "description": "<%= description %>",
5
+ "author": "<%= author %>",
6
+ "private": true,
7
+ "license": "UNLICENSED",
8
+ "type": "module",
9
+ "scripts": {
10
+ "build": "nest build",
11
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
12
+ "start": "nest start",
13
+ "start:dev": "nest start --watch",
14
+ "start:debug": "nest start --debug --watch",
15
+ "start:prod": "node dist/main",
16
+ "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
17
+ "test": "vitest run",
18
+ "test:watch": "vitest",
19
+ "test:cov": "vitest run --coverage",
20
+ "test:debug": "vitest --inspect-brk --no-file-parallelism",
21
+ "test:e2e": "vitest run --config ./vitest.config.e2e.ts"
22
+ },
23
+ "dependencies": {
24
+ "@nestjs/common": "^11.0.1",
25
+ "@nestjs/core": "^11.0.1",
26
+ "@nestjs/platform-express": "^11.0.1",
27
+ "reflect-metadata": "^0.2.2",
28
+ "rxjs": "^7.8.1"
29
+ },
30
+ "devDependencies": {
31
+ "@eslint/eslintrc": "^3.2.0",
32
+ "@eslint/js": "^9.18.0",
33
+ "@nestjs/cli": "^11.0.0",
34
+ "@nestjs/schematics": "^11.0.0",
35
+ "@nestjs/testing": "^11.0.1",
36
+ "@types/express": "^5.0.0",
37
+ "@types/node": "^24.0.0",
38
+ "@types/supertest": "^7.0.0",
39
+ "eslint": "^9.18.0",
40
+ "eslint-config-prettier": "^10.0.1",
41
+ "eslint-plugin-prettier": "^5.2.2",
42
+ "globals": "^17.0.0",
43
+ "prettier": "^3.4.2",
44
+ "source-map-support": "^0.5.21",
45
+ "supertest": "^7.0.0",
46
+ "typescript": "^5.7.3",
47
+ "typescript-eslint": "^8.20.0",
48
+ "vitest": "^4.0.0-beta.1"
49
+ }
50
+ }
@@ -0,0 +1,22 @@
1
+ import { Test, TestingModule } from '@nestjs/testing';
2
+ import { AppController } from './app.controller.js';
3
+ import { AppService } from './app.service.js';
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
+ });
@@ -0,0 +1,12 @@
1
+ import { Controller, Get } from '@nestjs/common';
2
+ import { AppService } from './app.service.js';
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
+ }
@@ -0,0 +1,10 @@
1
+ import { Module } from '@nestjs/common';
2
+ import { AppController } from './app.controller.js';
3
+ import { AppService } from './app.service.js';
4
+
5
+ @Module({
6
+ imports: [],
7
+ controllers: [AppController],
8
+ providers: [AppService],
9
+ })
10
+ export class AppModule {}
@@ -0,0 +1,8 @@
1
+ import { Injectable } from '@nestjs/common';
2
+
3
+ @Injectable()
4
+ export class AppService {
5
+ getHello(): string {
6
+ return 'Hello World!';
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { NestFactory } from '@nestjs/core';
2
+ import { AppModule } from './app.module.js';
3
+
4
+ async function bootstrap() {
5
+ const app = await NestFactory.create(AppModule);
6
+ await app.listen(process.env.PORT ?? 3000);
7
+ }
8
+ bootstrap();
@@ -0,0 +1,25 @@
1
+ import { Test, TestingModule } from '@nestjs/testing';
2
+ import { INestApplication } from '@nestjs/common';
3
+ import request from 'supertest';
4
+ import { App } from 'supertest/types';
5
+ import { AppModule } from './../src/app.module.js';
6
+
7
+ describe('AppController (e2e)', () => {
8
+ let app: INestApplication<App>;
9
+
10
+ beforeEach(async () => {
11
+ const moduleFixture: TestingModule = await Test.createTestingModule({
12
+ imports: [AppModule],
13
+ }).compile();
14
+
15
+ app = moduleFixture.createNestApplication();
16
+ await app.init();
17
+ });
18
+
19
+ it('/ (GET)', () => {
20
+ return request(app.getHttpServer())
21
+ .get('/')
22
+ .expect(200)
23
+ .expect('Hello World!');
24
+ });
25
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
4
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "nodenext",
4
+ "moduleResolution": "nodenext",
5
+ "resolvePackageJsonExports": true,
6
+ "esModuleInterop": true,
7
+ "isolatedModules": true,
8
+ "declaration": true,
9
+ "removeComments": true,
10
+ "emitDecoratorMetadata": true,
11
+ "experimentalDecorators": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "target": "ES2023",
14
+ "sourceMap": true,
15
+ "outDir": "./dist",
16
+ "incremental": true,
17
+ "skipLibCheck": true,
18
+ "strictNullChecks": true,
19
+ "forceConsistentCasingInFileNames": true,
20
+ "noImplicitAny": <%= strict %>,
21
+ "strictBindCallApply": <%= strict %>,
22
+ "noFallthroughCasesInSwitch": <%= strict %>
23
+ }
24
+ }
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ rootDir: '.',
7
+ testRegex: '.e2e-spec.ts$',
8
+ root: './',
9
+ },
10
+ });
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ rootDir: '.',
7
+ testRegex: '.*\.spec\.ts$',
8
+ root: './',
9
+ },
10
+ });
@@ -40,6 +40,20 @@
40
40
  "description": "Nest application version.",
41
41
  "default": "0.0.1"
42
42
  },
43
+ "type": {
44
+ "type": "string",
45
+ "description": "Nest application module type (CJS or ESM).",
46
+ "enum": ["cjs", "esm"],
47
+ "default": "cjs",
48
+ "x-prompt": {
49
+ "message": "Which module system would you like to use?",
50
+ "type": "list",
51
+ "items": [
52
+ { "value": "cjs", "label": "CJS (CommonJS)" },
53
+ { "value": "esm", "label": "ESM (ES Modules)" }
54
+ ]
55
+ }
56
+ },
43
57
  "language": {
44
58
  "type": "string",
45
59
  "description": "Nest application language."
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
+ "composite": true,
4
5
  "declaration": true,
5
6
  "outDir": "../../dist/libs/<%= name %>"
6
7
  },
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
+ "composite": true,
4
5
  "declaration": false,
5
6
  "outDir": "../../dist/apps/<%= name %>"
6
7
  },
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
+ "composite": true,
4
5
  "declaration": false,
5
6
  "outDir": "../../dist/apps/<%= name %>"
6
7
  },
@@ -0,0 +1,2 @@
1
+ export * from './utils/index.js';
2
+ export * from './lib/defaults.js';
@@ -0,0 +1,2 @@
1
+ export * from './utils/index.js';
2
+ export * from './lib/defaults.js';
@@ -1,3 +1,3 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
- import { ApplicationOptions } from './application.schema';
2
+ import type { ApplicationOptions } from './application.schema.js';
3
3
  export declare function main(options: ApplicationOptions): Rule;
@@ -0,0 +1,64 @@
1
+ import { join, strings } from '@angular-devkit/core';
2
+ import { apply, filter, mergeWith, move, noop, template, url, } from '@angular-devkit/schematics';
3
+ import { basename, parse } from 'path';
4
+ import { normalizeToKebabOrSnakeCase } from '../../utils/formatting.js';
5
+ import { DEFAULT_AUTHOR, DEFAULT_DESCRIPTION, DEFAULT_LANGUAGE, DEFAULT_VERSION, } from '../defaults.js';
6
+ export function main(options) {
7
+ options.name = normalizeToKebabOrSnakeCase(options.name.toString());
8
+ const path = !options.directory || options.directory === 'undefined'
9
+ ? options.name
10
+ : options.directory;
11
+ options = transform(options);
12
+ return mergeWith(generate(options, path));
13
+ }
14
+ function transform(options) {
15
+ const target = Object.assign({}, options);
16
+ target.author = target.author ? target.author : DEFAULT_AUTHOR;
17
+ target.description = target.description
18
+ ? target.description
19
+ : DEFAULT_DESCRIPTION;
20
+ target.language = target.language ? target.language : DEFAULT_LANGUAGE;
21
+ target.name = resolvePackageName(target.name.toString());
22
+ target.version = target.version ? target.version : DEFAULT_VERSION;
23
+ target.type = target.type ?? 'cjs';
24
+ target.specFileSuffix = normalizeToKebabOrSnakeCase(options.specFileSuffix || 'spec');
25
+ target.packageManager =
26
+ !target.packageManager || target.packageManager === 'undefined'
27
+ ? 'npm'
28
+ : target.packageManager;
29
+ target.dependencies = target.dependencies ? target.dependencies : '';
30
+ target.devDependencies = target.devDependencies ? target.devDependencies : '';
31
+ return target;
32
+ }
33
+ function resolvePackageName(path) {
34
+ const { base: baseFilename, dir: dirname } = parse(path);
35
+ if (baseFilename === '.') {
36
+ return basename(process.cwd());
37
+ }
38
+ if (dirname.match(/^@[^\s]/)) {
39
+ return `${dirname}/${baseFilename}`;
40
+ }
41
+ return baseFilename;
42
+ }
43
+ function generate(options, path) {
44
+ const templateDir = options.type === 'esm' && options.language === 'ts'
45
+ ? 'ts-esm'
46
+ : options.language;
47
+ return apply(url(join('./files', templateDir)), [
48
+ options.spec
49
+ ? noop()
50
+ : filter((path) => !path.endsWith('__specFileSuffix__.ts')),
51
+ options.spec
52
+ ? noop()
53
+ : filter((path) => {
54
+ const languageExtension = options.language || 'ts';
55
+ const suffix = `__specFileSuffix__.${languageExtension}`;
56
+ return !path.endsWith(suffix);
57
+ }),
58
+ template({
59
+ ...strings,
60
+ ...options,
61
+ }),
62
+ move(path),
63
+ ]);
64
+ }
@@ -1,3 +1,3 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
- import { ClassOptions } from './class.schema';
2
+ import type { ClassOptions } from './class.schema.js';
3
3
  export declare function main(options: ClassOptions): Rule;
@@ -0,0 +1,48 @@
1
+ import { join, strings } from '@angular-devkit/core';
2
+ import { apply, chain, filter, mergeWith, move, noop, SchematicsException, template, url, } from '@angular-devkit/schematics';
3
+ import { normalizeToKebabOrSnakeCase } from '../../utils/formatting.js';
4
+ import { NameParser } from '../../utils/name.parser.js';
5
+ import { mergeSourceRoot } from '../../utils/source-root.helpers.js';
6
+ import { DEFAULT_LANGUAGE } from '../defaults.js';
7
+ export function main(options) {
8
+ options = transform(options);
9
+ return chain([mergeSourceRoot(options), mergeWith(generate(options))]);
10
+ }
11
+ function transform(options) {
12
+ const target = Object.assign({}, options);
13
+ if (!target.name) {
14
+ throw new SchematicsException('Option (name) is required.');
15
+ }
16
+ const location = new NameParser().parse(target);
17
+ target.name = normalizeToKebabOrSnakeCase(location.name);
18
+ target.specFileSuffix = normalizeToKebabOrSnakeCase(options.specFileSuffix || 'spec');
19
+ if (target.name.includes('.')) {
20
+ target.className = strings.classify(target.name).replace('.', '');
21
+ }
22
+ else {
23
+ target.className = target.name;
24
+ }
25
+ target.language =
26
+ target.language !== undefined ? target.language : DEFAULT_LANGUAGE;
27
+ target.path = normalizeToKebabOrSnakeCase(location.path);
28
+ target.path = target.flat
29
+ ? target.path
30
+ : join(target.path, target.name);
31
+ return target;
32
+ }
33
+ function generate(options) {
34
+ return (context) => apply(url(join('./files', options.language)), [
35
+ options.spec
36
+ ? noop()
37
+ : filter((path) => {
38
+ const languageExtension = options.language || 'ts';
39
+ const suffix = `.__specFileSuffix__.${languageExtension}`;
40
+ return !path.endsWith(suffix);
41
+ }),
42
+ template({
43
+ ...strings,
44
+ ...options,
45
+ }),
46
+ move(options.path),
47
+ ])(context);
48
+ }
@@ -1,3 +1,3 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
- import { AngularOptions } from './angular.schema';
2
+ import type { AngularOptions } from './angular.schema.js';
3
3
  export declare function main(options: AngularOptions): Rule;