@nestjs/schematics 11.0.9 → 12.0.0-alpha.1

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 (101) 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/package.json +21 -49
  24. package/dist/index.d.ts +0 -2
  25. package/dist/index.js +0 -18
  26. package/dist/lib/application/application.factory.d.ts +0 -3
  27. package/dist/lib/application/application.factory.js +0 -63
  28. package/dist/lib/class/class.factory.d.ts +0 -3
  29. package/dist/lib/class/class.factory.js +0 -51
  30. package/dist/lib/client-app/angular/angular.factory.d.ts +0 -3
  31. package/dist/lib/client-app/angular/angular.factory.js +0 -103
  32. package/dist/lib/configuration/configuration.factory.d.ts +0 -3
  33. package/dist/lib/configuration/configuration.factory.js +0 -27
  34. package/dist/lib/controller/controller.factory.d.ts +0 -3
  35. package/dist/lib/controller/controller.factory.js +0 -72
  36. package/dist/lib/decorator/decorator.factory.d.ts +0 -3
  37. package/dist/lib/decorator/decorator.factory.js +0 -35
  38. package/dist/lib/defaults.d.ts +0 -14
  39. package/dist/lib/defaults.js +0 -17
  40. package/dist/lib/filter/filter.factory.d.ts +0 -3
  41. package/dist/lib/filter/filter.factory.js +0 -43
  42. package/dist/lib/gateway/gateway.factory.d.ts +0 -3
  43. package/dist/lib/gateway/gateway.factory.js +0 -72
  44. package/dist/lib/guard/guard.factory.d.ts +0 -3
  45. package/dist/lib/guard/guard.factory.js +0 -43
  46. package/dist/lib/interceptor/interceptor.factory.d.ts +0 -3
  47. package/dist/lib/interceptor/interceptor.factory.js +0 -44
  48. package/dist/lib/interface/interface.factory.d.ts +0 -3
  49. package/dist/lib/interface/interface.factory.js +0 -34
  50. package/dist/lib/library/library.factory.d.ts +0 -3
  51. package/dist/lib/library/library.factory.js +0 -216
  52. package/dist/lib/middleware/middleware.factory.d.ts +0 -3
  53. package/dist/lib/middleware/middleware.factory.js +0 -43
  54. package/dist/lib/module/module.factory.d.ts +0 -3
  55. package/dist/lib/module/module.factory.js +0 -60
  56. package/dist/lib/pipe/pipe.factory.d.ts +0 -3
  57. package/dist/lib/pipe/pipe.factory.js +0 -44
  58. package/dist/lib/provider/provider.factory.d.ts +0 -3
  59. package/dist/lib/provider/provider.factory.js +0 -76
  60. package/dist/lib/readers/file-system.reader.d.ts +0 -10
  61. package/dist/lib/readers/file-system.reader.js +0 -45
  62. package/dist/lib/readers/index.d.ts +0 -2
  63. package/dist/lib/readers/index.js +0 -18
  64. package/dist/lib/readers/reader.d.ts +0 -7
  65. package/dist/lib/readers/reader.js +0 -2
  66. package/dist/lib/resolver/resolver.factory.d.ts +0 -3
  67. package/dist/lib/resolver/resolver.factory.js +0 -71
  68. package/dist/lib/resource/resource.factory.d.ts +0 -3
  69. package/dist/lib/resource/resource.factory.js +0 -145
  70. package/dist/lib/service/service.factory.d.ts +0 -3
  71. package/dist/lib/service/service.factory.js +0 -74
  72. package/dist/lib/sub-app/sub-app.factory.d.ts +0 -3
  73. package/dist/lib/sub-app/sub-app.factory.js +0 -271
  74. package/dist/utils/dependencies.utils.d.ts +0 -15
  75. package/dist/utils/dependencies.utils.js +0 -42
  76. package/dist/utils/formatting.d.ts +0 -1
  77. package/dist/utils/formatting.js +0 -12
  78. package/dist/utils/index.d.ts +0 -11
  79. package/dist/utils/index.js +0 -27
  80. package/dist/utils/jest-module-mapper.d.ts +0 -1
  81. package/dist/utils/jest-module-mapper.js +0 -9
  82. package/dist/utils/json-file.util.d.ts +0 -15
  83. package/dist/utils/json-file.util.js +0 -72
  84. package/dist/utils/metadata.manager.d.ts +0 -13
  85. package/dist/utils/metadata.manager.js +0 -175
  86. package/dist/utils/module-import.declarator.d.ts +0 -10
  87. package/dist/utils/module-import.declarator.js +0 -40
  88. package/dist/utils/module-metadata.declarator.d.ts +0 -4
  89. package/dist/utils/module-metadata.declarator.js +0 -12
  90. package/dist/utils/module.declarator.d.ts +0 -23
  91. package/dist/utils/module.declarator.js +0 -34
  92. package/dist/utils/module.finder.d.ts +0 -13
  93. package/dist/utils/module.finder.js +0 -25
  94. package/dist/utils/name.parser.d.ts +0 -12
  95. package/dist/utils/name.parser.js +0 -17
  96. package/dist/utils/object-sorting.d.ts +0 -1
  97. package/dist/utils/object-sorting.js +0 -13
  98. package/dist/utils/path.solver.d.ts +0 -4
  99. package/dist/utils/path.solver.js +0 -12
  100. package/dist/utils/source-root.helpers.d.ts +0 -6
  101. package/dist/utils/source-root.helpers.js +0 -24
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = main;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const path_1 = require("path");
7
- const formatting_1 = require("../../utils/formatting");
8
- const defaults_1 = require("../defaults");
9
- function main(options) {
10
- options.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.name.toString());
11
- const path = !options.directory || options.directory === 'undefined'
12
- ? options.name
13
- : options.directory;
14
- options = transform(options);
15
- return (0, schematics_1.mergeWith)(generate(options, path));
16
- }
17
- function transform(options) {
18
- const target = Object.assign({}, options);
19
- target.author = target.author ? target.author : defaults_1.DEFAULT_AUTHOR;
20
- target.description = target.description
21
- ? target.description
22
- : defaults_1.DEFAULT_DESCRIPTION;
23
- target.language = target.language ? target.language : defaults_1.DEFAULT_LANGUAGE;
24
- target.name = resolvePackageName(target.name.toString());
25
- target.version = target.version ? target.version : defaults_1.DEFAULT_VERSION;
26
- target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
27
- target.packageManager =
28
- !target.packageManager || target.packageManager === 'undefined'
29
- ? 'npm'
30
- : target.packageManager;
31
- target.dependencies = target.dependencies ? target.dependencies : '';
32
- target.devDependencies = target.devDependencies ? target.devDependencies : '';
33
- return target;
34
- }
35
- function resolvePackageName(path) {
36
- const { base: baseFilename, dir: dirname } = (0, path_1.parse)(path);
37
- if (baseFilename === '.') {
38
- return (0, path_1.basename)(process.cwd());
39
- }
40
- if (dirname.match(/^@[^\s]/)) {
41
- return `${dirname}/${baseFilename}`;
42
- }
43
- return baseFilename;
44
- }
45
- function generate(options, path) {
46
- return (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
47
- options.spec
48
- ? (0, schematics_1.noop)()
49
- : (0, schematics_1.filter)((path) => !path.endsWith('__specFileSuffix__.ts')),
50
- options.spec
51
- ? (0, schematics_1.noop)()
52
- : (0, schematics_1.filter)((path) => {
53
- const languageExtension = options.language || 'ts';
54
- const suffix = `__specFileSuffix__.${languageExtension}`;
55
- return !path.endsWith(suffix);
56
- }),
57
- (0, schematics_1.template)({
58
- ...core_1.strings,
59
- ...options,
60
- }),
61
- (0, schematics_1.move)(path),
62
- ]);
63
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { ClassOptions } from './class.schema';
3
- export declare function main(options: ClassOptions): Rule;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = main;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const formatting_1 = require("../../utils/formatting");
7
- const name_parser_1 = require("../../utils/name.parser");
8
- const source_root_helpers_1 = require("../../utils/source-root.helpers");
9
- const defaults_1 = require("../defaults");
10
- function main(options) {
11
- options = transform(options);
12
- return (0, schematics_1.chain)([(0, source_root_helpers_1.mergeSourceRoot)(options), (0, schematics_1.mergeWith)(generate(options))]);
13
- }
14
- function transform(options) {
15
- const target = Object.assign({}, options);
16
- if (!target.name) {
17
- throw new schematics_1.SchematicsException('Option (name) is required.');
18
- }
19
- const location = new name_parser_1.NameParser().parse(target);
20
- target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
21
- target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
22
- if (target.name.includes('.')) {
23
- target.className = core_1.strings.classify(target.name).replace('.', '');
24
- }
25
- else {
26
- target.className = target.name;
27
- }
28
- target.language =
29
- target.language !== undefined ? target.language : defaults_1.DEFAULT_LANGUAGE;
30
- target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
31
- target.path = target.flat
32
- ? target.path
33
- : (0, core_1.join)(target.path, target.name);
34
- return target;
35
- }
36
- function generate(options) {
37
- return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
38
- options.spec
39
- ? (0, schematics_1.noop)()
40
- : (0, schematics_1.filter)((path) => {
41
- const languageExtension = options.language || 'ts';
42
- const suffix = `.__specFileSuffix__.${languageExtension}`;
43
- return !path.endsWith(suffix);
44
- }),
45
- (0, schematics_1.template)({
46
- ...core_1.strings,
47
- ...options,
48
- }),
49
- (0, schematics_1.move)(options.path),
50
- ])(context);
51
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { AngularOptions } from './angular.schema';
3
- export declare function main(options: AngularOptions): Rule;
@@ -1,103 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = main;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const path_1 = require("path");
7
- const module_declarator_1 = require("../../../utils/module.declarator");
8
- const module_finder_1 = require("../../../utils/module.finder");
9
- const name_parser_1 = require("../../../utils/name.parser");
10
- const source_root_helpers_1 = require("../../../utils/source-root.helpers");
11
- function main(options) {
12
- options = transform(options);
13
- return (tree, context) => {
14
- return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
15
- createAngularApplication(options),
16
- (0, source_root_helpers_1.mergeSourceRoot)(options),
17
- addDeclarationToModule(options),
18
- addGlobalPrefix(),
19
- (0, schematics_1.mergeWith)(generate(options)),
20
- ]))(tree, context);
21
- };
22
- }
23
- function transform(source) {
24
- const target = Object.assign({}, source);
25
- target.directory = target.name ? core_1.strings.dasherize(target.name) : 'client';
26
- target.name = 'Angular';
27
- target.metadata = 'imports';
28
- target.type = 'module';
29
- const location = new name_parser_1.NameParser().parse(target);
30
- target.name = core_1.strings.dasherize(location.name);
31
- target.path = (0, path_1.join)(core_1.strings.dasherize(location.path), target.name);
32
- return target;
33
- }
34
- function generate(options) {
35
- return (context) => (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
36
- (0, schematics_1.template)({
37
- ...core_1.strings,
38
- ...options,
39
- }),
40
- (0, schematics_1.move)(options.path),
41
- ])(context);
42
- }
43
- function createAngularApplication(options) {
44
- if (!options.initApp) {
45
- return (0, schematics_1.noop)();
46
- }
47
- return (0, schematics_1.externalSchematic)('@schematics/angular', 'ng-new', {
48
- name: options.directory,
49
- version: '8.0.0',
50
- });
51
- }
52
- function addDeclarationToModule(options) {
53
- return (tree) => {
54
- options.module = new module_finder_1.ModuleFinder(tree).find({
55
- name: options.name,
56
- path: options.path,
57
- });
58
- if (!options.module) {
59
- return tree;
60
- }
61
- const content = tree.read(options.module).toString();
62
- const declarator = new module_declarator_1.ModuleDeclarator();
63
- const rootPath = `${options.directory}/dist/${options.directory}`;
64
- const staticOptions = {
65
- name: 'forRoot',
66
- value: {
67
- rootPath,
68
- },
69
- };
70
- const declarationOptions = {
71
- ...options,
72
- staticOptions,
73
- };
74
- tree.overwrite(options.module, declarator.declare(content, declarationOptions));
75
- return tree;
76
- };
77
- }
78
- function addGlobalPrefix() {
79
- return (tree) => {
80
- const mainFilePath = 'src/main.ts';
81
- const fileRef = tree.get(mainFilePath);
82
- if (!fileRef) {
83
- return tree;
84
- }
85
- const ts = require('ts-morph');
86
- const tsProject = new ts.Project({
87
- manipulationSettings: {
88
- indentationText: ts.IndentationText.TwoSpaces,
89
- },
90
- });
91
- const tsFile = tsProject.addSourceFileAtPath(mainFilePath);
92
- const bootstrapFunction = tsFile.getFunction('bootstrap');
93
- const listenStatement = bootstrapFunction.getStatement((node) => node.getText().includes('listen'));
94
- const setPrefixStatement = bootstrapFunction.getStatement((node) => node.getText().includes('setGlobalPrefix'));
95
- if (!listenStatement || setPrefixStatement) {
96
- return tree;
97
- }
98
- const listenExprIndex = listenStatement.getChildIndex();
99
- bootstrapFunction.insertStatements(listenExprIndex, `app.setGlobalPrefix('api');`);
100
- tree.overwrite(mainFilePath, tsFile.getFullText());
101
- return tree;
102
- };
103
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { ConfigurationOptions } from './configuration.schema';
3
- export declare function main(options: ConfigurationOptions): Rule;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = main;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const defaults_1 = require("../defaults");
7
- function main(options) {
8
- return (0, schematics_1.mergeWith)(generate(transform(options)));
9
- }
10
- function transform(options) {
11
- const target = Object.assign({}, options);
12
- target.language =
13
- target.language !== undefined ? target.language : defaults_1.DEFAULT_LANGUAGE;
14
- target.collection =
15
- target.collection !== undefined ? target.collection : '@nestjs/schematics';
16
- return target;
17
- }
18
- function generate(options) {
19
- const projectOrPath = options.project ?? '.';
20
- return (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
21
- (0, schematics_1.template)({
22
- ...core_1.strings,
23
- ...options,
24
- }),
25
- (0, schematics_1.move)(projectOrPath),
26
- ]);
27
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { ControllerOptions } from './controller.schema';
3
- export declare function main(options: ControllerOptions): Rule;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = main;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const formatting_1 = require("../../utils/formatting");
7
- const module_declarator_1 = require("../../utils/module.declarator");
8
- const module_finder_1 = require("../../utils/module.finder");
9
- const name_parser_1 = require("../../utils/name.parser");
10
- const source_root_helpers_1 = require("../../utils/source-root.helpers");
11
- const defaults_1 = require("../defaults");
12
- const ELEMENT_METADATA = 'controllers';
13
- const ELEMENT_TYPE = 'controller';
14
- function main(options) {
15
- options = transform(options);
16
- return (tree, context) => {
17
- return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
18
- (0, source_root_helpers_1.mergeSourceRoot)(options),
19
- (0, schematics_1.mergeWith)(generate(options)),
20
- addDeclarationToModule(options),
21
- ]))(tree, context);
22
- };
23
- }
24
- function transform(source) {
25
- const target = Object.assign({}, source);
26
- target.metadata = ELEMENT_METADATA;
27
- target.type = ELEMENT_TYPE;
28
- const location = new name_parser_1.NameParser().parse(target);
29
- target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
30
- target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
31
- target.language =
32
- target.language !== undefined ? target.language : defaults_1.DEFAULT_LANGUAGE;
33
- target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(source.specFileSuffix || 'spec');
34
- target.path = target.flat
35
- ? target.path
36
- : (0, core_1.join)(target.path, target.name);
37
- return target;
38
- }
39
- function generate(options) {
40
- return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
41
- options.spec
42
- ? (0, schematics_1.noop)()
43
- : (0, schematics_1.filter)((path) => {
44
- const languageExtension = options.language || 'ts';
45
- const suffix = `.__specFileSuffix__.${languageExtension}`;
46
- return !path.endsWith(suffix);
47
- }),
48
- (0, schematics_1.template)({
49
- ...core_1.strings,
50
- ...options,
51
- }),
52
- (0, schematics_1.move)(options.path),
53
- ])(context);
54
- }
55
- function addDeclarationToModule(options) {
56
- return (tree) => {
57
- if (options.skipImport !== undefined && options.skipImport) {
58
- return tree;
59
- }
60
- options.module = new module_finder_1.ModuleFinder(tree).find({
61
- name: options.name,
62
- path: options.path,
63
- });
64
- if (!options.module) {
65
- return tree;
66
- }
67
- const content = tree.read(options.module).toString();
68
- const declarator = new module_declarator_1.ModuleDeclarator();
69
- tree.overwrite(options.module, declarator.declare(content, options));
70
- return tree;
71
- };
72
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { DecoratorOptions } from './decorator.schema';
3
- export declare function main(options: DecoratorOptions): Rule;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = main;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const formatting_1 = require("../../utils/formatting");
7
- const name_parser_1 = require("../../utils/name.parser");
8
- const source_root_helpers_1 = require("../../utils/source-root.helpers");
9
- function main(options) {
10
- options = transform(options);
11
- return (0, schematics_1.chain)([(0, source_root_helpers_1.mergeSourceRoot)(options), (0, schematics_1.mergeWith)(generate(options))]);
12
- }
13
- function transform(options) {
14
- const target = Object.assign({}, options);
15
- if (!target.name) {
16
- throw new schematics_1.SchematicsException('Option (name) is required.');
17
- }
18
- const location = new name_parser_1.NameParser().parse(target);
19
- target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
20
- target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
21
- target.language = target.language !== undefined ? target.language : 'ts';
22
- target.path = target.flat
23
- ? target.path
24
- : (0, core_1.join)(target.path, target.name);
25
- return target;
26
- }
27
- function generate(options) {
28
- return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
29
- (0, schematics_1.template)({
30
- ...core_1.strings,
31
- ...options,
32
- }),
33
- (0, schematics_1.move)(options.path),
34
- ])(context);
35
- }
@@ -1,14 +0,0 @@
1
- export declare const DEFAULT_AUTHOR = "";
2
- export declare const DEFAULT_DESCRIPTION = "";
3
- export declare const DEFAULT_LANGUAGE = "ts";
4
- export declare const DEFAULT_VERSION = "0.0.1";
5
- export declare const DEFAULT_PATH_NAME = "src";
6
- export declare const DEFAULT_LIB_PATH = "libs";
7
- export declare const DEFAULT_APPS_PATH = "apps";
8
- export declare const DEFAULT_APP_NAME = "app";
9
- export declare const DEFAULT_DIR_ENTRY_APP = "main";
10
- export declare const TEST_ENV = "test";
11
- export declare const PROJECT_TYPE: {
12
- LIBRARY: string;
13
- APPLICATION: string;
14
- };
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PROJECT_TYPE = exports.TEST_ENV = exports.DEFAULT_DIR_ENTRY_APP = exports.DEFAULT_APP_NAME = exports.DEFAULT_APPS_PATH = exports.DEFAULT_LIB_PATH = exports.DEFAULT_PATH_NAME = exports.DEFAULT_VERSION = exports.DEFAULT_LANGUAGE = exports.DEFAULT_DESCRIPTION = exports.DEFAULT_AUTHOR = void 0;
4
- exports.DEFAULT_AUTHOR = '';
5
- exports.DEFAULT_DESCRIPTION = '';
6
- exports.DEFAULT_LANGUAGE = 'ts';
7
- exports.DEFAULT_VERSION = '0.0.1';
8
- exports.DEFAULT_PATH_NAME = 'src';
9
- exports.DEFAULT_LIB_PATH = 'libs';
10
- exports.DEFAULT_APPS_PATH = 'apps';
11
- exports.DEFAULT_APP_NAME = 'app';
12
- exports.DEFAULT_DIR_ENTRY_APP = 'main';
13
- exports.TEST_ENV = 'test';
14
- exports.PROJECT_TYPE = {
15
- LIBRARY: 'library',
16
- APPLICATION: 'application',
17
- };
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { FilterOptions } from './filter.schema';
3
- export declare function main(options: FilterOptions): Rule;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = main;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const formatting_1 = require("../../utils/formatting");
7
- const name_parser_1 = require("../../utils/name.parser");
8
- const source_root_helpers_1 = require("../../utils/source-root.helpers");
9
- function main(options) {
10
- options = transform(options);
11
- return (0, schematics_1.chain)([(0, source_root_helpers_1.mergeSourceRoot)(options), (0, schematics_1.mergeWith)(generate(options))]);
12
- }
13
- function transform(options) {
14
- const target = Object.assign({}, options);
15
- if (!target.name) {
16
- throw new schematics_1.SchematicsException('Option (name) is required.');
17
- }
18
- const location = new name_parser_1.NameParser().parse(target);
19
- target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
20
- target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
21
- target.language = target.language !== undefined ? target.language : 'ts';
22
- target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
23
- target.path = target.flat
24
- ? target.path
25
- : (0, core_1.join)(target.path, target.name);
26
- return target;
27
- }
28
- function generate(options) {
29
- return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
30
- options.spec
31
- ? (0, schematics_1.noop)()
32
- : (0, schematics_1.filter)((path) => {
33
- const languageExtension = options.language || 'ts';
34
- const suffix = `.__specFileSuffix__.${languageExtension}`;
35
- return !path.endsWith(suffix);
36
- }),
37
- (0, schematics_1.template)({
38
- ...core_1.strings,
39
- ...options,
40
- }),
41
- (0, schematics_1.move)(options.path),
42
- ])(context);
43
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { GatewayOptions } from './gateway.schema';
3
- export declare function main(options: GatewayOptions): Rule;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = main;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const formatting_1 = require("../../utils/formatting");
7
- const module_declarator_1 = require("../../utils/module.declarator");
8
- const module_finder_1 = require("../../utils/module.finder");
9
- const name_parser_1 = require("../../utils/name.parser");
10
- const source_root_helpers_1 = require("../../utils/source-root.helpers");
11
- function main(options) {
12
- options = transform(options);
13
- return (tree, context) => {
14
- return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
15
- (0, source_root_helpers_1.mergeSourceRoot)(options),
16
- addDeclarationToModule(options),
17
- (0, schematics_1.mergeWith)(generate(options)),
18
- ]))(tree, context);
19
- };
20
- }
21
- function transform(options) {
22
- const target = Object.assign({}, options);
23
- if (!target.name) {
24
- throw new schematics_1.SchematicsException('Option (name) is required.');
25
- }
26
- target.metadata = 'providers';
27
- target.type = 'gateway';
28
- target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
29
- const location = new name_parser_1.NameParser().parse(target);
30
- target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
31
- target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
32
- target.language = target.language !== undefined ? target.language : 'ts';
33
- target.path = target.flat
34
- ? target.path
35
- : (0, core_1.join)(target.path, target.name);
36
- return target;
37
- }
38
- function generate(options) {
39
- return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
40
- options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
41
- options.spec
42
- ? (0, schematics_1.noop)()
43
- : (0, schematics_1.filter)((path) => {
44
- const languageExtension = options.language || 'ts';
45
- const suffix = `.__specFileSuffix__.${languageExtension}`;
46
- return !path.endsWith(suffix);
47
- }),
48
- (0, schematics_1.template)({
49
- ...core_1.strings,
50
- ...options,
51
- }),
52
- (0, schematics_1.move)(options.path),
53
- ])(context);
54
- }
55
- function addDeclarationToModule(options) {
56
- return (tree) => {
57
- if (options.skipImport !== undefined && options.skipImport) {
58
- return tree;
59
- }
60
- options.module = new module_finder_1.ModuleFinder(tree).find({
61
- name: options.name,
62
- path: options.path,
63
- });
64
- if (!options.module) {
65
- return tree;
66
- }
67
- const content = tree.read(options.module).toString();
68
- const declarator = new module_declarator_1.ModuleDeclarator();
69
- tree.overwrite(options.module, declarator.declare(content, options));
70
- return tree;
71
- };
72
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { GuardOptions } from './guard.schema';
3
- export declare function main(options: GuardOptions): Rule;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = main;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const formatting_1 = require("../../utils/formatting");
7
- const name_parser_1 = require("../../utils/name.parser");
8
- const source_root_helpers_1 = require("../../utils/source-root.helpers");
9
- function main(options) {
10
- options = transform(options);
11
- return (0, schematics_1.chain)([(0, source_root_helpers_1.mergeSourceRoot)(options), (0, schematics_1.mergeWith)(generate(options))]);
12
- }
13
- function transform(options) {
14
- const target = Object.assign({}, options);
15
- if (!target.name) {
16
- throw new schematics_1.SchematicsException('Option (name) is required.');
17
- }
18
- const location = new name_parser_1.NameParser().parse(target);
19
- target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
20
- target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
21
- target.language = target.language !== undefined ? target.language : 'ts';
22
- target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
23
- target.path = target.flat
24
- ? target.path
25
- : (0, core_1.join)(target.path, target.name);
26
- return target;
27
- }
28
- function generate(options) {
29
- return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
30
- options.spec
31
- ? (0, schematics_1.noop)()
32
- : (0, schematics_1.filter)((path) => {
33
- const languageExtension = options.language || 'ts';
34
- const suffix = `.__specFileSuffix__.${languageExtension}`;
35
- return !path.endsWith(suffix);
36
- }),
37
- (0, schematics_1.template)({
38
- ...core_1.strings,
39
- ...options,
40
- }),
41
- (0, schematics_1.move)(options.path),
42
- ])(context);
43
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { InterceptorOptions } from './interceptor.schema';
3
- export declare function main(options: InterceptorOptions): Rule;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.main = main;
4
- const core_1 = require("@angular-devkit/core");
5
- const schematics_1 = require("@angular-devkit/schematics");
6
- const formatting_1 = require("../../utils/formatting");
7
- const name_parser_1 = require("../../utils/name.parser");
8
- const source_root_helpers_1 = require("../../utils/source-root.helpers");
9
- function main(options) {
10
- options = transform(options);
11
- return (0, schematics_1.chain)([(0, source_root_helpers_1.mergeSourceRoot)(options), (0, schematics_1.mergeWith)(generate(options))]);
12
- }
13
- function transform(options) {
14
- const target = Object.assign({}, options);
15
- if (!target.name) {
16
- throw new schematics_1.SchematicsException('Option (name) is required.');
17
- }
18
- const location = new name_parser_1.NameParser().parse(target);
19
- target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
20
- target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
21
- target.language = target.language !== undefined ? target.language : 'ts';
22
- target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
23
- target.path = target.flat
24
- ? target.path
25
- : (0, core_1.join)(target.path, target.name);
26
- return target;
27
- }
28
- function generate(options) {
29
- return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
30
- options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)((path) => !path.endsWith('.spec.ts')),
31
- options.spec
32
- ? (0, schematics_1.noop)()
33
- : (0, schematics_1.filter)((path) => {
34
- const languageExtension = options.language || 'ts';
35
- const suffix = `.__specFileSuffix__.${languageExtension}`;
36
- return !path.endsWith(suffix);
37
- }),
38
- (0, schematics_1.template)({
39
- ...core_1.strings,
40
- ...options,
41
- }),
42
- (0, schematics_1.move)(options.path),
43
- ])(context);
44
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { InterfaceOptions } from './interface.schema';
3
- export declare function main(options: InterfaceOptions): Rule;