@rhtml/schematics 0.0.132 → 0.0.134
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/collection.json +6 -1
- package/dist/lib/component/schema.json +1 -1
- package/dist/lib/controller/controller.factory.d.ts +3 -0
- package/dist/lib/controller/controller.factory.js +62 -0
- package/dist/lib/controller/controller.factory.ts +92 -0
- package/dist/lib/controller/files/ts/__name__.controller.spec.ts +33 -0
- package/dist/lib/controller/files/ts/__name__.controller.ts +16 -0
- package/dist/lib/controller/schema.json +49 -0
- package/dist/lib/module/schema.json +4 -4
- package/dist/lib/provider/schema.json +4 -4
- package/dist/lib/service/schema.json +3 -3
- package/dist/lib/service/service.factory.js +1 -2
- package/dist/lib/service/service.factory.ts +1 -2
- package/dist/utils/metadata.manager.d.ts +65 -2
- package/dist/utils/metadata.manager.js +103 -23
- package/dist/utils/metadata.manager.ts +127 -46
- package/dist/utils/module-import.declarator.d.ts +31 -2
- package/dist/utils/module-import.declarator.js +42 -10
- package/dist/utils/module-import.declarator.ts +45 -12
- package/dist/utils/module-metadata.declarator.d.ts +12 -0
- package/dist/utils/module-metadata.declarator.js +13 -1
- package/dist/utils/module-metadata.declarator.ts +13 -1
- package/dist/utils/module.declarator.d.ts +21 -1
- package/dist/utils/module.declarator.js +23 -1
- package/dist/utils/module.declarator.ts +24 -2
- package/dist/utils/module.finder.d.ts +12 -0
- package/dist/utils/module.finder.js +13 -1
- package/dist/utils/module.finder.ts +13 -1
- package/dist/utils/name.parser.d.ts +6 -0
- package/dist/utils/name.parser.js +6 -0
- package/dist/utils/name.parser.ts +6 -0
- package/dist/utils/path.solver.d.ts +7 -0
- package/dist/utils/path.solver.js +7 -0
- package/dist/utils/path.solver.ts +7 -0
- package/dist/utils/source-root.helpers.d.ts +13 -1
- package/dist/utils/source-root.helpers.js +13 -1
- package/dist/utils/source-root.helpers.ts +14 -2
- package/package.json +5 -5
- package/src/lib/component/schema.json +1 -1
- package/src/lib/controller/controller.factory.ts +92 -0
- package/src/lib/controller/files/ts/__name__.controller.spec.ts +33 -0
- package/src/lib/controller/files/ts/__name__.controller.ts +16 -0
- package/src/lib/controller/schema.json +49 -0
- package/src/lib/module/schema.json +4 -4
- package/src/lib/provider/schema.json +4 -4
- package/src/lib/service/schema.json +3 -3
- package/src/lib/service/service.factory.ts +1 -2
- package/src/utils/metadata.manager.ts +127 -46
- package/src/utils/module-import.declarator.ts +45 -12
- package/src/utils/module-metadata.declarator.ts +13 -1
- package/src/utils/module.declarator.ts +24 -2
- package/src/utils/module.finder.ts +13 -1
- package/src/utils/name.parser.ts +6 -0
- package/src/utils/path.solver.ts +7 -0
- package/src/utils/source-root.helpers.ts +14 -2
package/src/utils/name.parser.ts
CHANGED
|
@@ -11,6 +11,12 @@ export interface Location {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export class NameParser {
|
|
14
|
+
/**
|
|
15
|
+
* Parses the provided options to extract the name and path.
|
|
16
|
+
*
|
|
17
|
+
* @param options - The options containing the name and path.
|
|
18
|
+
* @returns An object containing the parsed name and normalized path.
|
|
19
|
+
*/
|
|
14
20
|
public parse(options: ParseOptions): Location {
|
|
15
21
|
const nameWithoutPath: string = basename(options.name as Path);
|
|
16
22
|
const namePath: string = dirname(
|
package/src/utils/path.solver.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { basename, dirname, Path, relative } from '@angular-devkit/core';
|
|
2
2
|
|
|
3
3
|
export class PathSolver {
|
|
4
|
+
/**
|
|
5
|
+
* Computes the relative path between two paths.
|
|
6
|
+
*
|
|
7
|
+
* @param from - The source path.
|
|
8
|
+
* @param to - The target path.
|
|
9
|
+
* @returns The relative path between the two paths.
|
|
10
|
+
*/
|
|
4
11
|
public relative(from: Path, to: Path): string {
|
|
5
12
|
const placeholder = '/placeholder';
|
|
6
13
|
const relativeDir = relative(
|
|
@@ -3,16 +3,28 @@ import { Rule, Tree } from '@angular-devkit/schematics';
|
|
|
3
3
|
|
|
4
4
|
import { DEFAULT_PATH_NAME } from '../lib/defaults';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Checks if the current directory is the root directory.
|
|
8
|
+
*
|
|
9
|
+
* @param host - The file tree representing the project.
|
|
10
|
+
* @param extraFiles - Additional files to check for in the root directory.
|
|
11
|
+
* @returns True if the current directory is the root directory, otherwise false.
|
|
12
|
+
*/
|
|
6
13
|
export function isInRootDirectory(
|
|
7
14
|
host: Tree,
|
|
8
15
|
extraFiles: string[] = []
|
|
9
16
|
): boolean {
|
|
10
|
-
const files = [
|
|
17
|
+
const files = [].concat(extraFiles || []);
|
|
11
18
|
return files.map((file) => host.exists(file)).some((isPresent) => isPresent);
|
|
12
19
|
}
|
|
13
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Merges the source root with the provided options.
|
|
23
|
+
* @param options - The options to merge with the source root.
|
|
24
|
+
* @returns A rule to merge the source root with the provided options.
|
|
25
|
+
*/
|
|
14
26
|
export function mergeSourceRoot<
|
|
15
|
-
T extends { sourceRoot?: string; path?: string } =
|
|
27
|
+
T extends { sourceRoot?: string; path?: string } = never
|
|
16
28
|
>(options: T): Rule {
|
|
17
29
|
return (host: Tree) => {
|
|
18
30
|
const isInRoot = isInRootDirectory(host, ['tsconfig.json', 'package.json']);
|