@rxap/schematic-angular 16.2.0-dev.49 → 16.2.0-dev.50
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/collection.json +5 -0
- package/package.json +4 -4
- package/src/lib/component-options.d.ts +10 -0
- package/src/lib/component-options.js +14 -0
- package/src/lib/component-options.js.map +1 -0
- package/src/lib/route-component.d.ts +16 -0
- package/src/lib/route-component.js +15 -0
- package/src/lib/route-component.js.map +1 -0
- package/src/schema.json +68 -0
- package/src/schematic-input.schema.json +19 -0
- package/src/schematics/component.schema.json +16 -0
- package/src/schematics/route-component/files/component/__componentName__.component.html.hbs +1 -0
- package/src/schematics/route-component/index.d.ts +8 -0
- package/src/schematics/route-component/index.js +101 -0
- package/src/schematics/route-component/index.js.map +1 -0
- package/src/schematics/route-component/schema.d.ts +5 -0
- package/src/schematics/route-component/schema.json +154 -0
- package/src/schematics/route-component/template.schema.json +20 -0
- package/src/schematics/route-component.schema.json +35 -0
- package/src/template.schema.json +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [16.2.0-dev.50](https://gitlab.com/rxap/packages/compare/@rxap/schematic-angular@16.2.0-dev.49...@rxap/schematic-angular@16.2.0-dev.50) (2024-03-23)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- add the route-component schematic ([4c26ce8](https://gitlab.com/rxap/packages/commit/4c26ce8efb4cdd9e69d31dc0258823501872163e))
|
|
11
|
+
|
|
6
12
|
# [16.2.0-dev.49](https://gitlab.com/rxap/packages/compare/@rxap/schematic-angular@16.2.0-dev.48...@rxap/schematic-angular@16.2.0-dev.49) (2024-03-15)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -17,5 +17,5 @@ yarn add @rxap/schematic-angular
|
|
|
17
17
|
```
|
|
18
18
|
**Install peer dependencies:**
|
|
19
19
|
```bash
|
|
20
|
-
yarn add @angular-devkit/core@^16.1.4 @angular-devkit/schematics@^16.1.4 @rxap/schematics-ts-morph@^16.1.0-dev.23 @rxap/schematics-utilities@^16.0.1-dev.3 @rxap/ts-morph@^1.1.0-dev.
|
|
20
|
+
yarn add @angular-devkit/core@^16.1.4 @angular-devkit/schematics@^16.1.4 @rxap/schematics-ts-morph@^16.1.0-dev.23 @rxap/schematics-utilities@^16.0.1-dev.3 @rxap/ts-morph@^1.1.0-dev.20 @rxap/utilities@^16.1.0-dev.7 @rxap/workspace-utilities@^16.1.0-dev.3 colors@^1.4.0 handlebars@^4.7.7 ts-morph@^18.0.0 tslib@2.6.2
|
|
21
21
|
```
|
package/collection.json
CHANGED
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"schema": "./src/schematics/form/form-component/schema.json",
|
|
16
16
|
"description": "Generates a form component."
|
|
17
17
|
},
|
|
18
|
+
"route-component": {
|
|
19
|
+
"factory": "./src/schematics/route-component/index",
|
|
20
|
+
"schema": "./src/schematics/route-component/schema.json",
|
|
21
|
+
"description": "Generates a route component."
|
|
22
|
+
},
|
|
18
23
|
"form-definition": {
|
|
19
24
|
"factory": "./src/schematics/form/form-definition/index",
|
|
20
25
|
"schema": "./src/schematics/form/form-definition/schema.json",
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "16.2.0-dev.
|
|
2
|
+
"version": "16.2.0-dev.50",
|
|
3
3
|
"name": "@rxap/schematic-angular",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"dependencies": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@angular-devkit/schematics": "^16.1.4",
|
|
15
15
|
"@rxap/schematics-ts-morph": "^16.1.0-dev.23",
|
|
16
16
|
"@rxap/schematics-utilities": "^16.0.1-dev.3",
|
|
17
|
-
"@rxap/ts-morph": "^1.1.0-dev.
|
|
17
|
+
"@rxap/ts-morph": "^1.1.0-dev.20",
|
|
18
18
|
"@rxap/utilities": "^16.1.0-dev.7",
|
|
19
19
|
"@rxap/workspace-utilities": "^16.1.0-dev.3",
|
|
20
20
|
"colors": "^1.4.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"url": "https://gitlab.com/rxap/packages/-/issues",
|
|
34
34
|
"email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "c325cc61fc1c4180be0712a36ec43835a590af4f",
|
|
37
37
|
"homepage": "https:/gitlab.com/rxap/packages/packages/schematic/angular",
|
|
38
38
|
"keywords": [
|
|
39
39
|
"angular",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
"package": "@rxap/ts-morph",
|
|
57
|
-
"version": "1.1.0-dev.
|
|
57
|
+
"version": "1.1.0-dev.20"
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"package": "@rxap/utilities",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NormalizedTypeImport, TypeImport } from '@rxap/ts-morph';
|
|
2
|
+
import { Normalized } from '@rxap/utilities';
|
|
3
|
+
export interface ComponentOptions extends TypeImport {
|
|
4
|
+
selector?: string | false;
|
|
5
|
+
}
|
|
6
|
+
export interface NormalizedComponentOptions extends Readonly<Normalized<Omit<ComponentOptions, keyof TypeImport>> & NormalizedTypeImport> {
|
|
7
|
+
selector: string | false;
|
|
8
|
+
namedImport: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function NormalizeComponentOptions(options: ComponentOptions): NormalizedComponentOptions;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NormalizeComponentOptions = void 0;
|
|
4
|
+
const ts_morph_1 = require("@rxap/ts-morph");
|
|
5
|
+
const utilities_1 = require("@rxap/utilities");
|
|
6
|
+
function NormalizeComponentOptions(options) {
|
|
7
|
+
var _a;
|
|
8
|
+
const name = (0, utilities_1.dasherize)(options.name).replace(/-component$/, '');
|
|
9
|
+
const namedImport = (0, utilities_1.classify)(name + '-component');
|
|
10
|
+
return Object.assign(Object.assign({}, (0, ts_morph_1.NormalizeTypeImport)(Object.assign(Object.assign({}, options), { name,
|
|
11
|
+
namedImport }))), { namedImport, selector: (_a = options.selector) !== null && _a !== void 0 ? _a : false });
|
|
12
|
+
}
|
|
13
|
+
exports.NormalizeComponentOptions = NormalizeComponentOptions;
|
|
14
|
+
//# sourceMappingURL=component-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-options.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/component-options.ts"],"names":[],"mappings":";;;AAAA,6CAIwB;AACxB,+CAIyB;AAWzB,SAAgB,yBAAyB,CAAC,OAAyB;;IACjE,MAAM,IAAI,GAAG,IAAA,qBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAChE,MAAM,WAAW,GAAG,IAAA,oBAAQ,EAAC,IAAI,GAAG,YAAY,CAAC,CAAC;IAClD,uCACK,IAAA,8BAAmB,kCACjB,OAAO,KACV,IAAI;QACJ,WAAW,IACX,KACF,WAAW,EACX,QAAQ,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,KAAK,IACnC;AACJ,CAAC;AAZD,8DAYC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Normalized } from '@rxap/utilities';
|
|
2
|
+
import { ComponentOptions, NormalizedComponentOptions } from './component-options';
|
|
3
|
+
export interface RouteComponent extends ComponentOptions {
|
|
4
|
+
selector?: false;
|
|
5
|
+
path?: string;
|
|
6
|
+
children?: RouteComponent[];
|
|
7
|
+
data?: Record<string, any>;
|
|
8
|
+
outlet?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface NormalizedRouteComponent extends Readonly<Normalized<Omit<RouteComponent, keyof ComponentOptions | 'children'>> & NormalizedComponentOptions> {
|
|
11
|
+
selector: false;
|
|
12
|
+
path: string;
|
|
13
|
+
children: Array<NormalizedRouteComponent> | null;
|
|
14
|
+
}
|
|
15
|
+
export declare function NormalizeRouteComponent(options: RouteComponent): NormalizedRouteComponent;
|
|
16
|
+
export declare function NormalizeRouteComponentList(options?: RouteComponent[]): NormalizedRouteComponent[] | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NormalizeRouteComponentList = exports.NormalizeRouteComponent = void 0;
|
|
4
|
+
const component_options_1 = require("./component-options");
|
|
5
|
+
function NormalizeRouteComponent(options) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const normalized = (0, component_options_1.NormalizeComponentOptions)(Object.assign(Object.assign({}, options), { selector: false }));
|
|
8
|
+
return Object.assign(Object.assign({}, normalized), { selector: false, path: (_a = options.path) !== null && _a !== void 0 ? _a : normalized.name, children: NormalizeRouteComponentList(options.children), outlet: (_b = options.outlet) !== null && _b !== void 0 ? _b : null, data: options.data && Object.keys(options.data).length ? Object.freeze(options.data) : null });
|
|
9
|
+
}
|
|
10
|
+
exports.NormalizeRouteComponent = NormalizeRouteComponent;
|
|
11
|
+
function NormalizeRouteComponentList(options) {
|
|
12
|
+
return options ? options.map(NormalizeRouteComponent) : null;
|
|
13
|
+
}
|
|
14
|
+
exports.NormalizeRouteComponentList = NormalizeRouteComponentList;
|
|
15
|
+
//# sourceMappingURL=route-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-component.js","sourceRoot":"","sources":["../../../../../../packages/schematic/angular/src/lib/route-component.ts"],"names":[],"mappings":";;;AACA,2DAI6B;AAgB7B,SAAgB,uBAAuB,CAAC,OAAuB;;IAC7D,MAAM,UAAU,GAAG,IAAA,6CAAyB,kCACvC,OAAO,KACV,QAAQ,EAAE,KAAK,IACf,CAAC;IACH,uCACK,UAAU,KACb,QAAQ,EAAE,KAAK,EACf,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,UAAU,CAAC,IAAI,EACrC,QAAQ,EAAE,2BAA2B,CAAC,OAAO,CAAC,QAAQ,CAAC,EACvD,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI,EAC9B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAC3F;AACJ,CAAC;AAbD,0DAaC;AAED,SAAgB,2BAA2B,CAAC,OAA0B;IACpE,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/D,CAAC;AAFD,kEAEC"}
|
package/src/schema.json
CHANGED
|
@@ -627,6 +627,20 @@
|
|
|
627
627
|
}
|
|
628
628
|
]
|
|
629
629
|
},
|
|
630
|
+
"component": {
|
|
631
|
+
"type": "object",
|
|
632
|
+
"properties": {
|
|
633
|
+
"name": {
|
|
634
|
+
"type": "string"
|
|
635
|
+
},
|
|
636
|
+
"moduleSpecifier": {
|
|
637
|
+
"type": "string"
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
"required": [
|
|
641
|
+
"name"
|
|
642
|
+
]
|
|
643
|
+
},
|
|
630
644
|
"control": {
|
|
631
645
|
"oneOf": [
|
|
632
646
|
{
|
|
@@ -1640,6 +1654,44 @@
|
|
|
1640
1654
|
}
|
|
1641
1655
|
]
|
|
1642
1656
|
},
|
|
1657
|
+
"routeComponent": {
|
|
1658
|
+
"allOf": [
|
|
1659
|
+
{
|
|
1660
|
+
"$ref": "#/definitions/component"
|
|
1661
|
+
},
|
|
1662
|
+
{
|
|
1663
|
+
"type": "object",
|
|
1664
|
+
"properties": {
|
|
1665
|
+
"path": {
|
|
1666
|
+
"type": "string"
|
|
1667
|
+
},
|
|
1668
|
+
"outlet": {
|
|
1669
|
+
"type": "string"
|
|
1670
|
+
},
|
|
1671
|
+
"data": {
|
|
1672
|
+
"type": "object",
|
|
1673
|
+
"additionalProperties": true
|
|
1674
|
+
},
|
|
1675
|
+
"children": {
|
|
1676
|
+
"type": "array",
|
|
1677
|
+
"items": {
|
|
1678
|
+
"additionalProperties": true
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
]
|
|
1684
|
+
},
|
|
1685
|
+
"routeComponentSchematic": {
|
|
1686
|
+
"allOf": [
|
|
1687
|
+
{
|
|
1688
|
+
"$ref": "#/definitions/angular"
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
"$ref": "#/definitions/routeComponent"
|
|
1692
|
+
}
|
|
1693
|
+
]
|
|
1694
|
+
},
|
|
1643
1695
|
"schematicInput": {
|
|
1644
1696
|
"type": "object",
|
|
1645
1697
|
"oneOf": [
|
|
@@ -1691,6 +1743,22 @@
|
|
|
1691
1743
|
}
|
|
1692
1744
|
}
|
|
1693
1745
|
},
|
|
1746
|
+
{
|
|
1747
|
+
"type": "object",
|
|
1748
|
+
"properties": {
|
|
1749
|
+
"package": {
|
|
1750
|
+
"type": "string",
|
|
1751
|
+
"const": "@rxap/schematic-angular"
|
|
1752
|
+
},
|
|
1753
|
+
"name": {
|
|
1754
|
+
"type": "string",
|
|
1755
|
+
"const": "route-component"
|
|
1756
|
+
},
|
|
1757
|
+
"options": {
|
|
1758
|
+
"$ref": "#/definitions/routeComponentSchematic"
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
},
|
|
1694
1762
|
{
|
|
1695
1763
|
"type": "object",
|
|
1696
1764
|
"properties": {
|
|
@@ -51,6 +51,22 @@
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
"type": "object",
|
|
56
|
+
"properties": {
|
|
57
|
+
"package": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"const": "@rxap/schematic-angular"
|
|
60
|
+
},
|
|
61
|
+
"name": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"const": "route-component"
|
|
64
|
+
},
|
|
65
|
+
"options": {
|
|
66
|
+
"$ref": "#/definitions/routeComponentSchematic"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
54
70
|
{
|
|
55
71
|
"type": "object",
|
|
56
72
|
"properties": {
|
|
@@ -478,6 +494,9 @@
|
|
|
478
494
|
"formComponentSchematic": {
|
|
479
495
|
"$ref": "schematics/form/form-component/template.schema.json"
|
|
480
496
|
},
|
|
497
|
+
"routeComponentSchematic": {
|
|
498
|
+
"$ref": "schematics/route-component/template.schema.json"
|
|
499
|
+
},
|
|
481
500
|
"formDefinitionSchematic": {
|
|
482
501
|
"$ref": "schematics/form/form-definition/template.schema.json"
|
|
483
502
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<pre>{{ name }}</pre>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import { Normalized } from '@rxap/utilities';
|
|
3
|
+
import { NormalizedAngularOptions } from '../../lib/angular-options';
|
|
4
|
+
import { NormalizedRouteComponent, RouteComponent } from '../../lib/route-component';
|
|
5
|
+
import { RouteComponentOptions } from './schema';
|
|
6
|
+
export type NormalizedRouteComponentOptions = Readonly<Normalized<Omit<RouteComponentOptions, keyof RouteComponent>> & NormalizedAngularOptions & NormalizedRouteComponent>;
|
|
7
|
+
export declare function NormalizeRouteComponentOptions(options: RouteComponentOptions): NormalizedRouteComponentOptions;
|
|
8
|
+
export default function (options: RouteComponentOptions): () => Rule;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NormalizeRouteComponentOptions = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
6
|
+
const ts_morph_1 = require("@rxap/ts-morph");
|
|
7
|
+
const utilities_1 = require("@rxap/utilities");
|
|
8
|
+
const angular_options_1 = require("../../lib/angular-options");
|
|
9
|
+
const route_component_1 = require("../../lib/route-component");
|
|
10
|
+
function NormalizeRouteComponentOptions(options) {
|
|
11
|
+
return Object.assign(Object.assign({}, (0, angular_options_1.NormalizeAngularOptions)(options)), (0, route_component_1.NormalizeRouteComponent)(options));
|
|
12
|
+
}
|
|
13
|
+
exports.NormalizeRouteComponentOptions = NormalizeRouteComponentOptions;
|
|
14
|
+
function printOptions(options) {
|
|
15
|
+
(0, angular_options_1.PrintAngularOptions)('route-component', options);
|
|
16
|
+
if (options.children) {
|
|
17
|
+
console.log(`=== children: \x1b[34m${options.children.map((item) => item.name).join(', ')}\x1b[0m`);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
console.log('=== children: \x1b[31mempty\x1b[0m');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function routeRule(normalizedOptions, parentRoute) {
|
|
24
|
+
var _a;
|
|
25
|
+
const { namedImport, name, project, feature, shared, directory, moduleSpecifier, path, outlet, data } = normalizedOptions;
|
|
26
|
+
const isFeatureRoute = !!feature;
|
|
27
|
+
return (0, schematics_1.chain)([
|
|
28
|
+
() => console.log('Coerce the component to route configuration'),
|
|
29
|
+
(0, schematics_ts_morph_1.TsMorphAngularProjectTransformRule)({
|
|
30
|
+
project,
|
|
31
|
+
shared,
|
|
32
|
+
feature,
|
|
33
|
+
directory,
|
|
34
|
+
}, (project, [sourceFile]) => {
|
|
35
|
+
let route;
|
|
36
|
+
if (moduleSpecifier) {
|
|
37
|
+
(0, ts_morph_1.CoerceImports)(sourceFile, {
|
|
38
|
+
namedImports: [namedImport],
|
|
39
|
+
moduleSpecifier,
|
|
40
|
+
});
|
|
41
|
+
route = {
|
|
42
|
+
component: namedImport,
|
|
43
|
+
path,
|
|
44
|
+
outlet,
|
|
45
|
+
data
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
route = {
|
|
50
|
+
path,
|
|
51
|
+
loadChildren: `./${name}/${name}.component`,
|
|
52
|
+
outlet,
|
|
53
|
+
data
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
(0, ts_morph_1.AddRoute)(sourceFile, route, parentRoute, isFeatureRoute ? 'ROUTES' : 'appRoutes');
|
|
57
|
+
}, [isFeatureRoute ? 'routes.ts' : 'app.routes.ts']),
|
|
58
|
+
(0, schematics_1.chain)(((_a = normalizedOptions.children) !== null && _a !== void 0 ? _a : []).map(child => routeRule(Object.assign(Object.assign({}, normalizedOptions), child), [...parentRoute !== null && parentRoute !== void 0 ? parentRoute : [], path])))
|
|
59
|
+
]);
|
|
60
|
+
}
|
|
61
|
+
function componentRule(normalizedOptions) {
|
|
62
|
+
const { namedImport, name, selector, project, feature, shared, directory, overwrite, moduleSpecifier, } = normalizedOptions;
|
|
63
|
+
if (moduleSpecifier) {
|
|
64
|
+
console.log('Detecting external component. skip coercing the component');
|
|
65
|
+
return (0, schematics_1.noop)();
|
|
66
|
+
}
|
|
67
|
+
const templateOptions = Object.assign({}, normalizedOptions);
|
|
68
|
+
return (0, schematics_1.chain)([
|
|
69
|
+
() => console.log(`Coerce the route component ${namedImport}`),
|
|
70
|
+
(0, schematics_ts_morph_1.CoerceComponentRule)({
|
|
71
|
+
project,
|
|
72
|
+
feature,
|
|
73
|
+
shared,
|
|
74
|
+
directory,
|
|
75
|
+
overwrite,
|
|
76
|
+
name,
|
|
77
|
+
template: { options: templateOptions },
|
|
78
|
+
componentOptions: {
|
|
79
|
+
selector,
|
|
80
|
+
},
|
|
81
|
+
tsMorphTransform: (project, [sourceFile], [classDeclaration]) => {
|
|
82
|
+
(0, ts_morph_1.CoerceDefaultClassExport)(classDeclaration);
|
|
83
|
+
}
|
|
84
|
+
}),
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
87
|
+
function default_1(options) {
|
|
88
|
+
const normalizedOptions = NormalizeRouteComponentOptions(options);
|
|
89
|
+
printOptions(normalizedOptions);
|
|
90
|
+
return () => {
|
|
91
|
+
var _a;
|
|
92
|
+
return (0, schematics_1.chain)([
|
|
93
|
+
() => console.group('\x1b[32m[@rxap/schematics-angular:route-component]\x1b[0m'),
|
|
94
|
+
componentRule(normalizedOptions),
|
|
95
|
+
(0, schematics_1.chain)((0, utilities_1.flatten)((_a = normalizedOptions.children) !== null && _a !== void 0 ? _a : []).map(child => componentRule(Object.assign(Object.assign({}, normalizedOptions), child)))),
|
|
96
|
+
routeRule(normalizedOptions),
|
|
97
|
+
]);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
exports.default = default_1;
|
|
101
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/angular/src/schematics/route-component/index.ts"],"names":[],"mappings":";;;AAAA,2DAIoC;AACpC,mEAGmC;AACnC,6CAKwB;AACxB,+CAGyB;AACzB,+DAImC;AACnC,+DAImC;AAKnC,SAAgB,8BAA8B,CAAC,OAA8B;IAC3E,uCACK,IAAA,yCAAuB,EAAC,OAAO,CAAC,GAChC,IAAA,yCAAuB,EAAC,OAAO,CAAC,EACnC;AACJ,CAAC;AALD,wEAKC;AAED,SAAS,YAAY,CAAC,OAAwC;IAC5D,IAAA,qCAAmB,EAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,QAAQ,EAAE;QACpB,OAAO,CAAC,GAAG,CAAC,yBAA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AAC,CAAC;IAClE,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAEhC,OAAO,GAAG,EAAE;;QAEV,OAAO,IAAA,kBAAK,EAAC;YACX,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,2DAA2D,CAAC;YAChF,aAAa,CAAC,iBAAiB,CAAC;YAChC,IAAA,kBAAK,EAAC,IAAA,mBAAO,EAAC,MAAA,iBAAiB,CAAC,QAAQ,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,aAAa,iCAAM,iBAAiB,GAAK,KAAK,EAAG,CAAC,CAAC;YAChH,SAAS,CAAC,iBAAiB,CAAC;SAC7B,CAAC,CAAC;IAEL,CAAC,CAAC;AAEJ,CAAC;AAfD,4BAeC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "route-component-schematic",
|
|
4
|
+
"allOf": [
|
|
5
|
+
{
|
|
6
|
+
"$ref": "#/definitions/angular"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"$ref": "#/definitions/routeComponent"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"definitions": {
|
|
13
|
+
"angular": {
|
|
14
|
+
"allOf": [
|
|
15
|
+
{
|
|
16
|
+
"$ref": "#/definitions/general"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"componentName": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"name": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"context": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "The context use to generate proper names for class, files, etc"
|
|
30
|
+
},
|
|
31
|
+
"nestModule": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "The module name for the table nest operations"
|
|
34
|
+
},
|
|
35
|
+
"controllerName": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"backend": {
|
|
39
|
+
"$ref": "#/definitions/backend"
|
|
40
|
+
},
|
|
41
|
+
"directory": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "A directory name or absolute path where the files should be generated. Relative to the project and feature base path if a feature is defined"
|
|
44
|
+
},
|
|
45
|
+
"shared": {
|
|
46
|
+
"type": "boolean",
|
|
47
|
+
"description": "Whether the generated code is used across the project",
|
|
48
|
+
"default": false
|
|
49
|
+
},
|
|
50
|
+
"scope": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"prefix": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"openApi": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"additionalProperties": true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"backend": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "The backend that should be used to handel data",
|
|
67
|
+
"enum": [
|
|
68
|
+
"none",
|
|
69
|
+
"nestjs",
|
|
70
|
+
"open-api",
|
|
71
|
+
"local"
|
|
72
|
+
],
|
|
73
|
+
"default": "none"
|
|
74
|
+
},
|
|
75
|
+
"component": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"name": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"moduleSpecifier": {
|
|
82
|
+
"type": "string"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"required": [
|
|
86
|
+
"name"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"general": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"properties": {
|
|
92
|
+
"project": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"description": "Project name where the files should be generated"
|
|
95
|
+
},
|
|
96
|
+
"feature": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"description": "Feature name where the files should be generated"
|
|
99
|
+
},
|
|
100
|
+
"overwrite": {
|
|
101
|
+
"anyOf": [
|
|
102
|
+
{
|
|
103
|
+
"type": "boolean"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"type": "array",
|
|
107
|
+
"items": {
|
|
108
|
+
"type": "string"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"description": "Overwrite existing files",
|
|
113
|
+
"default": false
|
|
114
|
+
},
|
|
115
|
+
"overwriteHtml": {
|
|
116
|
+
"type": "boolean",
|
|
117
|
+
"default": false
|
|
118
|
+
},
|
|
119
|
+
"replace": {
|
|
120
|
+
"type": "boolean",
|
|
121
|
+
"default": false
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"routeComponent": {
|
|
126
|
+
"allOf": [
|
|
127
|
+
{
|
|
128
|
+
"$ref": "#/definitions/component"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"type": "object",
|
|
132
|
+
"properties": {
|
|
133
|
+
"path": {
|
|
134
|
+
"type": "string"
|
|
135
|
+
},
|
|
136
|
+
"outlet": {
|
|
137
|
+
"type": "string"
|
|
138
|
+
},
|
|
139
|
+
"data": {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"additionalProperties": true
|
|
142
|
+
},
|
|
143
|
+
"children": {
|
|
144
|
+
"type": "array",
|
|
145
|
+
"items": {
|
|
146
|
+
"additionalProperties": true
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "route-component-schematic",
|
|
4
|
+
"allOf": [
|
|
5
|
+
{
|
|
6
|
+
"$ref": "#/definitions/angular"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"$ref": "#/definitions/routeComponent"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"definitions": {
|
|
13
|
+
"angular": {
|
|
14
|
+
"$ref": "../angular.schema.json"
|
|
15
|
+
},
|
|
16
|
+
"routeComponent": {
|
|
17
|
+
"$ref": "../route-component.schema.json"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "route-component",
|
|
4
|
+
"allOf": [
|
|
5
|
+
{
|
|
6
|
+
"$ref": "#/definitions/component"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"path": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"outlet": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"data": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": true
|
|
20
|
+
},
|
|
21
|
+
"children": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": {
|
|
24
|
+
"additionalProperties": true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"definitions": {
|
|
31
|
+
"component": {
|
|
32
|
+
"$ref": "./component.schema.json"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
package/src/template.schema.json
CHANGED
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
"formComponentSchematic": {
|
|
23
23
|
"$ref": "schematics/form/form-component/template.schema.json"
|
|
24
24
|
},
|
|
25
|
+
"routeComponentSchematic": {
|
|
26
|
+
"$ref": "schematics/route-component/template.schema.json"
|
|
27
|
+
},
|
|
25
28
|
"formDefinitionSchematic": {
|
|
26
29
|
"$ref": "schematics/form/form-definition/template.schema.json"
|
|
27
30
|
},
|
|
@@ -136,6 +139,9 @@
|
|
|
136
139
|
"checkboxFormControl": {
|
|
137
140
|
"$ref": "schematics/checkbox-form-control.schema.json"
|
|
138
141
|
},
|
|
142
|
+
"component": {
|
|
143
|
+
"$ref": "schematics/component.schema.json"
|
|
144
|
+
},
|
|
139
145
|
"control": {
|
|
140
146
|
"$ref": "schematics/control.schema.json"
|
|
141
147
|
},
|
|
@@ -187,6 +193,9 @@
|
|
|
187
193
|
"property": {
|
|
188
194
|
"$ref": "schematics/property.schema.json"
|
|
189
195
|
},
|
|
196
|
+
"routeComponent": {
|
|
197
|
+
"$ref": "schematics/route-component.schema.json"
|
|
198
|
+
},
|
|
190
199
|
"selectFormControl": {
|
|
191
200
|
"$ref": "schematics/select-form-control.schema.json"
|
|
192
201
|
},
|