ngssm-schematics 19.3.7 → 19.3.9
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/README.md +0 -1
- package/package.json +1 -1
- package/schematics/collection.json +0 -5
- package/schematics/component/files/__name@dasherize__.component.ts.template +0 -29
- package/schematics/component/index.d.ts +0 -3
- package/schematics/component/index.js +0 -58
- package/schematics/component/index.js.map +0 -1
- package/schematics/component/schema.json +0 -141
package/README.md
CHANGED
|
@@ -99,7 +99,6 @@ Add *@angular/material* to the project.
|
|
|
99
99
|
| Schematic | Description |
|
|
100
100
|
|---|---|
|
|
101
101
|
| feature-state | Allow creating a state associated to a user feature |
|
|
102
|
-
| component | Creation of a component which derives from **NgSsmComponent** |
|
|
103
102
|
| action | Creation of an action which implements **Action** |
|
|
104
103
|
| reducer | Creation of a reducer which implements **Reducer** |
|
|
105
104
|
| effect | Creation of an effect which implements **Effect** |
|
package/package.json
CHANGED
|
@@ -37,11 +37,6 @@
|
|
|
37
37
|
"factory": "./feature-state/index#featureState",
|
|
38
38
|
"schema": "./feature-state/schema.json"
|
|
39
39
|
},
|
|
40
|
-
"component": {
|
|
41
|
-
"description": "Generate a component.",
|
|
42
|
-
"factory": "./component/index#component",
|
|
43
|
-
"schema": "./component/schema.json"
|
|
44
|
-
},
|
|
45
40
|
"reducer": {
|
|
46
41
|
"description": "Generate a reducer.",
|
|
47
42
|
"factory": "./reducer/index#reducer",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy } from '@angular/core';<% if(standalone) {%>
|
|
2
|
-
import { CommonModule } from '@angular/common';<% } %>
|
|
3
|
-
|
|
4
|
-
import { NgSsmComponent, Store } from 'ngssm-store';
|
|
5
|
-
|
|
6
|
-
@Component({<% if(!skipSelector) {%>
|
|
7
|
-
selector: '<%= selector %>',<%}%>
|
|
8
|
-
imports: [CommonModule],<% if(inlineTemplate) { %>
|
|
9
|
-
template: `
|
|
10
|
-
<p>
|
|
11
|
-
<%= dasherize(name) %> works!
|
|
12
|
-
</p>
|
|
13
|
-
`,<% } else { %>
|
|
14
|
-
templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.html',<% } if(inlineStyle) { %>
|
|
15
|
-
styles: [<% if(displayBlock){ %>
|
|
16
|
-
`
|
|
17
|
-
:host {
|
|
18
|
-
display: block;
|
|
19
|
-
}
|
|
20
|
-
`<% } %>
|
|
21
|
-
]<% } else if (style !== 'none') { %>
|
|
22
|
-
styleUrls: ['./<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.<%= style %>']<% } %>,
|
|
23
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
24
|
-
})
|
|
25
|
-
export class <%= classify(name) %><%= classify(type) %> extends NgSsmComponent {
|
|
26
|
-
constructor(store: Store) {
|
|
27
|
-
super(store);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.component = component;
|
|
13
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
|
-
const core_1 = require("@angular-devkit/core");
|
|
15
|
-
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
16
|
-
const parse_name_1 = require("@schematics/angular/utility/parse-name");
|
|
17
|
-
function buildSelector(options, projectPrefix) {
|
|
18
|
-
let selector = core_1.strings.dasherize(options.name);
|
|
19
|
-
if (options.prefix) {
|
|
20
|
-
// use prefix from options if provided
|
|
21
|
-
selector = `${options.prefix}-${selector}`;
|
|
22
|
-
}
|
|
23
|
-
else if (options.prefix === undefined && projectPrefix) {
|
|
24
|
-
selector = `${projectPrefix}-${selector}`;
|
|
25
|
-
}
|
|
26
|
-
return selector;
|
|
27
|
-
}
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
-
function getAngularComponentExtensions(extensions) {
|
|
30
|
-
if ((extensions === null || extensions === void 0 ? void 0 : extensions.schematics) && extensions.schematics['@schematics/angular:component']) {
|
|
31
|
-
return extensions.schematics['@schematics/angular:component'];
|
|
32
|
-
}
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
function component(options) {
|
|
36
|
-
return (host) => __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
const workspace = yield (0, workspace_1.getWorkspace)(host);
|
|
38
|
-
const project = workspace.projects.get(options.project);
|
|
39
|
-
const angularComponentOptions = Object.assign(Object.assign(Object.assign({}, options), getAngularComponentExtensions(workspace.extensions)), getAngularComponentExtensions(project === null || project === void 0 ? void 0 : project.extensions));
|
|
40
|
-
const parsedPath = (0, parse_name_1.parseName)(angularComponentOptions.path, angularComponentOptions.name);
|
|
41
|
-
angularComponentOptions.name = parsedPath.name; // component name
|
|
42
|
-
angularComponentOptions.path = parsedPath.path; // component path
|
|
43
|
-
// component selector
|
|
44
|
-
angularComponentOptions.selector =
|
|
45
|
-
angularComponentOptions.selector || buildSelector(angularComponentOptions, (project && project.prefix) || '');
|
|
46
|
-
angularComponentOptions.standalone = true;
|
|
47
|
-
const componentPath = `/${angularComponentOptions.path}/` + (angularComponentOptions.flat ? '' : core_1.strings.dasherize(angularComponentOptions.name) + '/');
|
|
48
|
-
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
49
|
-
(0, schematics_1.applyTemplates)(Object.assign({ classify: core_1.strings.classify, dasherize: core_1.strings.dasherize }, angularComponentOptions)),
|
|
50
|
-
(0, schematics_1.move)((0, core_1.normalize)(componentPath))
|
|
51
|
-
]);
|
|
52
|
-
return (0, schematics_1.chain)([
|
|
53
|
-
(0, schematics_1.externalSchematic)('@schematics/angular', 'component', angularComponentOptions),
|
|
54
|
-
(0, schematics_1.mergeWith)(templateSource, schematics_1.MergeStrategy.Overwrite)
|
|
55
|
-
]);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/component/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAsCA,8BAqCC;AA3ED,2DAWoC;AACpC,+CAA0D;AAC1D,qEAAqE;AACrE,uEAAmE;AAGnE,SAAS,aAAa,CAAC,OAAsC,EAAE,aAAqB;IAClF,IAAI,QAAQ,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,sCAAsC;QACtC,QAAQ,GAAG,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;IAC7C,CAAC;SAAM,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,aAAa,EAAE,CAAC;QACzD,QAAQ,GAAG,GAAG,aAAa,IAAI,QAAQ,EAAE,CAAC;IAC5C,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,8DAA8D;AAC9D,SAAS,6BAA6B,CAAC,UAAe;IACpD,IAAI,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,KAAI,UAAU,CAAC,UAAU,CAAC,+BAA+B,CAAC,EAAE,CAAC;QACrF,OAAO,UAAU,CAAC,UAAU,CAAC,+B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QAAQ,EAAE,cAAO,CAAC,QAAQ,EAC1B,SAAS,EAAE,cAAO,CAAC,SAAS,IACzB,uBAAuB,EAC1B;YACF,IAAA,iBAAI,EAAC,IAAA,gBAAS,EAAC,aAAa,CAAC,CAAC;SAC/B,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,8BAAiB,EAAC,qBAAqB,EAAE,WAAW,EAAE,uBAAuB,CAAC;YAC9E,IAAA,sBAAS,EAAC,cAAc,EAAE,0BAAa,CAAC,SAAS,CAAC;SACnD,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;AACJ,CAAC"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "SchematicsComponent",
|
|
4
|
-
"title": "Component with some store helpers",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"description": "Creates a new component definition in the given or default project.",
|
|
7
|
-
"additionalProperties": false,
|
|
8
|
-
"properties": {
|
|
9
|
-
"path": {
|
|
10
|
-
"type": "string",
|
|
11
|
-
"format": "path",
|
|
12
|
-
"description": "The path at which to create the component file, relative to the current workspace. Default is a folder with the same name as the component in the project root.",
|
|
13
|
-
"visible": false,
|
|
14
|
-
"$default": {
|
|
15
|
-
"$source": "workingDirectory"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"project": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"description": "The name of the project.",
|
|
21
|
-
"$default": {
|
|
22
|
-
"$source": "projectName"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"name": {
|
|
26
|
-
"type": "string",
|
|
27
|
-
"description": "The name of the component.",
|
|
28
|
-
"$default": {
|
|
29
|
-
"$source": "argv",
|
|
30
|
-
"index": 0
|
|
31
|
-
},
|
|
32
|
-
"x-prompt": "What name would you like to use for the component?"
|
|
33
|
-
},
|
|
34
|
-
"displayBlock": {
|
|
35
|
-
"description": "Specifies if the style will contain `:host { display: block; }`.",
|
|
36
|
-
"type": "boolean",
|
|
37
|
-
"default": false,
|
|
38
|
-
"alias": "b"
|
|
39
|
-
},
|
|
40
|
-
"inlineStyle": {
|
|
41
|
-
"description": "Include styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file.",
|
|
42
|
-
"type": "boolean",
|
|
43
|
-
"default": false,
|
|
44
|
-
"alias": "s",
|
|
45
|
-
"x-user-analytics": 9
|
|
46
|
-
},
|
|
47
|
-
"inlineTemplate": {
|
|
48
|
-
"description": "Include template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file.",
|
|
49
|
-
"type": "boolean",
|
|
50
|
-
"default": false,
|
|
51
|
-
"alias": "t",
|
|
52
|
-
"x-user-analytics": 10
|
|
53
|
-
},
|
|
54
|
-
"standalone": {
|
|
55
|
-
"description": "Whether the generated component is standalone.",
|
|
56
|
-
"type": "boolean",
|
|
57
|
-
"default": false,
|
|
58
|
-
"x-user-analytics": "ep.ng_standalone"
|
|
59
|
-
},
|
|
60
|
-
"viewEncapsulation": {
|
|
61
|
-
"description": "The view encapsulation strategy to use in the new component.",
|
|
62
|
-
"enum": ["Emulated", "None", "ShadowDom"],
|
|
63
|
-
"type": "string",
|
|
64
|
-
"alias": "v",
|
|
65
|
-
"default": "Emulated",
|
|
66
|
-
"x-user-analytics": 11
|
|
67
|
-
},
|
|
68
|
-
"changeDetection": {
|
|
69
|
-
"description": "The change detection strategy to use in the new component.",
|
|
70
|
-
"enum": ["Default", "OnPush"],
|
|
71
|
-
"type": "string",
|
|
72
|
-
"default": "Default",
|
|
73
|
-
"alias": "c"
|
|
74
|
-
},
|
|
75
|
-
"prefix": {
|
|
76
|
-
"type": "string",
|
|
77
|
-
"description": "The prefix to apply to the generated component selector.",
|
|
78
|
-
"alias": "p",
|
|
79
|
-
"oneOf": [
|
|
80
|
-
{
|
|
81
|
-
"maxLength": 0
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"minLength": 1,
|
|
85
|
-
"format": "html-selector"
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
},
|
|
89
|
-
"style": {
|
|
90
|
-
"description": "The file extension or preprocessor to use for style files, or 'none' to skip generating the style file.",
|
|
91
|
-
"type": "string",
|
|
92
|
-
"default": "css",
|
|
93
|
-
"enum": ["css", "scss", "sass", "less", "none"],
|
|
94
|
-
"x-user-analytics": 5
|
|
95
|
-
},
|
|
96
|
-
"type": {
|
|
97
|
-
"type": "string",
|
|
98
|
-
"description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\".",
|
|
99
|
-
"default": "Component"
|
|
100
|
-
},
|
|
101
|
-
"skipTests": {
|
|
102
|
-
"type": "boolean",
|
|
103
|
-
"description": "Do not create \"spec.ts\" test files for the new component.",
|
|
104
|
-
"default": false,
|
|
105
|
-
"x-user-analytics": 12
|
|
106
|
-
},
|
|
107
|
-
"flat": {
|
|
108
|
-
"type": "boolean",
|
|
109
|
-
"description": "Create the new files at the top level of the current project.",
|
|
110
|
-
"default": false
|
|
111
|
-
},
|
|
112
|
-
"skipImport": {
|
|
113
|
-
"type": "boolean",
|
|
114
|
-
"description": "Do not import this component into the owning NgModule.",
|
|
115
|
-
"default": false,
|
|
116
|
-
"x-user-analytics": 18
|
|
117
|
-
},
|
|
118
|
-
"selector": {
|
|
119
|
-
"type": "string",
|
|
120
|
-
"format": "html-selector",
|
|
121
|
-
"description": "The HTML selector to use for this component."
|
|
122
|
-
},
|
|
123
|
-
"skipSelector": {
|
|
124
|
-
"type": "boolean",
|
|
125
|
-
"default": false,
|
|
126
|
-
"description": "Specifies if the component should have a selector or not."
|
|
127
|
-
},
|
|
128
|
-
"module": {
|
|
129
|
-
"type": "string",
|
|
130
|
-
"description": "The declaring NgModule.",
|
|
131
|
-
"alias": "m"
|
|
132
|
-
},
|
|
133
|
-
"export": {
|
|
134
|
-
"type": "boolean",
|
|
135
|
-
"default": false,
|
|
136
|
-
"description": "The declaring NgModule exports this component.",
|
|
137
|
-
"x-user-analytics": 19
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
"required": ["name"]
|
|
141
|
-
}
|