@nestjs/schematics 12.0.0-alpha.6 → 12.0.0-alpha.8

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.
@@ -20,7 +20,7 @@ function transform(options) {
20
20
  target.language = target.language ? target.language : DEFAULT_LANGUAGE;
21
21
  target.name = resolvePackageName(target.name.toString());
22
22
  target.version = target.version ? target.version : DEFAULT_VERSION;
23
- target.type = target.type ?? 'cjs';
23
+ target.type = target.type ?? 'esm';
24
24
  target.specFileSuffix = normalizeToKebabOrSnakeCase(options.specFileSuffix || 'spec');
25
25
  target.packageManager =
26
26
  !target.packageManager || target.packageManager === 'undefined'
@@ -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;
@@ -14,14 +14,14 @@
14
14
  "test:e2e": "jest --config ./test/jest-e2e.json"
15
15
  },
16
16
  "dependencies": {
17
- "@nestjs/common": "^11.0.1",
18
- "@nestjs/core": "^11.0.1",
19
- "@nestjs/platform-express": "^11.0.1",
17
+ "@nestjs/common": "next",
18
+ "@nestjs/core": "next",
19
+ "@nestjs/platform-express": "next",
20
20
  "reflect-metadata": "^0.2.0",
21
21
  "rxjs": "^7.2.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@nestjs/testing": "^11.0.1",
24
+ "@nestjs/testing": "next",
25
25
  "@babel/core": "7.29.0",
26
26
  "@babel/node": "7.29.0",
27
27
  "@babel/plugin-proposal-decorators": "7.29.0",
@@ -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;
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/crates/oxc_linter/src/rules.rs",
3
+ "rules": {
4
+ "@typescript-eslint/no-explicit-any": "off",
5
+ "@typescript-eslint/no-floating-promises": "warn"
6
+ },
7
+ "env": {
8
+ "node": true
9
+ }
10
+ }
@@ -12,7 +12,7 @@
12
12
  "start:dev": "nest start --watch",
13
13
  "start:debug": "nest start --debug --watch",
14
14
  "start:prod": "node dist/main",
15
- "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
15
+ "lint": "oxlint src/ test/",
16
16
  "test": "jest",
17
17
  "test:watch": "jest --watch",
18
18
  "test:cov": "jest --coverage",
@@ -20,26 +20,22 @@
20
20
  "test:e2e": "jest --config ./test/jest-e2e.json"
21
21
  },
22
22
  "dependencies": {
23
- "@nestjs/common": "^11.0.1",
24
- "@nestjs/core": "^11.0.1",
25
- "@nestjs/platform-express": "^11.0.1",
23
+ "@nestjs/common": "next",
24
+ "@nestjs/core": "next",
25
+ "@nestjs/platform-express": "next",
26
26
  "reflect-metadata": "^0.2.2",
27
27
  "rxjs": "^7.8.1"
28
28
  },
29
29
  "devDependencies": {
30
- "@eslint/js": "^10.0.0",
31
- "@nestjs/cli": "^11.0.0",
32
- "@nestjs/schematics": "^11.0.0",
33
- "@nestjs/testing": "^11.0.1",
30
+ "@nestjs/cli": "next",
31
+ "@nestjs/schematics": "next",
32
+ "@nestjs/testing": "next",
34
33
  "@types/express": "^5.0.0",
35
34
  "@types/jest": "^30.0.0",
36
35
  "@types/node": "^24.0.0",
37
36
  "@types/supertest": "^7.0.0",
38
- "eslint": "^10.0.0",
39
- "eslint-config-prettier": "^10.0.1",
40
- "eslint-plugin-prettier": "^5.5.0",
41
- "globals": "^17.0.0",
42
37
  "jest": "^30.0.0",
38
+ "oxlint": "^1.58.0",
43
39
  "prettier": "^3.4.2",
44
40
  "source-map-support": "^0.5.21",
45
41
  "supertest": "^7.0.0",
@@ -47,24 +43,6 @@
47
43
  "ts-loader": "^9.5.2",
48
44
  "ts-node": "^10.9.2",
49
45
  "tsconfig-paths": "^4.2.0",
50
- "typescript": "^5.7.3",
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"
46
+ "typescript": "^6.0.2"
69
47
  }
70
48
  }
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/crates/oxc_linter/src/rules.rs",
3
+ "rules": {
4
+ "@typescript-eslint/no-explicit-any": "off",
5
+ "@typescript-eslint/no-floating-promises": "warn"
6
+ },
7
+ "env": {
8
+ "node": true
9
+ }
10
+ }
@@ -13,7 +13,7 @@
13
13
  "start:dev": "nest start --watch",
14
14
  "start:debug": "nest start --debug --watch",
15
15
  "start:prod": "node dist/main",
16
- "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
16
+ "lint": "oxlint src/ test/",
17
17
  "test": "vitest run",
18
18
  "test:watch": "vitest",
19
19
  "test:cov": "vitest run --coverage",
@@ -21,29 +21,24 @@
21
21
  "test:e2e": "vitest run --config ./vitest.config.e2e.ts"
22
22
  },
23
23
  "dependencies": {
24
- "@nestjs/common": "^11.0.1",
25
- "@nestjs/core": "^11.0.1",
26
- "@nestjs/platform-express": "^11.0.1",
24
+ "@nestjs/common": "next",
25
+ "@nestjs/core": "next",
26
+ "@nestjs/platform-express": "next",
27
27
  "reflect-metadata": "^0.2.2",
28
28
  "rxjs": "^7.8.1"
29
29
  },
30
30
  "devDependencies": {
31
- "@eslint/js": "^10.0.0",
32
- "@nestjs/cli": "^11.0.0",
33
- "@nestjs/schematics": "^11.0.0",
34
- "@nestjs/testing": "^11.0.1",
31
+ "@nestjs/cli": "next",
32
+ "@nestjs/schematics": "next",
33
+ "@nestjs/testing": "next",
35
34
  "@types/express": "^5.0.0",
36
35
  "@types/node": "^24.0.0",
37
36
  "@types/supertest": "^7.0.0",
38
- "eslint": "^10.0.0",
39
- "eslint-config-prettier": "^10.0.1",
40
- "eslint-plugin-prettier": "^5.5.0",
41
- "globals": "^17.0.0",
37
+ "oxlint": "^1.58.0",
42
38
  "prettier": "^3.4.2",
43
39
  "source-map-support": "^0.5.21",
44
40
  "supertest": "^7.0.0",
45
- "typescript": "^5.7.3",
46
- "typescript-eslint": "^8.30.0",
47
- "vitest": "^4.0.0-beta.1"
41
+ "typescript": "^6.0.2",
42
+ "vitest": "^4.1.2"
48
43
  }
49
44
  }
@@ -55,10 +55,11 @@ function addDeclarationToModule(options) {
55
55
  if (options.skipImport !== undefined && options.skipImport) {
56
56
  return tree;
57
57
  }
58
- options.module = new ModuleFinder(tree).find({
59
- name: options.name,
60
- path: options.path,
61
- });
58
+ options.module =
59
+ new ModuleFinder(tree).find({
60
+ name: options.name,
61
+ path: options.path,
62
+ }) ?? undefined;
62
63
  if (!options.module) {
63
64
  return tree;
64
65
  }
@@ -55,10 +55,11 @@ function addDeclarationToModule(options) {
55
55
  if (options.skipImport !== undefined && options.skipImport) {
56
56
  return tree;
57
57
  }
58
- options.module = new ModuleFinder(tree).find({
59
- name: options.name,
60
- path: options.path,
61
- });
58
+ options.module =
59
+ new ModuleFinder(tree).find({
60
+ name: options.name,
61
+ path: options.path,
62
+ }) ?? undefined;
62
63
  if (!options.module) {
63
64
  return tree;
64
65
  }
@@ -42,10 +42,11 @@ function addDeclarationToModule(options) {
42
42
  if (options.skipImport !== undefined && options.skipImport) {
43
43
  return tree;
44
44
  }
45
- options.module = new ModuleFinder(tree).find({
46
- name: options.name,
47
- path: options.path,
48
- });
45
+ options.module =
46
+ new ModuleFinder(tree).find({
47
+ name: options.name,
48
+ path: options.path,
49
+ }) ?? undefined;
49
50
  if (!options.module) {
50
51
  return tree;
51
52
  }
@@ -59,10 +59,11 @@ function addDeclarationToModule(options) {
59
59
  if (options.skipImport !== undefined && options.skipImport) {
60
60
  return tree;
61
61
  }
62
- options.module = new ModuleFinder(tree).find({
63
- name: options.name,
64
- path: options.path,
65
- });
62
+ options.module =
63
+ new ModuleFinder(tree).find({
64
+ name: options.name,
65
+ path: options.path,
66
+ }) ?? undefined;
66
67
  if (!options.module) {
67
68
  return tree;
68
69
  }
@@ -54,10 +54,11 @@ function addDeclarationToModule(options) {
54
54
  if (options.skipImport !== undefined && options.skipImport) {
55
55
  return tree;
56
56
  }
57
- options.module = new ModuleFinder(tree).find({
58
- name: options.name,
59
- path: options.path,
60
- });
57
+ options.module =
58
+ new ModuleFinder(tree).find({
59
+ name: options.name,
60
+ path: options.path,
61
+ }) ?? undefined;
61
62
  if (!options.module) {
62
63
  return tree;
63
64
  }
@@ -2,7 +2,7 @@ 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
4
  import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks/index.js';
5
- import * as pluralize from 'pluralize';
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';
@@ -46,12 +46,12 @@ function generate(options) {
46
46
  if (path.endsWith('.dto.ts')) {
47
47
  return (options.type !== 'graphql-code-first' &&
48
48
  options.type !== 'graphql-schema-first' &&
49
- options.crud);
49
+ !!options.crud);
50
50
  }
51
51
  if (path.endsWith('.input.ts')) {
52
52
  return ((options.type === 'graphql-code-first' ||
53
53
  options.type === 'graphql-schema-first') &&
54
- options.crud);
54
+ !!options.crud);
55
55
  }
56
56
  if (path.endsWith('.resolver.ts') ||
57
57
  path.endsWith('.resolver.__specFileSuffix__.ts')) {
@@ -59,7 +59,7 @@ function generate(options) {
59
59
  options.type === 'graphql-schema-first');
60
60
  }
61
61
  if (path.endsWith('.graphql')) {
62
- return options.type === 'graphql-schema-first' && options.crud;
62
+ return options.type === 'graphql-schema-first' && !!options.crud;
63
63
  }
64
64
  if (path.endsWith('controller.ts') ||
65
65
  path.endsWith('.controller.__specFileSuffix__.ts')) {
@@ -70,7 +70,7 @@ function generate(options) {
70
70
  return options.type === 'ws';
71
71
  }
72
72
  if (path.includes('@ent')) {
73
- return options.crud;
73
+ return !!options.crud;
74
74
  }
75
75
  return true;
76
76
  }),
@@ -98,10 +98,11 @@ function addDeclarationToModule(options) {
98
98
  if (options.skipImport !== undefined && options.skipImport) {
99
99
  return tree;
100
100
  }
101
- options.module = new ModuleFinder(tree).find({
102
- name: options.name,
103
- path: options.path,
104
- });
101
+ options.module =
102
+ new ModuleFinder(tree).find({
103
+ name: options.name,
104
+ path: options.path,
105
+ }) ?? undefined;
105
106
  if (!options.module) {
106
107
  return tree;
107
108
  }
@@ -57,10 +57,11 @@ function addDeclarationToModule(options) {
57
57
  if (options.skipImport !== undefined && options.skipImport) {
58
58
  return tree;
59
59
  }
60
- options.module = new ModuleFinder(tree).find({
61
- name: options.name,
62
- path: options.path,
63
- });
60
+ options.module =
61
+ new ModuleFinder(tree).find({
62
+ name: options.name,
63
+ path: options.path,
64
+ }) ?? undefined;
64
65
  if (!options.module) {
65
66
  return tree;
66
67
  }
@@ -211,7 +211,11 @@ function moveDefaultAppToApps(projectRoot, appName, sourceRoot = DEFAULT_PATH_NA
211
211
  }
212
212
  function moveDirectoryTo(srcDir, destination, tree) {
213
213
  let srcDirExists = false;
214
- tree.getDir(srcDir).visit((filePath, file) => {
214
+ tree
215
+ .getDir(srcDir)
216
+ .visit((filePath, file) => {
217
+ if (!file)
218
+ return;
215
219
  srcDirExists = true;
216
220
  const newFilePath = join(destination, filePath);
217
221
  tree.create(newFilePath, file.content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/schematics",
3
- "version": "12.0.0-alpha.6",
3
+ "version": "12.0.0-alpha.8",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@schematics)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,10 +13,10 @@
13
13
  "scripts": {
14
14
  "postbuild": "npm run copy:collection && npm run copy:lib",
15
15
  "build": "rm -rf dist *.tsbuildinfo && tsc -b tsconfig.lib.json",
16
- "clean": "find src -type f \\( -name '*.js' -o -name '*.d.ts' -o -name '*.js.map' -o -name '*.d.ts.map' \\) -not -path '*/files/*' -not -path '*/workspace/*' -not -name '*.schema.d.ts' -delete",
16
+ "clean": "del 'src/**/*.{js,d.ts,js.map,d.ts.map}' '!src/**/files/**' '!src/**/workspace/**' '!src/**/*.schema.d.ts'",
17
17
  "copy:collection": "cpx src/collection.json dist && cpx 'src/lib/**/schema.json' dist/lib",
18
18
  "copy:lib": "cpx 'src/lib/**/{files,workspace}/**/*.*' dist/lib && cpx 'src/lib/**/{files,workspace}/**/.!(gitignore)' dist/lib",
19
- "lint": "eslint '{src,test}/**/*.ts' --fix",
19
+ "lint": "oxlint --ignore-pattern 'src/**/files/**' --ignore-pattern 'src/**/workspace/**' src/ test/",
20
20
  "prepublish:next": "npm run build",
21
21
  "publish:next": "npm publish --access public --tag next",
22
22
  "prepublish:npm": "npm run build",
@@ -42,33 +42,30 @@
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
  },
51
51
  "devDependencies": {
52
52
  "@commitlint/cli": "20.4.3",
53
53
  "@commitlint/config-angular": "20.4.3",
54
- "@eslint/js": "10.0.1",
55
- "@types/node": "24.11.0",
54
+ "@types/node": "25.3.5",
55
+ "@types/pluralize": "^0.0.33",
56
56
  "cpx2": "8.0.0",
57
- "eslint": "10.0.2",
58
- "eslint-config-prettier": "10.1.8",
59
- "eslint-plugin-prettier": "5.5.5",
60
- "globals": "17.4.0",
57
+ "del-cli": "^7.0.0",
61
58
  "husky": "9.1.7",
62
- "jiti": "2.4.2",
59
+ "jiti": "2.6.1",
60
+ "oxlint": "1.58.0",
63
61
  "prettier": "3.8.1",
64
62
  "release-it": "19.2.4",
65
- "typescript": "5.9.3",
66
- "typescript-eslint": "8.56.1",
67
- "tsx": "^4.19.0",
68
- "vitest": "^3.2.1"
63
+ "tsx": "4.21.0",
64
+ "typescript": "^6.0.2",
65
+ "vitest": "4.0.18"
69
66
  },
70
67
  "peerDependencies": {
71
- "typescript": ">=4.8.2"
68
+ "typescript": ">=6.0.0"
72
69
  },
73
70
  "schematics": "./dist/collection.json",
74
71
  "lint-staged": {
@@ -1,34 +0,0 @@
1
- import eslint from '@eslint/js';
2
- import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
3
- import globals from 'globals';
4
- import tseslint from 'typescript-eslint';
5
-
6
- export default [
7
- {
8
- ignores: ['eslint.config.mjs'],
9
- },
10
- eslint.configs.recommended,
11
- ...tseslint.configs.recommendedTypeChecked,
12
- eslintPluginPrettierRecommended,
13
- {
14
- languageOptions: {
15
- globals: {
16
- ...globals.node,
17
- ...globals.jest,
18
- },
19
- sourceType: 'commonjs',
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
- ];
@@ -1,33 +0,0 @@
1
- import eslint from '@eslint/js';
2
- import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
3
- import globals from 'globals';
4
- import tseslint from 'typescript-eslint';
5
-
6
- export default [
7
- {
8
- ignores: ['eslint.config.mjs'],
9
- },
10
- eslint.configs.recommended,
11
- ...tseslint.configs.recommendedTypeChecked,
12
- eslintPluginPrettierRecommended,
13
- {
14
- languageOptions: {
15
- globals: {
16
- ...globals.node,
17
- },
18
- sourceType: 'module',
19
- parserOptions: {
20
- projectService: true,
21
- tsconfigRootDir: import.meta.dirname,
22
- },
23
- },
24
- },
25
- {
26
- rules: {
27
- '@typescript-eslint/no-explicit-any': 'off',
28
- '@typescript-eslint/no-floating-promises': 'warn',
29
- '@typescript-eslint/no-unsafe-argument': 'warn',
30
- "prettier/prettier": ["error", { endOfLine: "auto" }],
31
- },
32
- },
33
- ];