@nestjs/schematics 12.0.0-alpha.5 → 12.0.0-alpha.7

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.
@@ -0,0 +1,9 @@
1
+ /** @type {import('jest').Config} */
2
+ const config = {
3
+ moduleFileExtensions: ['js', 'json'],
4
+ rootDir: 'src',
5
+ testRegex: '.spec.js$',
6
+ coverageDirectory: '../coverage',
7
+ };
8
+
9
+ module.exports = config;
@@ -33,14 +33,5 @@
33
33
  "nodemon": "3.1.14",
34
34
  "prettier": "3.8.1",
35
35
  "supertest": "7.2.2"
36
- },
37
- "jest": {
38
- "moduleFileExtensions": [
39
- "js",
40
- "json"
41
- ],
42
- "rootDir": "src",
43
- "testRegex": ".spec.js$",
44
- "coverageDirectory": "../coverage"
45
36
  }
46
37
  }
@@ -0,0 +1,15 @@
1
+ import type { Config } from 'jest';
2
+
3
+ const config: Config = {
4
+ moduleFileExtensions: ['js', 'json', 'ts'],
5
+ rootDir: 'src',
6
+ testRegex: '.*\\.spec\\.ts$',
7
+ transform: {
8
+ '^.+\\.(t|j)s$': 'ts-jest',
9
+ },
10
+ collectCoverageFrom: ['**/*.(t|j)s'],
11
+ coverageDirectory: '../coverage',
12
+ testEnvironment: 'node',
13
+ };
14
+
15
+ export default config;
@@ -49,22 +49,5 @@
49
49
  "tsconfig-paths": "^4.2.0",
50
50
  "typescript": "^5.7.3",
51
51
  "typescript-eslint": "^8.30.0"
52
- },
53
- "jest": {
54
- "moduleFileExtensions": [
55
- "js",
56
- "json",
57
- "ts"
58
- ],
59
- "rootDir": "src",
60
- "testRegex": ".*\\.spec\\.ts$",
61
- "transform": {
62
- "^.+\\.(t|j)s$": "ts-jest"
63
- },
64
- "collectCoverageFrom": [
65
- "**/*.(t|j)s"
66
- ],
67
- "coverageDirectory": "../coverage",
68
- "testEnvironment": "node"
69
52
  }
70
53
  }
@@ -1,11 +1,10 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
2
  import { INestApplication } from '@nestjs/common';
3
3
  import request from 'supertest';
4
- import { App } from 'supertest/types';
5
4
  import { AppModule } from './../src/app.module.js';
6
5
 
7
6
  describe('AppController (e2e)', () => {
8
- let app: INestApplication<App>;
7
+ let app: INestApplication;
9
8
 
10
9
  beforeEach(async () => {
11
10
  const moduleFixture: TestingModule = await Test.createTestingModule({
@@ -41,13 +41,16 @@
41
41
  "type": "string",
42
42
  "description": "Nest application module type (CJS or ESM).",
43
43
  "enum": ["cjs", "esm"],
44
- "default": "cjs",
44
+ "default": "esm",
45
45
  "x-prompt": {
46
46
  "message": "Which module system would you like to use?",
47
47
  "type": "list",
48
48
  "items": [
49
- { "value": "cjs", "label": "CJS (CommonJS)" },
50
- { "value": "esm", "label": "ESM (ES Modules)" }
49
+ {
50
+ "value": "esm",
51
+ "label": "ESM (ES Modules) [ with vitest ]"
52
+ },
53
+ { "value": "cjs", "label": "CJS (CommonJS) [ with jest ]" }
51
54
  ]
52
55
  }
53
56
  },
@@ -139,30 +139,33 @@ function updateJsonFile(host, path, callback) {
139
139
  }
140
140
  return host;
141
141
  }
142
- function updateTsConfig(packageName, _packagePrefix, root) {
142
+ function updateTsConfig(packageName, packagePrefix, root) {
143
143
  return (host) => {
144
144
  if (!host.exists('tsconfig.json')) {
145
145
  return host;
146
146
  }
147
- const refPath = `./${join(root, packageName, 'tsconfig.lib.json')}`;
147
+ const distRoot = join(root, packageName, 'src');
148
+ const packageKey = packagePrefix
149
+ ? packagePrefix + '/' + packageName
150
+ : packageName;
148
151
  return updateJsonFile(host, 'tsconfig.json', (tsconfig) => {
149
152
  if (!tsconfig.compilerOptions) {
150
153
  tsconfig.compilerOptions = {};
151
154
  }
152
155
  delete tsconfig.compilerOptions.baseUrl;
153
- delete tsconfig.compilerOptions.paths;
154
- if (!tsconfig.files) {
155
- tsconfig.files = [];
156
+ if (!tsconfig.compilerOptions.paths) {
157
+ tsconfig.compilerOptions.paths = {};
156
158
  }
157
- delete tsconfig.include;
158
- delete tsconfig.exclude;
159
- if (!tsconfig.references) {
160
- tsconfig.references = [];
159
+ if (!tsconfig.compilerOptions.paths[packageKey]) {
160
+ tsconfig.compilerOptions.paths[packageKey] = [];
161
161
  }
162
- const hasRef = tsconfig.references.some((ref) => ref.path === refPath);
163
- if (!hasRef) {
164
- tsconfig.references.push({ path: refPath });
162
+ tsconfig.compilerOptions.paths[packageKey].push('./' + distRoot);
163
+ const deepPackagePath = packageKey + '/*';
164
+ if (!tsconfig.compilerOptions.paths[deepPackagePath]) {
165
+ tsconfig.compilerOptions.paths[deepPackagePath] = [];
165
166
  }
167
+ tsconfig.compilerOptions.paths[deepPackagePath].push('./' + distRoot + '/*');
168
+ inPlaceSortByKeys(tsconfig.compilerOptions.paths);
166
169
  });
167
170
  };
168
171
  }
@@ -1,8 +1,8 @@
1
1
  import { join, strings } from '@angular-devkit/core';
2
2
  import { classify } from '@angular-devkit/core/src/utils/strings';
3
3
  import { apply, branchAndMerge, chain, filter, mergeWith, move, noop, SchematicsException, template, url, } from '@angular-devkit/schematics';
4
- import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
5
- import * as pluralize from 'pluralize';
4
+ import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks/index.js';
5
+ import pluralize from 'pluralize';
6
6
  import { ModuleDeclarator, ModuleFinder, } from '../../index.js';
7
7
  import { addPackageJsonDependency, getPackageJsonDependency, NodeDependencyType, } from '../../utils/dependencies.utils.js';
8
8
  import { normalizeToKebabOrSnakeCase } from '../../utils/formatting.js';
@@ -5,4 +5,4 @@ async function bootstrap() {
5
5
  const app = await NestFactory.create(<%= classify(name) %>Module);
6
6
  await app.listen(process.env.port ?? 3000);
7
7
  }
8
- bootstrap();
8
+ <%= isEsm ? 'await ' : '' %>bootstrap();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/schematics",
3
- "version": "12.0.0-alpha.5",
3
+ "version": "12.0.0-alpha.7",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@schematics)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -42,9 +42,9 @@
42
42
  },
43
43
  "homepage": "https://github.com/nestjs/schematics#readme",
44
44
  "dependencies": {
45
- "@angular-devkit/core": "21.2.0",
46
- "@angular-devkit/schematics": "21.2.0",
47
- "comment-json": "4.4.1",
45
+ "@angular-devkit/core": "21.2.1",
46
+ "@angular-devkit/schematics": "21.2.1",
47
+ "comment-json": "4.6.2",
48
48
  "jsonc-parser": "3.3.1",
49
49
  "pluralize": "8.0.0"
50
50
  },
@@ -52,23 +52,23 @@
52
52
  "@commitlint/cli": "20.4.3",
53
53
  "@commitlint/config-angular": "20.4.3",
54
54
  "@eslint/js": "10.0.1",
55
- "@types/node": "24.11.0",
55
+ "@types/node": "25.3.5",
56
56
  "cpx2": "8.0.0",
57
- "eslint": "10.0.2",
57
+ "eslint": "10.0.3",
58
58
  "eslint-config-prettier": "10.1.8",
59
59
  "eslint-plugin-prettier": "5.5.5",
60
60
  "globals": "17.4.0",
61
61
  "husky": "9.1.7",
62
- "jiti": "2.4.2",
62
+ "jiti": "2.6.1",
63
63
  "prettier": "3.8.1",
64
64
  "release-it": "19.2.4",
65
65
  "typescript": "5.9.3",
66
66
  "typescript-eslint": "8.56.1",
67
- "tsx": "^4.19.0",
68
- "vitest": "^3.2.1"
67
+ "tsx": "4.21.0",
68
+ "vitest": "4.0.18"
69
69
  },
70
70
  "peerDependencies": {
71
- "typescript": ">=4.8.2"
71
+ "typescript": ">=5.9.3"
72
72
  },
73
73
  "schematics": "./dist/collection.json",
74
74
  "lint-staged": {