@nestjs/schematics 10.0.1 → 10.0.3

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.
@@ -24,6 +24,7 @@ function transform(options) {
24
24
  target.language = !!target.language ? target.language : defaults_1.DEFAULT_LANGUAGE;
25
25
  target.name = resolvePackageName(target.name.toString());
26
26
  target.version = !!target.version ? target.version : defaults_1.DEFAULT_VERSION;
27
+ target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
27
28
  target.packageManager =
28
29
  !target.packageManager || target.packageManager === 'undefined'
29
30
  ? 'npm'
@@ -46,6 +47,14 @@ function resolvePackageName(path) {
46
47
  }
47
48
  function generate(options, path) {
48
49
  return (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
50
+ options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('__specFileSuffix__.ts')),
51
+ options.spec
52
+ ? (0, schematics_1.noop)()
53
+ : (0, schematics_1.filter)((path) => {
54
+ const languageExtension = options.language || 'ts';
55
+ const suffix = `__specFileSuffix__.${languageExtension}`;
56
+ return !path.endsWith(suffix);
57
+ }),
49
58
  (0, schematics_1.template)({
50
59
  ...core_1.strings,
51
60
  ...options,
@@ -22,16 +22,16 @@
22
22
  },
23
23
  "devDependencies": {
24
24
  "@nestjs/testing": "^10.0.0",
25
- "@babel/core": "7.22.5",
26
- "@babel/node": "7.22.5",
27
- "@babel/plugin-proposal-decorators": "7.22.5",
28
- "@babel/plugin-transform-runtime": "7.22.5",
29
- "@babel/preset-env": "7.22.5",
30
- "@babel/register": "7.22.5",
31
- "@babel/runtime": "7.22.5",
32
- "jest": "29.5.0",
33
- "nodemon": "2.0.22",
34
- "prettier": "2.8.8",
25
+ "@babel/core": "7.23.2",
26
+ "@babel/node": "7.22.19",
27
+ "@babel/plugin-proposal-decorators": "7.23.2",
28
+ "@babel/plugin-transform-runtime": "7.23.2",
29
+ "@babel/preset-env": "7.23.2",
30
+ "@babel/register": "7.22.15",
31
+ "@babel/runtime": "7.23.2",
32
+ "jest": "29.7.0",
33
+ "nodemon": "3.0.1",
34
+ "prettier": "3.0.3",
35
35
  "supertest": "6.3.3"
36
36
  },
37
37
  "jest": {
@@ -34,13 +34,13 @@
34
34
  "@types/jest": "^29.5.2",
35
35
  "@types/node": "^20.3.1",
36
36
  "@types/supertest": "^2.0.12",
37
- "@typescript-eslint/eslint-plugin": "^5.59.11",
38
- "@typescript-eslint/parser": "^5.59.11",
37
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
38
+ "@typescript-eslint/parser": "^6.0.0",
39
39
  "eslint": "^8.42.0",
40
- "eslint-config-prettier": "^8.8.0",
41
- "eslint-plugin-prettier": "^4.2.1",
40
+ "eslint-config-prettier": "^9.0.0",
41
+ "eslint-plugin-prettier": "^5.0.0",
42
42
  "jest": "^29.5.0",
43
- "prettier": "^2.8.8",
43
+ "prettier": "^3.0.0",
44
44
  "source-map-support": "^0.5.21",
45
45
  "supertest": "^6.3.3",
46
46
  "ts-jest": "^29.1.0",
@@ -55,6 +55,16 @@
55
55
  "devDependencies": {
56
56
  "type": "string",
57
57
  "description": "Nest application development dependencies."
58
+ },
59
+ "spec": {
60
+ "type": "boolean",
61
+ "default": true,
62
+ "description": "Specifies if a spec file is generated."
63
+ },
64
+ "specFileSuffix": {
65
+ "type": "string",
66
+ "default": "spec",
67
+ "description": "Specifies the file suffix of spec files."
58
68
  }
59
69
  },
60
70
  "required": ["name"]
@@ -17,11 +17,12 @@ function transform(options) {
17
17
  return target;
18
18
  }
19
19
  function generate(options) {
20
+ const projectOrPath = options.project ?? '.';
20
21
  return (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
21
22
  (0, schematics_1.template)({
22
23
  ...core_1.strings,
23
24
  ...options,
24
25
  }),
25
- (0, schematics_1.move)(options.project),
26
+ (0, schematics_1.move)(projectOrPath),
26
27
  ]);
27
28
  }
@@ -4,6 +4,6 @@ import { <%= classify(name) %>Service } from './<%= name %>.service';
4
4
 
5
5
  @Module({
6
6
  <% if (type === 'rest' || type === 'microservice') { %>controllers: [<%= classify(name) %>Controller],
7
- providers: [<%= classify(name) %>Service]<% } else if (type === 'graphql-code-first' || type === 'graphql-schema-first') { %>providers: [<%= classify(name) %>Resolver, <%= classify(name) %>Service]<% } else { %>providers: [<%= classify(name) %>Gateway, <%= classify(name) %>Service]<% } %>
7
+ providers: [<%= classify(name) %>Service],<% } else if (type === 'graphql-code-first' || type === 'graphql-schema-first') { %>providers: [<%= classify(name) %>Resolver, <%= classify(name) %>Service],<% } else { %>providers: [<%= classify(name) %>Gateway, <%= classify(name) %>Service],<% } %>
8
8
  })
9
9
  export class <%= classify(name) %>Module {}
@@ -178,12 +178,15 @@ function moveDefaultAppToApps(projectRoot, appName, sourceRoot = defaults_1.DEFA
178
178
  };
179
179
  }
180
180
  function moveDirectoryTo(srcDir, destination, tree) {
181
+ let srcDirExists = false;
181
182
  tree.getDir(srcDir).visit((filePath, file) => {
183
+ srcDirExists = true;
182
184
  const newFilePath = (0, core_1.join)(destination, filePath);
183
185
  tree.create(newFilePath, file.content);
184
- tree.delete(filePath);
185
186
  });
186
- tree.delete(srcDir);
187
+ if (srcDirExists) {
188
+ tree.delete(srcDir);
189
+ }
187
190
  }
188
191
  function addAppsToCliOptions(projectRoot, projectName, appName) {
189
192
  const rootPath = (0, core_1.join)(projectRoot, projectName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/schematics",
3
- "version": "10.0.1",
3
+ "version": "10.0.3",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@schematics)",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -41,32 +41,32 @@
41
41
  },
42
42
  "homepage": "https://github.com/nestjs/schematics#readme",
43
43
  "dependencies": {
44
- "@angular-devkit/core": "16.1.0",
45
- "@angular-devkit/schematics": "16.1.0",
44
+ "@angular-devkit/core": "16.2.8",
45
+ "@angular-devkit/schematics": "16.2.8",
46
46
  "comment-json": "4.2.3",
47
47
  "jsonc-parser": "3.2.0",
48
48
  "pluralize": "8.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@commitlint/cli": "17.6.5",
52
- "@commitlint/config-angular": "17.6.5",
53
- "@types/jest": "29.5.2",
54
- "@types/node": "18.16.18",
55
- "@typescript-eslint/eslint-plugin": "5.59.11",
56
- "@typescript-eslint/parser": "5.59.11",
51
+ "@commitlint/cli": "18.2.0",
52
+ "@commitlint/config-angular": "18.1.0",
53
+ "@types/jest": "29.5.6",
54
+ "@types/node": "20.8.9",
55
+ "@typescript-eslint/eslint-plugin": "6.9.0",
56
+ "@typescript-eslint/parser": "6.9.0",
57
57
  "cpx": "1.5.0",
58
- "eslint": "8.42.0",
59
- "eslint-config-prettier": "8.8.0",
60
- "eslint-plugin-import": "2.27.5",
58
+ "eslint": "8.52.0",
59
+ "eslint-config-prettier": "9.0.0",
60
+ "eslint-plugin-import": "2.29.0",
61
61
  "gulp": "4.0.2",
62
62
  "gulp-clean": "0.4.0",
63
63
  "husky": "8.0.3",
64
- "jest": "29.5.0",
64
+ "jest": "29.7.0",
65
65
  "nyc": "15.1.0",
66
- "release-it": "15.11.0",
67
- "ts-jest": "29.1.0",
66
+ "release-it": "16.2.1",
67
+ "ts-jest": "29.1.1",
68
68
  "ts-node": "10.9.1",
69
- "typescript": "5.1.3"
69
+ "typescript": "5.2.2"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "typescript": ">=4.8.2"