@nestjs/schematics 11.0.8 → 12.0.0-alpha.0
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.
- package/dist/lib/application/files/js/package.json +10 -10
- package/dist/lib/application/files/ts/eslint.config.mjs +2 -1
- package/dist/lib/application/files/ts/package.json +3 -3
- package/dist/lib/application/files/ts/tsconfig.json +0 -1
- package/dist/lib/application/files/ts-esm/.prettierrc +4 -0
- package/dist/lib/application/files/ts-esm/README.md +98 -0
- package/dist/lib/application/files/ts-esm/eslint.config.mjs +34 -0
- package/dist/lib/application/files/ts-esm/nest-cli.json +8 -0
- package/dist/lib/application/files/ts-esm/package.json +50 -0
- package/dist/lib/application/files/ts-esm/src/app.controller.__specFileSuffix__.ts +22 -0
- package/dist/lib/application/files/ts-esm/src/app.controller.ts +12 -0
- package/dist/lib/application/files/ts-esm/src/app.module.ts +10 -0
- package/dist/lib/application/files/ts-esm/src/app.service.ts +8 -0
- package/dist/lib/application/files/ts-esm/src/main.ts +8 -0
- package/dist/lib/application/files/ts-esm/test/app.e2e-__specFileSuffix__.ts +25 -0
- package/dist/lib/application/files/ts-esm/tsconfig.build.json +4 -0
- package/dist/lib/application/files/ts-esm/tsconfig.json +24 -0
- package/dist/lib/application/files/ts-esm/vitest.config.e2e.ts +10 -0
- package/dist/lib/application/files/ts-esm/vitest.config.ts +10 -0
- package/dist/lib/application/schema.json +14 -0
- package/dist/lib/library/files/ts/tsconfig.lib.json +1 -0
- package/dist/lib/sub-app/files/ts/tsconfig.app.json +1 -0
- package/dist/lib/sub-app/workspace/ts/tsconfig.app.json +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/{lib → src/lib}/application/application.factory.d.ts +1 -1
- package/dist/src/lib/application/application.factory.js +64 -0
- package/dist/{lib → src/lib}/class/class.factory.d.ts +1 -1
- package/dist/src/lib/class/class.factory.js +48 -0
- package/dist/{lib → src/lib}/client-app/angular/angular.factory.d.ts +1 -1
- package/dist/{lib → src/lib}/client-app/angular/angular.factory.js +23 -26
- package/dist/{lib → src/lib}/configuration/configuration.factory.d.ts +1 -1
- package/dist/src/lib/configuration/configuration.factory.js +24 -0
- package/dist/{lib → src/lib}/controller/controller.factory.d.ts +1 -1
- package/dist/src/lib/controller/controller.factory.js +69 -0
- package/dist/{lib → src/lib}/decorator/decorator.factory.d.ts +1 -1
- package/dist/src/lib/decorator/decorator.factory.js +32 -0
- package/dist/src/lib/defaults.js +14 -0
- package/dist/{lib → src/lib}/filter/filter.factory.d.ts +1 -1
- package/dist/src/lib/filter/filter.factory.js +40 -0
- package/dist/{lib → src/lib}/gateway/gateway.factory.d.ts +1 -1
- package/dist/src/lib/gateway/gateway.factory.js +69 -0
- package/dist/{lib → src/lib}/guard/guard.factory.d.ts +1 -1
- package/dist/src/lib/guard/guard.factory.js +40 -0
- package/dist/{lib → src/lib}/interceptor/interceptor.factory.d.ts +1 -1
- package/dist/src/lib/interceptor/interceptor.factory.js +41 -0
- package/dist/{lib → src/lib}/interface/interface.factory.d.ts +1 -1
- package/dist/src/lib/interface/interface.factory.js +31 -0
- package/dist/{lib → src/lib}/library/library.factory.d.ts +1 -1
- package/dist/{lib → src/lib}/library/library.factory.js +51 -64
- package/dist/{lib → src/lib}/middleware/middleware.factory.d.ts +1 -1
- package/dist/src/lib/middleware/middleware.factory.js +40 -0
- package/dist/{lib → src/lib}/module/module.factory.d.ts +1 -1
- package/dist/src/lib/module/module.factory.js +57 -0
- package/dist/{lib → src/lib}/pipe/pipe.factory.d.ts +1 -1
- package/dist/src/lib/pipe/pipe.factory.js +41 -0
- package/dist/{lib → src/lib}/provider/provider.factory.d.ts +1 -1
- package/dist/src/lib/provider/provider.factory.js +73 -0
- package/dist/{lib → src/lib}/readers/file-system.reader.d.ts +1 -1
- package/dist/{lib → src/lib}/readers/file-system.reader.js +3 -7
- package/dist/src/lib/readers/index.d.ts +2 -0
- package/dist/src/lib/readers/index.js +2 -0
- package/dist/src/lib/readers/reader.js +1 -0
- package/dist/{lib → src/lib}/resolver/resolver.factory.d.ts +1 -1
- package/dist/src/lib/resolver/resolver.factory.js +68 -0
- package/dist/{lib → src/lib}/resource/resource.factory.d.ts +1 -1
- package/dist/{lib → src/lib}/resource/resource.factory.js +35 -38
- package/dist/{lib → src/lib}/service/service.factory.d.ts +1 -1
- package/dist/src/lib/service/service.factory.js +71 -0
- package/dist/{lib → src/lib}/sub-app/sub-app.factory.d.ts +1 -1
- package/dist/{lib → src/lib}/sub-app/sub-app.factory.js +94 -69
- package/dist/{utils → src/utils}/dependencies.utils.js +7 -12
- package/dist/{utils → src/utils}/formatting.js +1 -4
- package/dist/src/utils/index.d.ts +11 -0
- package/dist/src/utils/index.js +11 -0
- package/dist/src/utils/jest-module-mapper.js +6 -0
- package/dist/{utils → src/utils}/json-file.util.js +9 -13
- package/dist/{utils → src/utils}/metadata.manager.d.ts +1 -1
- package/dist/{utils → src/utils}/metadata.manager.js +11 -15
- package/dist/{utils → src/utils}/module-import.declarator.d.ts +2 -2
- package/dist/{utils → src/utils}/module-import.declarator.js +6 -10
- package/dist/{utils → src/utils}/module-metadata.declarator.d.ts +1 -1
- package/dist/src/utils/module-metadata.declarator.js +8 -0
- package/dist/{utils → src/utils}/module.declarator.d.ts +2 -2
- package/dist/src/utils/module.declarator.js +30 -0
- package/dist/{utils → src/utils}/module.finder.js +3 -7
- package/dist/src/utils/name.parser.js +13 -0
- package/dist/{utils → src/utils}/object-sorting.js +1 -4
- package/dist/src/utils/path.solver.js +8 -0
- package/dist/src/utils/source-root.helpers.js +20 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +21 -49
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -18
- package/dist/lib/application/application.factory.js +0 -63
- package/dist/lib/class/class.factory.js +0 -51
- package/dist/lib/configuration/configuration.factory.js +0 -27
- package/dist/lib/controller/controller.factory.js +0 -72
- package/dist/lib/decorator/decorator.factory.js +0 -35
- package/dist/lib/defaults.js +0 -17
- package/dist/lib/filter/filter.factory.js +0 -43
- package/dist/lib/gateway/gateway.factory.js +0 -72
- package/dist/lib/guard/guard.factory.js +0 -43
- package/dist/lib/interceptor/interceptor.factory.js +0 -44
- package/dist/lib/interface/interface.factory.js +0 -34
- package/dist/lib/middleware/middleware.factory.js +0 -43
- package/dist/lib/module/module.factory.js +0 -60
- package/dist/lib/pipe/pipe.factory.js +0 -44
- package/dist/lib/provider/provider.factory.js +0 -76
- package/dist/lib/readers/index.d.ts +0 -2
- package/dist/lib/readers/index.js +0 -18
- package/dist/lib/readers/reader.js +0 -2
- package/dist/lib/resolver/resolver.factory.js +0 -71
- package/dist/lib/service/service.factory.js +0 -74
- package/dist/utils/index.d.ts +0 -11
- package/dist/utils/index.js +0 -27
- package/dist/utils/jest-module-mapper.js +0 -9
- package/dist/utils/module-metadata.declarator.js +0 -12
- package/dist/utils/module.declarator.js +0 -34
- package/dist/utils/name.parser.js +0 -17
- package/dist/utils/path.solver.js +0 -12
- package/dist/utils/source-root.helpers.js +0 -24
- /package/dist/{lib → src/lib}/defaults.d.ts +0 -0
- /package/dist/{lib → src/lib}/readers/reader.d.ts +0 -0
- /package/dist/{utils → src/utils}/dependencies.utils.d.ts +0 -0
- /package/dist/{utils → src/utils}/formatting.d.ts +0 -0
- /package/dist/{utils → src/utils}/jest-module-mapper.d.ts +0 -0
- /package/dist/{utils → src/utils}/json-file.util.d.ts +0 -0
- /package/dist/{utils → src/utils}/module.finder.d.ts +0 -0
- /package/dist/{utils → src/utils}/name.parser.d.ts +0 -0
- /package/dist/{utils → src/utils}/object-sorting.d.ts +0 -0
- /package/dist/{utils → src/utils}/path.solver.d.ts +0 -0
- /package/dist/{utils → src/utils}/source-root.helpers.d.ts +0 -0
|
@@ -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,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
|
-
}
|
package/dist/lib/defaults.js
DELETED
|
@@ -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,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,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,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,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,34 +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.path = target.flat
|
|
22
|
-
? target.path
|
|
23
|
-
: (0, core_1.join)(target.path, target.name);
|
|
24
|
-
return target;
|
|
25
|
-
}
|
|
26
|
-
function generate(options) {
|
|
27
|
-
return (context) => (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
28
|
-
(0, schematics_1.template)({
|
|
29
|
-
...core_1.strings,
|
|
30
|
-
...options,
|
|
31
|
-
}),
|
|
32
|
-
(0, schematics_1.move)(options.path),
|
|
33
|
-
])(context);
|
|
34
|
-
}
|
|
@@ -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,60 +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(source) {
|
|
22
|
-
const target = Object.assign({}, source);
|
|
23
|
-
target.metadata = 'imports';
|
|
24
|
-
target.type = 'module';
|
|
25
|
-
const location = new name_parser_1.NameParser().parse(target);
|
|
26
|
-
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
27
|
-
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
28
|
-
target.language = target.language !== undefined ? target.language : 'ts';
|
|
29
|
-
target.path = target.flat
|
|
30
|
-
? target.path
|
|
31
|
-
: (0, core_1.join)(target.path, target.name);
|
|
32
|
-
return target;
|
|
33
|
-
}
|
|
34
|
-
function generate(options) {
|
|
35
|
-
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
36
|
-
(0, schematics_1.template)({
|
|
37
|
-
...core_1.strings,
|
|
38
|
-
...options,
|
|
39
|
-
}),
|
|
40
|
-
(0, schematics_1.move)(options.path),
|
|
41
|
-
])(context);
|
|
42
|
-
}
|
|
43
|
-
function addDeclarationToModule(options) {
|
|
44
|
-
return (tree) => {
|
|
45
|
-
if (options.skipImport !== undefined && options.skipImport) {
|
|
46
|
-
return tree;
|
|
47
|
-
}
|
|
48
|
-
options.module = new module_finder_1.ModuleFinder(tree).find({
|
|
49
|
-
name: options.name,
|
|
50
|
-
path: options.path,
|
|
51
|
-
});
|
|
52
|
-
if (!options.module) {
|
|
53
|
-
return tree;
|
|
54
|
-
}
|
|
55
|
-
const content = tree.read(options.module).toString();
|
|
56
|
-
const declarator = new module_declarator_1.ModuleDeclarator();
|
|
57
|
-
tree.overwrite(options.module, declarator.declare(content, options));
|
|
58
|
-
return tree;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
@@ -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,76 +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
|
-
target.metadata = 'providers';
|
|
24
|
-
target.specFileSuffix = (0, formatting_1.normalizeToKebabOrSnakeCase)(options.specFileSuffix || 'spec');
|
|
25
|
-
if (!target.name) {
|
|
26
|
-
throw new schematics_1.SchematicsException('Option (name) is required.');
|
|
27
|
-
}
|
|
28
|
-
const location = new name_parser_1.NameParser().parse(target);
|
|
29
|
-
target.name = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.name);
|
|
30
|
-
if (target.name.includes('.')) {
|
|
31
|
-
target.className = core_1.strings.classify(target.name).replace('.', '');
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
target.className = core_1.strings.classify(target.name);
|
|
35
|
-
}
|
|
36
|
-
target.path = (0, formatting_1.normalizeToKebabOrSnakeCase)(location.path);
|
|
37
|
-
target.language = target.language !== undefined ? target.language : 'ts';
|
|
38
|
-
target.path = target.flat
|
|
39
|
-
? target.path
|
|
40
|
-
: (0, core_1.join)(target.path, target.name);
|
|
41
|
-
return target;
|
|
42
|
-
}
|
|
43
|
-
function generate(options) {
|
|
44
|
-
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
45
|
-
options.spec
|
|
46
|
-
? (0, schematics_1.noop)()
|
|
47
|
-
: (0, schematics_1.filter)((path) => {
|
|
48
|
-
const languageExtension = options.language || 'ts';
|
|
49
|
-
const suffix = `.__specFileSuffix__.${languageExtension}`;
|
|
50
|
-
return !path.endsWith(suffix);
|
|
51
|
-
}),
|
|
52
|
-
(0, schematics_1.template)({
|
|
53
|
-
...core_1.strings,
|
|
54
|
-
...options,
|
|
55
|
-
}),
|
|
56
|
-
(0, schematics_1.move)(options.path),
|
|
57
|
-
])(context);
|
|
58
|
-
}
|
|
59
|
-
function addDeclarationToModule(options) {
|
|
60
|
-
return (tree) => {
|
|
61
|
-
if (options.skipImport !== undefined && options.skipImport) {
|
|
62
|
-
return tree;
|
|
63
|
-
}
|
|
64
|
-
options.module = new module_finder_1.ModuleFinder(tree).find({
|
|
65
|
-
name: options.name,
|
|
66
|
-
path: options.path,
|
|
67
|
-
});
|
|
68
|
-
if (!options.module) {
|
|
69
|
-
return tree;
|
|
70
|
-
}
|
|
71
|
-
const content = tree.read(options.module).toString();
|
|
72
|
-
const declarator = new module_declarator_1.ModuleDeclarator();
|
|
73
|
-
tree.overwrite(options.module, declarator.declare(content, options));
|
|
74
|
-
return tree;
|
|
75
|
-
};
|
|
76
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./reader"), exports);
|
|
18
|
-
__exportStar(require("./file-system.reader"), exports);
|