@gapi/schematics 1.8.168 → 1.8.170

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 (151) hide show
  1. package/dist/lib/application/application.factory.js +5 -6
  2. package/dist/lib/application/application.factory.test.ts +5 -1
  3. package/dist/lib/application/application.factory.ts +1 -0
  4. package/dist/lib/application/files/ts/src/app.controller.spec.ts +1 -0
  5. package/dist/lib/application/files/ts/src/app.controller.ts +1 -0
  6. package/dist/lib/application/files/ts/src/app.module.ts +1 -0
  7. package/dist/lib/application/files/ts/src/main.ts +1 -0
  8. package/dist/lib/application/files/ts/test/app.e2e-spec.ts +1 -0
  9. package/dist/lib/class/class.factory.js +7 -8
  10. package/dist/lib/class/class.factory.test.ts +9 -6
  11. package/dist/lib/class/class.factory.ts +2 -1
  12. package/dist/lib/client-app/angular/angular.factory.js +12 -13
  13. package/dist/lib/client-app/angular/angular.factory.ts +5 -4
  14. package/dist/lib/client-app/angular/files/angular.module.ts +1 -0
  15. package/dist/lib/client-app/angular/files/angular.providers.ts +1 -0
  16. package/dist/lib/client-app/angular/files/loaders/abstract.loader.ts +1 -0
  17. package/dist/lib/client-app/angular/files/loaders/express.loader.ts +1 -0
  18. package/dist/lib/client-app/angular/files/loaders/fastify.loader.ts +1 -0
  19. package/dist/lib/client-app/angular/files/loaders/noop.loader.ts +1 -0
  20. package/dist/lib/component/component.factory.js +9 -10
  21. package/dist/lib/component/component.factory.test.ts +13 -12
  22. package/dist/lib/component/component.factory.ts +2 -1
  23. package/dist/lib/configuration/configuration.factory.js +5 -6
  24. package/dist/lib/configuration/configuration.factory.test.ts +4 -3
  25. package/dist/lib/configuration/configuration.factory.ts +1 -0
  26. package/dist/lib/controller/controller.factory.js +9 -10
  27. package/dist/lib/controller/controller.factory.test.ts +13 -12
  28. package/dist/lib/controller/controller.factory.ts +2 -1
  29. package/dist/lib/decorator/decorator.factory.js +6 -7
  30. package/dist/lib/decorator/decorator.factory.test.ts +7 -6
  31. package/dist/lib/decorator/decorator.factory.ts +1 -0
  32. package/dist/lib/effect/effect.factory.js +10 -12
  33. package/dist/lib/effect/effect.factory.test.ts +12 -11
  34. package/dist/lib/effect/effect.factory.ts +3 -3
  35. package/dist/lib/filter/filter.factory.js +7 -8
  36. package/dist/lib/filter/filter.factory.test.ts +12 -7
  37. package/dist/lib/filter/filter.factory.ts +2 -1
  38. package/dist/lib/gateway/gateway.factory.js +9 -10
  39. package/dist/lib/gateway/gateway.factory.test.ts +7 -6
  40. package/dist/lib/gateway/gateway.factory.ts +2 -1
  41. package/dist/lib/guard/guard.factory.js +7 -8
  42. package/dist/lib/guard/guard.factory.test.ts +7 -6
  43. package/dist/lib/guard/guard.factory.ts +2 -1
  44. package/dist/lib/interceptor/interceptor.factory.js +7 -8
  45. package/dist/lib/interceptor/interceptor.factory.test.ts +7 -6
  46. package/dist/lib/interceptor/interceptor.factory.ts +2 -1
  47. package/dist/lib/interface/interface.factory.js +6 -7
  48. package/dist/lib/interface/interface.factory.test.ts +6 -5
  49. package/dist/lib/interface/interface.factory.ts +1 -0
  50. package/dist/lib/library/library.factory.js +13 -14
  51. package/dist/lib/library/library.factory.test.ts +1 -0
  52. package/dist/lib/library/library.factory.ts +2 -1
  53. package/dist/lib/module/module.factory.js +8 -9
  54. package/dist/lib/module/module.factory.test.ts +7 -6
  55. package/dist/lib/module/module.factory.ts +1 -0
  56. package/dist/lib/pipe/pipe.factory.js +7 -8
  57. package/dist/lib/pipe/pipe.factory.test.ts +7 -6
  58. package/dist/lib/pipe/pipe.factory.ts +2 -1
  59. package/dist/lib/plugin/plugin.factory.d.ts +1 -0
  60. package/dist/lib/plugin/plugin.factory.test.ts +13 -12
  61. package/dist/lib/plugin/plugin.factory.ts +2 -1
  62. package/dist/lib/provider/provider.factory.d.ts +1 -0
  63. package/dist/lib/provider/provider.factory.test.ts +11 -10
  64. package/dist/lib/provider/provider.factory.ts +2 -1
  65. package/dist/lib/resolver/resolver.factory.js +9 -10
  66. package/dist/lib/resolver/resolver.factory.test.ts +13 -12
  67. package/dist/lib/resolver/resolver.factory.ts +2 -1
  68. package/dist/lib/service/service.factory.js +10 -12
  69. package/dist/lib/service/service.factory.test.ts +12 -11
  70. package/dist/lib/service/service.factory.ts +3 -3
  71. package/dist/lib/type/type.factory.d.ts +1 -0
  72. package/dist/lib/type/type.factory.test.ts +13 -12
  73. package/dist/lib/type/type.factory.ts +2 -1
  74. package/dist/utils/metadata.manager.js +9 -9
  75. package/dist/utils/metadata.manager.ts +13 -10
  76. package/dist/utils/module-import.declarator.js +4 -4
  77. package/dist/utils/module-import.declarator.ts +3 -2
  78. package/dist/utils/module.declarator.js +2 -2
  79. package/dist/utils/module.declarator.ts +2 -0
  80. package/dist/utils/module.finder.js +2 -2
  81. package/dist/utils/module.finder.ts +1 -1
  82. package/dist/utils/name.parser.js +3 -5
  83. package/dist/utils/name.parser.ts +5 -6
  84. package/dist/utils/path.solver.js +2 -4
  85. package/dist/utils/path.solver.ts +2 -3
  86. package/dist/utils/source-root.helpers.js +6 -6
  87. package/dist/utils/source-root.helpers.ts +4 -2
  88. package/eslint.config.mjs +38 -0
  89. package/package.json +2 -2
  90. package/src/lib/application/application.factory.test.ts +5 -1
  91. package/src/lib/application/application.factory.ts +1 -0
  92. package/src/lib/application/files/ts/src/app.controller.spec.ts +1 -0
  93. package/src/lib/application/files/ts/src/app.controller.ts +1 -0
  94. package/src/lib/application/files/ts/src/app.module.ts +1 -0
  95. package/src/lib/application/files/ts/src/main.ts +1 -0
  96. package/src/lib/application/files/ts/test/app.e2e-spec.ts +1 -0
  97. package/src/lib/class/class.factory.test.ts +9 -6
  98. package/src/lib/class/class.factory.ts +2 -1
  99. package/src/lib/client-app/angular/angular.factory.ts +5 -4
  100. package/src/lib/client-app/angular/files/angular.module.ts +1 -0
  101. package/src/lib/client-app/angular/files/angular.providers.ts +1 -0
  102. package/src/lib/client-app/angular/files/loaders/abstract.loader.ts +1 -0
  103. package/src/lib/client-app/angular/files/loaders/express.loader.ts +1 -0
  104. package/src/lib/client-app/angular/files/loaders/fastify.loader.ts +1 -0
  105. package/src/lib/client-app/angular/files/loaders/noop.loader.ts +1 -0
  106. package/src/lib/component/component.factory.test.ts +13 -12
  107. package/src/lib/component/component.factory.ts +2 -1
  108. package/src/lib/configuration/configuration.factory.test.ts +4 -3
  109. package/src/lib/configuration/configuration.factory.ts +1 -0
  110. package/src/lib/controller/controller.factory.test.ts +13 -12
  111. package/src/lib/controller/controller.factory.ts +2 -1
  112. package/src/lib/decorator/decorator.factory.test.ts +7 -6
  113. package/src/lib/decorator/decorator.factory.ts +1 -0
  114. package/src/lib/effect/effect.factory.test.ts +12 -11
  115. package/src/lib/effect/effect.factory.ts +3 -3
  116. package/src/lib/filter/filter.factory.test.ts +12 -7
  117. package/src/lib/filter/filter.factory.ts +2 -1
  118. package/src/lib/gateway/gateway.factory.test.ts +7 -6
  119. package/src/lib/gateway/gateway.factory.ts +2 -1
  120. package/src/lib/guard/guard.factory.test.ts +7 -6
  121. package/src/lib/guard/guard.factory.ts +2 -1
  122. package/src/lib/interceptor/interceptor.factory.test.ts +7 -6
  123. package/src/lib/interceptor/interceptor.factory.ts +2 -1
  124. package/src/lib/interface/interface.factory.test.ts +6 -5
  125. package/src/lib/interface/interface.factory.ts +1 -0
  126. package/src/lib/library/library.factory.test.ts +1 -0
  127. package/src/lib/library/library.factory.ts +2 -1
  128. package/src/lib/module/module.factory.test.ts +7 -6
  129. package/src/lib/module/module.factory.ts +1 -0
  130. package/src/lib/pipe/pipe.factory.test.ts +7 -6
  131. package/src/lib/pipe/pipe.factory.ts +2 -1
  132. package/src/lib/plugin/plugin.factory.d.ts +1 -0
  133. package/src/lib/plugin/plugin.factory.test.ts +13 -12
  134. package/src/lib/plugin/plugin.factory.ts +2 -1
  135. package/src/lib/provider/provider.factory.d.ts +1 -0
  136. package/src/lib/provider/provider.factory.test.ts +11 -10
  137. package/src/lib/provider/provider.factory.ts +2 -1
  138. package/src/lib/resolver/resolver.factory.test.ts +13 -12
  139. package/src/lib/resolver/resolver.factory.ts +2 -1
  140. package/src/lib/service/service.factory.test.ts +12 -11
  141. package/src/lib/service/service.factory.ts +3 -3
  142. package/src/lib/type/type.factory.d.ts +1 -0
  143. package/src/lib/type/type.factory.test.ts +13 -12
  144. package/src/lib/type/type.factory.ts +2 -1
  145. package/src/utils/metadata.manager.ts +13 -10
  146. package/src/utils/module-import.declarator.ts +3 -2
  147. package/src/utils/module.declarator.ts +2 -0
  148. package/src/utils/module.finder.ts +1 -1
  149. package/src/utils/name.parser.ts +5 -6
  150. package/src/utils/path.solver.ts +2 -3
  151. package/src/utils/source-root.helpers.ts +4 -2
@@ -13,6 +13,7 @@ import {
13
13
  Tree,
14
14
  url,
15
15
  } from '@angular-devkit/schematics';
16
+
16
17
  import {
17
18
  DeclarationOptions,
18
19
  ModuleDeclarator,
@@ -59,7 +60,7 @@ function transform(source: ControllerOptions): ControllerOptions {
59
60
  function generate(options: ControllerOptions) {
60
61
  return (context: SchematicContext) =>
61
62
  apply(url(join('./files' as Path, options.language)), [
62
- options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
63
+ options.spec ? noop() : filter((path) => !path.endsWith('.spec.ts')),
63
64
  template({
64
65
  ...strings,
65
66
  ...options,
@@ -7,11 +7,11 @@ class MetadataManager {
7
7
  this.content = content;
8
8
  }
9
9
  insert(metadata, symbol, staticOptions) {
10
- const source = typescript_1.createSourceFile('filename.ts', this.content, typescript_1.ScriptTarget.ES2017);
11
- const decoratorNodes = this.getDecoratorMetadata(source, '@Module');
10
+ const source = (0, typescript_1.createSourceFile)('filename.ts', this.content, typescript_1.ScriptTarget.ES2017);
11
+ const decoratorNodes = this.getDecoratorMetadata(source);
12
12
  const node = decoratorNodes[0];
13
13
  const matchingProperties = node.properties
14
- .filter(prop => prop.kind === typescript_1.SyntaxKind.PropertyAssignment)
14
+ .filter((prop) => prop.kind === typescript_1.SyntaxKind.PropertyAssignment)
15
15
  .filter((prop) => {
16
16
  const name = prop.name;
17
17
  switch (name.kind) {
@@ -42,14 +42,14 @@ class MetadataManager {
42
42
  return this.insertSymbolToMetadata(source, matchingProperties, symbol, staticOptions);
43
43
  }
44
44
  }
45
- getDecoratorMetadata(source, identifier) {
45
+ getDecoratorMetadata(source) {
46
46
  return this.getSourceNodes(source)
47
- .filter(node => node.kind === typescript_1.SyntaxKind.Decorator &&
47
+ .filter((node) => node.kind === typescript_1.SyntaxKind.Decorator &&
48
48
  node.expression.kind === typescript_1.SyntaxKind.CallExpression)
49
- .map(node => node.expression)
50
- .filter(expr => expr.arguments[0] &&
49
+ .map((node) => node.expression)
50
+ .filter((expr) => expr.arguments[0] &&
51
51
  expr.arguments[0].kind === typescript_1.SyntaxKind.ObjectLiteralExpression)
52
- .map(expr => expr.arguments[0]);
52
+ .map((expr) => expr.arguments[0]);
53
53
  }
54
54
  getSourceNodes(sourceFile) {
55
55
  const nodes = [sourceFile];
@@ -110,7 +110,7 @@ class MetadataManager {
110
110
  }
111
111
  if (Array.isArray(node)) {
112
112
  const nodeArray = node;
113
- const symbolsArray = nodeArray.map(childNode => childNode.getText(source));
113
+ const symbolsArray = nodeArray.map((childNode) => childNode.getText(source));
114
114
  if (symbolsArray.includes(symbol)) {
115
115
  return this.content;
116
116
  }
@@ -15,6 +15,7 @@ import {
15
15
  StringLiteral,
16
16
  SyntaxKind,
17
17
  } from 'typescript';
18
+
18
19
  import { DeclarationOptions } from './module.declarator';
19
20
 
20
21
  export class MetadataManager {
@@ -30,10 +31,12 @@ export class MetadataManager {
30
31
  this.content,
31
32
  ScriptTarget.ES2017,
32
33
  );
33
- const decoratorNodes: Node[] = this.getDecoratorMetadata(source, '@Module');
34
+ const decoratorNodes: Node[] = this.getDecoratorMetadata(source);
34
35
  const node: Node = decoratorNodes[0];
35
- const matchingProperties: ObjectLiteralElement[] = (node as ObjectLiteralExpression).properties
36
- .filter(prop => prop.kind === SyntaxKind.PropertyAssignment)
36
+ const matchingProperties: ObjectLiteralElement[] = (
37
+ node as ObjectLiteralExpression
38
+ ).properties
39
+ .filter((prop) => prop.kind === SyntaxKind.PropertyAssignment)
37
40
  .filter((prop: PropertyAssignment) => {
38
41
  const name = prop.name;
39
42
  switch (name.kind) {
@@ -78,20 +81,20 @@ export class MetadataManager {
78
81
  }
79
82
  }
80
83
 
81
- private getDecoratorMetadata(source: SourceFile, identifier: string): Node[] {
84
+ private getDecoratorMetadata(source: SourceFile): Node[] {
82
85
  return this.getSourceNodes(source)
83
86
  .filter(
84
- node =>
87
+ (node) =>
85
88
  node.kind === SyntaxKind.Decorator &&
86
89
  (node as Decorator).expression.kind === SyntaxKind.CallExpression,
87
90
  )
88
- .map(node => (node as Decorator).expression as CallExpression)
91
+ .map((node) => (node as Decorator).expression as CallExpression)
89
92
  .filter(
90
- expr =>
93
+ (expr) =>
91
94
  expr.arguments[0] &&
92
95
  expr.arguments[0].kind === SyntaxKind.ObjectLiteralExpression,
93
96
  )
94
- .map(expr => expr.arguments[0] as ObjectLiteralExpression);
97
+ .map((expr) => expr.arguments[0] as ObjectLiteralExpression);
95
98
  }
96
99
 
97
100
  private getSourceNodes(sourceFile: SourceFile): Node[] {
@@ -165,8 +168,8 @@ export class MetadataManager {
165
168
  node = arrLiteral.elements;
166
169
  }
167
170
  if (Array.isArray(node)) {
168
- const nodeArray = (node as {}) as Node[];
169
- const symbolsArray = nodeArray.map(childNode =>
171
+ const nodeArray = node as never as Node[];
172
+ const symbolsArray = nodeArray.map((childNode) =>
170
173
  childNode.getText(source),
171
174
  );
172
175
  if (symbolsArray.includes(symbol)) {
@@ -15,10 +15,10 @@ class ModuleImportDeclarator {
15
15
  return importLines.join('\n').concat(otherLines.join('\n'));
16
16
  }
17
17
  findImports(content) {
18
- return content.split('\n').filter(line => line.match(/import {/));
18
+ return content.split('\n').filter((line) => line.match(/import {/));
19
19
  }
20
20
  findOtherLines(content, importLines) {
21
- return content.split('\n').filter(line => importLines.indexOf(line) < 0);
21
+ return content.split('\n').filter((line) => importLines.indexOf(line) < 0);
22
22
  }
23
23
  buildLineToInsert(options) {
24
24
  return `import { ${options.symbol} } from '${this.computeRelativePath(options)}';\n`;
@@ -26,10 +26,10 @@ class ModuleImportDeclarator {
26
26
  computeRelativePath(options) {
27
27
  let importModulePath;
28
28
  if (options.type !== undefined) {
29
- importModulePath = core_1.normalize(`/${options.path}/${options.name}.${options.type}`);
29
+ importModulePath = (0, core_1.normalize)(`/${options.path}/${options.name}.${options.type}`);
30
30
  }
31
31
  else {
32
- importModulePath = core_1.normalize(`/${options.path}/${options.name}`);
32
+ importModulePath = (0, core_1.normalize)(`/${options.path}/${options.name}`);
33
33
  }
34
34
  return this.solver.relative(options.module, importModulePath);
35
35
  }
@@ -1,4 +1,5 @@
1
1
  import { normalize, Path } from '@angular-devkit/core';
2
+
2
3
  import { DeclarationOptions } from './module.declarator';
3
4
  import { PathSolver } from './path.solver';
4
5
 
@@ -14,11 +15,11 @@ export class ModuleImportDeclarator {
14
15
  }
15
16
 
16
17
  private findImports(content: string): string[] {
17
- return content.split('\n').filter(line => line.match(/import {/));
18
+ return content.split('\n').filter((line) => line.match(/import {/));
18
19
  }
19
20
 
20
21
  private findOtherLines(content: string, importLines: string[]) {
21
- return content.split('\n').filter(line => importLines.indexOf(line) < 0);
22
+ return content.split('\n').filter((line) => importLines.indexOf(line) < 0);
22
23
  }
23
24
 
24
25
  private buildLineToInsert(options: DeclarationOptions): string {
@@ -18,10 +18,10 @@ class ModuleDeclarator {
18
18
  computeSymbol(options) {
19
19
  const target = Object.assign({}, options);
20
20
  if (options.type !== undefined) {
21
- target.symbol = strings_1.classify(options.name).concat(strings_1.capitalize(options.type));
21
+ target.symbol = (0, strings_1.classify)(options.name).concat((0, strings_1.capitalize)(options.type));
22
22
  }
23
23
  else {
24
- target.symbol = strings_1.classify(options.name);
24
+ target.symbol = (0, strings_1.classify)(options.name);
25
25
  }
26
26
  return target;
27
27
  }
@@ -1,5 +1,6 @@
1
1
  import { Path } from '@angular-devkit/core';
2
2
  import { capitalize, classify } from '@angular-devkit/core/src/utils/strings';
3
+
3
4
  import { ModuleImportDeclarator } from './module-import.declarator';
4
5
  import { ModuleMetadataDeclarator } from './module-metadata.declarator';
5
6
 
@@ -12,6 +13,7 @@ export interface DeclarationOptions {
12
13
  symbol?: string;
13
14
  staticOptions?: {
14
15
  name: string;
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
17
  value: Record<string, any>;
16
18
  };
17
19
  }
@@ -15,9 +15,9 @@ class ModuleFinder {
15
15
  if (!directory) {
16
16
  return null;
17
17
  }
18
- const moduleFilename = directory.subfiles.find(filename => /\.module\.(t|j)s/.test(filename));
18
+ const moduleFilename = directory.subfiles.find((filename) => /\.module\.(t|j)s/.test(filename));
19
19
  return moduleFilename !== undefined
20
- ? core_1.join(directory.path, moduleFilename.valueOf())
20
+ ? (0, core_1.join)(directory.path, moduleFilename.valueOf())
21
21
  : this.findIn(directory.parent);
22
22
  }
23
23
  }
@@ -22,7 +22,7 @@ export class ModuleFinder {
22
22
  if (!directory) {
23
23
  return null;
24
24
  }
25
- const moduleFilename: PathFragment = directory.subfiles.find(filename =>
25
+ const moduleFilename: PathFragment = directory.subfiles.find((filename) =>
26
26
  /\.module\.(t|j)s/.test(filename),
27
27
  );
28
28
  return moduleFilename !== undefined
@@ -5,15 +5,13 @@ const core_1 = require("@angular-devkit/core");
5
5
  class NameParser {
6
6
  constructor() { }
7
7
  parse(options) {
8
- const nameWithoutPath = core_1.basename(options.name);
9
- const namePath = core_1.dirname((options.path === undefined
10
- ? ''
11
- : options.path)
8
+ const nameWithoutPath = (0, core_1.basename)(options.name);
9
+ const namePath = (0, core_1.dirname)((options.path === undefined ? '' : options.path)
12
10
  .concat('/')
13
11
  .concat(options.name));
14
12
  return {
15
13
  name: nameWithoutPath,
16
- path: core_1.normalize('/'.concat(namePath)),
14
+ path: (0, core_1.normalize)('/'.concat(namePath)),
17
15
  };
18
16
  }
19
17
  }
@@ -15,12 +15,11 @@ export class NameParser {
15
15
 
16
16
  public parse(options: ParseOptions): Location {
17
17
  const nameWithoutPath: string = basename(options.name as Path);
18
- const namePath: string = dirname((options.path === undefined
19
- ? ''
20
- : options.path
21
- )
22
- .concat('/')
23
- .concat(options.name) as Path);
18
+ const namePath: string = dirname(
19
+ (options.path === undefined ? '' : options.path)
20
+ .concat('/')
21
+ .concat(options.name) as Path,
22
+ );
24
23
  return {
25
24
  name: nameWithoutPath,
26
25
  path: normalize('/'.concat(namePath)),
@@ -6,10 +6,8 @@ class PathSolver {
6
6
  constructor() { }
7
7
  relative(from, to) {
8
8
  const placeholder = '/placeholder';
9
- const relativeDir = core_1.relative(core_1.dirname((placeholder + from)), core_1.dirname((placeholder + to)));
10
- return (relativeDir.startsWith('.')
11
- ? relativeDir
12
- : './' + relativeDir).concat(relativeDir.length === 0 ? core_1.basename(to) : '/' + core_1.basename(to));
9
+ const relativeDir = (0, core_1.relative)((0, core_1.dirname)((placeholder + from)), (0, core_1.dirname)((placeholder + to)));
10
+ return (relativeDir.startsWith('.') ? relativeDir : './' + relativeDir).concat(relativeDir.length === 0 ? (0, core_1.basename)(to) : '/' + (0, core_1.basename)(to));
13
11
  }
14
12
  }
15
13
  exports.PathSolver = PathSolver;
@@ -9,9 +9,8 @@ export class PathSolver {
9
9
  dirname((placeholder + from) as Path),
10
10
  dirname((placeholder + to) as Path),
11
11
  );
12
- return (relativeDir.startsWith('.')
13
- ? relativeDir
14
- : './' + relativeDir
12
+ return (
13
+ relativeDir.startsWith('.') ? relativeDir : './' + relativeDir
15
14
  ).concat(relativeDir.length === 0 ? basename(to) : '/' + basename(to));
16
15
  }
17
16
  }
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeSourceRoot = exports.isInRootDirectory = void 0;
3
+ exports.isInRootDirectory = isInRootDirectory;
4
+ exports.mergeSourceRoot = mergeSourceRoot;
5
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
6
  const core_1 = require("@angular-devkit/core");
5
7
  const defaults_1 = require("../lib/defaults");
6
8
  function isInRootDirectory(host, extraFiles = []) {
7
9
  const files = ['nest-cli.json', 'nest.json'].concat(extraFiles || []);
8
- return files.map(file => host.exists(file)).some(isPresent => isPresent);
10
+ return files.map((file) => host.exists(file)).some((isPresent) => isPresent);
9
11
  }
10
- exports.isInRootDirectory = isInRootDirectory;
11
12
  function mergeSourceRoot(options) {
12
13
  return (host) => {
13
14
  const isInRoot = isInRootDirectory(host, ['tsconfig.json', 'package.json']);
@@ -17,9 +18,8 @@ function mergeSourceRoot(options) {
17
18
  const defaultSourceRoot = options.sourceRoot !== undefined ? options.sourceRoot : defaults_1.DEFAULT_PATH_NAME;
18
19
  options.path =
19
20
  options.path !== undefined
20
- ? core_1.join(core_1.normalize(defaultSourceRoot), options.path)
21
- : core_1.normalize(defaultSourceRoot);
21
+ ? (0, core_1.join)((0, core_1.normalize)(defaultSourceRoot), options.path)
22
+ : (0, core_1.normalize)(defaultSourceRoot);
22
23
  return host;
23
24
  };
24
25
  }
25
- exports.mergeSourceRoot = mergeSourceRoot;
@@ -1,5 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
2
  import { join, normalize } from '@angular-devkit/core';
2
3
  import { Rule, Tree } from '@angular-devkit/schematics';
4
+
3
5
  import { DEFAULT_PATH_NAME } from '../lib/defaults';
4
6
 
5
7
  export function isInRootDirectory(
@@ -7,11 +9,11 @@ export function isInRootDirectory(
7
9
  extraFiles: string[] = [],
8
10
  ): boolean {
9
11
  const files = ['nest-cli.json', 'nest.json'].concat(extraFiles || []);
10
- return files.map(file => host.exists(file)).some(isPresent => isPresent);
12
+ return files.map((file) => host.exists(file)).some((isPresent) => isPresent);
11
13
  }
12
14
 
13
15
  export function mergeSourceRoot<
14
- T extends { sourceRoot?: string; path?: string } = any
16
+ T extends { sourceRoot?: string; path?: string } = any,
15
17
  >(options: T): Rule {
16
18
  return (host: Tree) => {
17
19
  const isInRoot = isInRootDirectory(host, ['tsconfig.json', 'package.json']);
@@ -0,0 +1,38 @@
1
+ import { defineConfig, globalIgnores } from 'eslint/config';
2
+ import tsParser from '@typescript-eslint/parser';
3
+ import tsPlugin from '@typescript-eslint/eslint-plugin';
4
+ import prettierPlugin from 'eslint-plugin-prettier';
5
+ import simpleImportSort from 'eslint-plugin-simple-import-sort';
6
+ import prettierConfig from 'eslint-config-prettier';
7
+
8
+ export default defineConfig([
9
+ globalIgnores(["dist/*", './src/**']),
10
+ {
11
+ files: ['./src/**/*.ts', './src/**/*.tsx'],
12
+ languageOptions: {
13
+ parser: tsParser,
14
+ ecmaVersion: 2018,
15
+ sourceType: 'module',
16
+ },
17
+ plugins: {
18
+ '@typescript-eslint': tsPlugin,
19
+ prettier: prettierPlugin,
20
+ 'simple-import-sort': simpleImportSort, // ✅ MUST MATCH RULE PREFIX
21
+ },
22
+ rules: {
23
+ ...tsPlugin.configs.recommended.rules,
24
+ ...prettierConfig.rules,
25
+
26
+ '@typescript-eslint/explicit-function-return-type': 'off',
27
+ '@typescript-eslint/camelcase': 'off',
28
+ '@typescript-eslint/interface-name-prefix': 'off',
29
+
30
+ 'simple-import-sort/imports': 'error',
31
+ 'simple-import-sort/exports': 'error',
32
+ 'sort-imports': 'off',
33
+ 'import/order': 'off',
34
+
35
+ 'prettier/prettier': 'error',
36
+ },
37
+ },
38
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gapi/schematics",
3
- "version": "1.8.168",
3
+ "version": "1.8.170",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Stradivario/gapi/packages/schematics"
@@ -40,6 +40,6 @@
40
40
  "ts-morph": "^1.3.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@types/node": "^13.11.1"
43
+ "@types/node": "^25.0.3"
44
44
  }
45
45
  }
@@ -1,5 +1,9 @@
1
- import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
1
+ import {
2
+ SchematicTestRunner,
3
+ UnitTestTree,
4
+ } from '@angular-devkit/schematics/testing';
2
5
  import * as path from 'path';
6
+
3
7
  import { ApplicationOptions } from './application.schema';
4
8
 
5
9
  describe('Application Factory', () => {
@@ -9,6 +9,7 @@ import {
9
9
  template,
10
10
  url,
11
11
  } from '@angular-devkit/schematics';
12
+
12
13
  import {
13
14
  DEFAULT_AUTHOR,
14
15
  DEFAULT_DESCRIPTION,
@@ -1,4 +1,5 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
+
2
3
  import { AppController } from './app.controller';
3
4
  import { AppService } from './app.service';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { Controller, Get } from '@nestjs/common';
2
+
2
3
  import { AppService } from './app.service';
3
4
 
4
5
  @Controller()
@@ -1,4 +1,5 @@
1
1
  import { Module } from '@nestjs/common';
2
+
2
3
  import { AppController } from './app.controller';
3
4
  import { AppService } from './app.service';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { NestFactory } from '@nestjs/core';
2
+
2
3
  import { AppModule } from './app.module';
3
4
 
4
5
  async function bootstrap() {
@@ -1,5 +1,6 @@
1
1
  import { Test, TestingModule } from '@nestjs/testing';
2
2
  import * as request from 'supertest';
3
+
3
4
  import { AppModule } from './../src/app.module';
4
5
 
5
6
  describe('AppController (e2e)', () => {
@@ -3,6 +3,7 @@ import {
3
3
  UnitTestTree,
4
4
  } from '@angular-devkit/schematics/testing';
5
5
  import * as path from 'path';
6
+
6
7
  import { ClassOptions } from './class.schema';
7
8
 
8
9
  describe('Class Factory', () => {
@@ -19,7 +20,9 @@ describe('Class Factory', () => {
19
20
  const tree: UnitTestTree = runner.runSchematic('class', options);
20
21
  const files: string[] = tree.files;
21
22
 
22
- expect(files.find(filename => filename === '/foo.ts')).not.toBeUndefined();
23
+ expect(
24
+ files.find((filename) => filename === '/foo.ts'),
25
+ ).not.toBeUndefined();
23
26
  expect(tree.readContent('/foo.ts')).toEqual('export class Foo {}\n');
24
27
  });
25
28
  it('should manage name as a path', () => {
@@ -31,7 +34,7 @@ describe('Class Factory', () => {
31
34
  const tree: UnitTestTree = runner.runSchematic('class', options);
32
35
  const files: string[] = tree.files;
33
36
  expect(
34
- files.find(filename => filename === '/bar/foo/foo.ts'),
37
+ files.find((filename) => filename === '/bar/foo/foo.ts'),
35
38
  ).not.toBeUndefined();
36
39
  expect(tree.readContent('/bar/foo/foo.ts')).toEqual(
37
40
  'export class Foo {}\n',
@@ -47,7 +50,7 @@ describe('Class Factory', () => {
47
50
  const tree: UnitTestTree = runner.runSchematic('class', options);
48
51
  const files: string[] = tree.files;
49
52
  expect(
50
- files.find(filename => filename === '/baz/foo/foo.ts'),
53
+ files.find((filename) => filename === '/baz/foo/foo.ts'),
51
54
  ).not.toBeUndefined();
52
55
  expect(tree.readContent('/baz/foo/foo.ts')).toEqual(
53
56
  'export class Foo {}\n',
@@ -62,7 +65,7 @@ describe('Class Factory', () => {
62
65
  const tree: UnitTestTree = runner.runSchematic('class', options);
63
66
  const files: string[] = tree.files;
64
67
  expect(
65
- files.find(filename => filename === '/foo-bar/foo-bar.ts'),
68
+ files.find((filename) => filename === '/foo-bar/foo-bar.ts'),
66
69
  ).not.toBeUndefined();
67
70
  expect(tree.readContent('/foo-bar/foo-bar.ts')).toEqual(
68
71
  'export class FooBar {}\n',
@@ -77,7 +80,7 @@ describe('Class Factory', () => {
77
80
  const tree: UnitTestTree = runner.runSchematic('class', options);
78
81
  const files: string[] = tree.files;
79
82
  expect(
80
- files.find(filename => filename === '/bar-baz/foo/foo.ts'),
83
+ files.find((filename) => filename === '/bar-baz/foo/foo.ts'),
81
84
  ).not.toBeUndefined();
82
85
  expect(tree.readContent('/bar-baz/foo/foo.ts')).toEqual(
83
86
  'export class Foo {}\n',
@@ -93,7 +96,7 @@ describe('Class Factory', () => {
93
96
  const tree: UnitTestTree = runner.runSchematic('class', options);
94
97
  const files: string[] = tree.files;
95
98
  expect(
96
- files.find(filename => filename === '/foo/foo.js'),
99
+ files.find((filename) => filename === '/foo/foo.js'),
97
100
  ).not.toBeUndefined();
98
101
  expect(tree.readContent('/foo/foo.js')).toEqual('export class Foo {}\n');
99
102
  });
@@ -13,6 +13,7 @@ import {
13
13
  template,
14
14
  url,
15
15
  } from '@angular-devkit/schematics';
16
+
16
17
  import { Location, NameParser } from '../../utils/name.parser';
17
18
  import { mergeSourceRoot } from '../../utils/source-root.helpers';
18
19
  import { DEFAULT_LANGUAGE } from '../defaults';
@@ -44,7 +45,7 @@ function transform(options: ClassOptions): ClassOptions {
44
45
  function generate(options: ClassOptions): Source {
45
46
  return (context: SchematicContext) =>
46
47
  apply(url(join('./files' as Path, options.language)), [
47
- options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
48
+ options.spec ? noop() : filter((path) => !path.endsWith('.spec.ts')),
48
49
  template({
49
50
  ...strings,
50
51
  ...options,
@@ -16,6 +16,7 @@ import {
16
16
  import { join } from 'path';
17
17
  import * as ts from 'ts-morph';
18
18
  import { Path } from 'typescript';
19
+
19
20
  import {
20
21
  DeclarationOptions,
21
22
  ModuleDeclarator,
@@ -88,7 +89,7 @@ function addDeclarationToModule(options: AngularOptions): Rule {
88
89
  const declarator: ModuleDeclarator = new ModuleDeclarator();
89
90
 
90
91
  const rootPath = `${options.directory}/dist/${options.directory}`;
91
- const declarationOptions = ({
92
+ const declarationOptions = {
92
93
  ...options,
93
94
  staticOptions: {
94
95
  name: 'forRoot',
@@ -96,7 +97,7 @@ function addDeclarationToModule(options: AngularOptions): Rule {
96
97
  rootPath,
97
98
  },
98
99
  },
99
- } as unknown) as DeclarationOptions;
100
+ } as unknown as DeclarationOptions;
100
101
  tree.overwrite(
101
102
  options.module,
102
103
  declarator.declare(content, declarationOptions),
@@ -119,10 +120,10 @@ function addGlobalPrefix(): Rule {
119
120
  });
120
121
  const tsFile = tsProject.addExistingSourceFile(mainFilePath);
121
122
  const bootstrapFunction = tsFile.getFunction('bootstrap');
122
- const listenStatement = bootstrapFunction.getStatement(node =>
123
+ const listenStatement = bootstrapFunction.getStatement((node) =>
123
124
  node.getText().includes('listen'),
124
125
  );
125
- const setPrefixStatement = bootstrapFunction.getStatement(node =>
126
+ const setPrefixStatement = bootstrapFunction.getStatement((node) =>
126
127
  node.getText().includes('setGlobalPrefix'),
127
128
  );
128
129
  if (!listenStatement || setPrefixStatement) {
@@ -1,5 +1,6 @@
1
1
  import { DynamicModule, Inject, Module, OnModuleInit } from '@nestjs/common';
2
2
  import { HttpAdapterHost } from '@nestjs/core';
3
+
3
4
  import {
4
5
  ANGULAR_MODULE_OPTIONS,
5
6
  DEFAULT_RENDER_PATH,
@@ -1,5 +1,6 @@
1
1
  import { Provider } from '@nestjs/common';
2
2
  import { HttpAdapterHost } from '@nestjs/core';
3
+
3
4
  import { AbstractLoader } from './loaders/abstract.loader';
4
5
  import { ExpressLoader } from './loaders/express.loader';
5
6
  import { FastifyLoader } from './loaders/fastify.loader';
@@ -1,6 +1,7 @@
1
1
  import { Injectable } from '@nestjs/common';
2
2
  import { AbstractHttpAdapter } from '@nestjs/core';
3
3
  import { join } from 'path';
4
+
4
5
  import { AngularModuleOptions } from '../interfaces/angular-options.interface';
5
6
 
6
7
  @Injectable()
@@ -1,5 +1,6 @@
1
1
  import { Injectable } from '@nestjs/common';
2
2
  import { AbstractHttpAdapter } from '@nestjs/core';
3
+
3
4
  import { loadPackage } from '../angular.utils';
4
5
  import { AngularModuleOptions } from '../interfaces/angular-options.interface';
5
6
  import { AbstractLoader } from './abstract.loader';
@@ -1,6 +1,7 @@
1
1
  import { Injectable } from '@nestjs/common';
2
2
  import { AbstractHttpAdapter } from '@nestjs/core';
3
3
  import * as fs from 'fs';
4
+
4
5
  import { loadPackage } from '../angular.utils';
5
6
  import { AngularModuleOptions } from '../interfaces/angular-options.interface';
6
7
  import { AbstractLoader } from './abstract.loader';
@@ -1,5 +1,6 @@
1
1
  import { Injectable } from '@nestjs/common';
2
2
  import { AbstractHttpAdapter } from '@nestjs/core';
3
+
3
4
  import { AngularModuleOptions } from '../interfaces/angular-options.interface';
4
5
  import { AbstractLoader } from './abstract.loader';
5
6