ngssm-schematics 14.0.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/README.md +111 -0
- package/esm2020/lib/ngssm-schematics.module.mjs +16 -0
- package/esm2020/ngssm-schematics.mjs +5 -0
- package/esm2020/public-api.mjs +5 -0
- package/fesm2015/ngssm-schematics.mjs +27 -0
- package/fesm2015/ngssm-schematics.mjs.map +1 -0
- package/fesm2020/ngssm-schematics.mjs +27 -0
- package/fesm2020/ngssm-schematics.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/ngssm-schematics.module.d.ts +6 -0
- package/package.json +43 -0
- package/public-api.d.ts +1 -0
- package/schematics/action/files/__name@dasherize__.action.ts.template +5 -0
- package/schematics/action/index.d.ts +3 -0
- package/schematics/action/index.js +20 -0
- package/schematics/action/index.js.map +1 -0
- package/schematics/action/schema.json +28 -0
- package/schematics/add-eslint/index.d.ts +2 -0
- package/schematics/add-eslint/index.js +69 -0
- package/schematics/add-eslint/index.js.map +1 -0
- package/schematics/add-eslint/schema.json +11 -0
- package/schematics/add-fontawesome/index.d.ts +3 -0
- package/schematics/add-fontawesome/index.js +59 -0
- package/schematics/add-fontawesome/index.js.map +1 -0
- package/schematics/add-fontawesome/schema.json +11 -0
- package/schematics/add-material/index.d.ts +2 -0
- package/schematics/add-material/index.js +30 -0
- package/schematics/add-material/index.js.map +1 -0
- package/schematics/add-material/schema.json +11 -0
- package/schematics/collection.json +62 -0
- package/schematics/component/component-options.d.ts +19 -0
- package/schematics/component/component-options.js +3 -0
- package/schematics/component/component-options.js.map +1 -0
- package/schematics/component/files/__name@dasherize__.component.ts.template +27 -0
- package/schematics/component/index.d.ts +3 -0
- package/schematics/component/index.js +68 -0
- package/schematics/component/index.js.map +1 -0
- package/schematics/component/schema.json +135 -0
- package/schematics/effect/files/__name@dasherize__.effect.ts.template +16 -0
- package/schematics/effect/index.d.ts +3 -0
- package/schematics/effect/index.js +41 -0
- package/schematics/effect/index.js.map +1 -0
- package/schematics/effect/schema.json +41 -0
- package/schematics/exec-lint/index.d.ts +2 -0
- package/schematics/exec-lint/index.js +12 -0
- package/schematics/exec-lint/index.js.map +1 -0
- package/schematics/exec-lint/schema.json +11 -0
- package/schematics/feature-state/files/__name@dasherize__.state.ts.template +22 -0
- package/schematics/feature-state/index.d.ts +3 -0
- package/schematics/feature-state/index.js +21 -0
- package/schematics/feature-state/index.js.map +1 -0
- package/schematics/feature-state/schema.json +28 -0
- package/schematics/module/files/__name@dasherize__-routing.module.ts.template +10 -0
- package/schematics/module/files/__name@dasherize__.module.ts.template +10 -0
- package/schematics/module/files/actions/__name@dasherize__-action-type.ts.template +1 -0
- package/schematics/module/files/actions/index.ts.template +1 -0
- package/schematics/module/files/components/.gitkeep +0 -0
- package/schematics/module/files/effects/.gitkeep +0 -0
- package/schematics/module/files/guards/.gitkeep +0 -0
- package/schematics/module/files/model/.gitkeep +0 -0
- package/schematics/module/files/public-api.ts.template +1 -0
- package/schematics/module/files/reducers/.gitkeep +0 -0
- package/schematics/module/files/services/.gitkeep +0 -0
- package/schematics/module/files/state/__name@dasherize__.state.ts.template +22 -0
- package/schematics/module/files/state/index.ts.template +1 -0
- package/schematics/module/index.d.ts +3 -0
- package/schematics/module/index.js +30 -0
- package/schematics/module/index.js.map +1 -0
- package/schematics/module/module-options.d.ts +4 -0
- package/schematics/module/module-options.js +3 -0
- package/schematics/module/module-options.js.map +1 -0
- package/schematics/module/schema.json +30 -0
- package/schematics/ng-add/index.d.ts +3 -0
- package/schematics/ng-add/index.js +42 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.d.ts +8 -0
- package/schematics/ng-add/schema.js +3 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/ng-add/schema.json +29 -0
- package/schematics/reducer/files/__name@dasherize__.reducer.ts.template +18 -0
- package/schematics/reducer/index.d.ts +3 -0
- package/schematics/reducer/index.js +41 -0
- package/schematics/reducer/index.js.map +1 -0
- package/schematics/reducer/schema.json +41 -0
- package/schematics/utilities/base-options.d.ts +4 -0
- package/schematics/utilities/base-options.js +3 -0
- package/schematics/utilities/base-options.js.map +1 -0
- package/schematics/utilities/helpers.d.ts +5 -0
- package/schematics/utilities/helpers.js +39 -0
- package/schematics/utilities/helpers.js.map +1 -0
- package/schematics/utilities/index.d.ts +2 -0
- package/schematics/utilities/index.js +19 -0
- package/schematics/utilities/index.js.map +1 -0
- package/schematics/utilities/with-provider-options.d.ts +6 -0
- package/schematics/utilities/with-provider-options.js +3 -0
- package/schematics/utilities/with-provider-options.js.map +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseOptions } from '../utilities';
|
|
2
|
+
export interface ComponentOptions extends BaseOptions {
|
|
3
|
+
project?: string;
|
|
4
|
+
displayBlock?: boolean;
|
|
5
|
+
inlineStyle?: boolean;
|
|
6
|
+
inlineTemplate?: boolean;
|
|
7
|
+
viewEncapsulation?: string;
|
|
8
|
+
changeDetection?: string;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
style?: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
skipTests?: boolean;
|
|
13
|
+
flat?: boolean;
|
|
14
|
+
skipImport?: boolean;
|
|
15
|
+
selector?: string;
|
|
16
|
+
skipSelector?: string;
|
|
17
|
+
module?: string;
|
|
18
|
+
export?: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-options.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/component/component-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { NgSsmComponent, Store } from 'ngssm-store';
|
|
4
|
+
|
|
5
|
+
@Component({<% if(!skipSelector) {%>
|
|
6
|
+
selector: '<%= selector %>',<%}%><% if(inlineTemplate) { %>
|
|
7
|
+
template: `
|
|
8
|
+
<p>
|
|
9
|
+
<%= dasherize(name) %> works!
|
|
10
|
+
</p>
|
|
11
|
+
`,<% } else { %>
|
|
12
|
+
templateUrl: './<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.html',<% } if(inlineStyle) { %>
|
|
13
|
+
styles: [<% if(displayBlock){ %>
|
|
14
|
+
`
|
|
15
|
+
:host {
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
`<% } %>
|
|
19
|
+
]<% } else if (style !== 'none') { %>
|
|
20
|
+
styleUrls: ['./<%= dasherize(name) %><%= type ? '.' + dasherize(type): '' %>.<%= style %>']<% } %>,
|
|
21
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
22
|
+
})
|
|
23
|
+
export class <%= classify(name) %><%= classify(type) %> extends NgSsmComponent {
|
|
24
|
+
constructor(store: Store) {
|
|
25
|
+
super(store);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
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 = void 0;
|
|
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
|
+
function getAngularComponentExtensions(extensions) {
|
|
29
|
+
if ((extensions === null || extensions === void 0 ? void 0 : extensions.schematics) && extensions.schematics['@schematics/angular:component']) {
|
|
30
|
+
return extensions.schematics['@schematics/angular:component'];
|
|
31
|
+
}
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
function component(options) {
|
|
35
|
+
return (host) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const workspace = yield (0, workspace_1.getWorkspace)(host);
|
|
37
|
+
const project = workspace.projects.get(options.project);
|
|
38
|
+
const angularComponentOptions = Object.assign(Object.assign(Object.assign({}, options), getAngularComponentExtensions(workspace.extensions)), getAngularComponentExtensions(project === null || project === void 0 ? void 0 : project.extensions));
|
|
39
|
+
const parsedPath = (0, parse_name_1.parseName)(angularComponentOptions.path, angularComponentOptions.name);
|
|
40
|
+
angularComponentOptions.name = parsedPath.name; // component name
|
|
41
|
+
angularComponentOptions.path = parsedPath.path; // component path
|
|
42
|
+
// component selector
|
|
43
|
+
angularComponentOptions.selector =
|
|
44
|
+
angularComponentOptions.selector || buildSelector(angularComponentOptions, (project && project.prefix) || '');
|
|
45
|
+
const componentPath = `/${angularComponentOptions.path}/` + (angularComponentOptions.flat ? '' : core_1.strings.dasherize(angularComponentOptions.name) + '/');
|
|
46
|
+
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
47
|
+
(0, schematics_1.applyTemplates)({
|
|
48
|
+
classify: core_1.strings.classify,
|
|
49
|
+
dasherize: core_1.strings.dasherize,
|
|
50
|
+
name: angularComponentOptions.name,
|
|
51
|
+
skipSelector: angularComponentOptions.skipSelector,
|
|
52
|
+
inlineTemplate: angularComponentOptions.inlineTemplate,
|
|
53
|
+
inlineStyle: angularComponentOptions.inlineStyle,
|
|
54
|
+
displayBlock: angularComponentOptions.displayBlock,
|
|
55
|
+
selector: angularComponentOptions.selector,
|
|
56
|
+
type: angularComponentOptions.type,
|
|
57
|
+
style: angularComponentOptions.style
|
|
58
|
+
}),
|
|
59
|
+
(0, schematics_1.move)((0, core_1.normalize)(componentPath))
|
|
60
|
+
]);
|
|
61
|
+
return (0, schematics_1.chain)([
|
|
62
|
+
(0, schematics_1.externalSchematic)('@schematics/angular', 'component', angularComponentOptions),
|
|
63
|
+
(0, schematics_1.mergeWith)(templateSource, schematics_1.MergeStrategy.Overwrite)
|
|
64
|
+
]);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
exports.component = component;
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/component/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAWoC;AACpC,+CAA0D;AAC1D,qEAAqE;AACrE,uEAAmE;AAInE,SAAS,aAAa,CAAC,OAAyB,EAAE,aAAqB;IACrE,IAAI,QAAQ,GAAG,cAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,sCAAsC;QACtC,QAAQ,GAAG,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;KAC5C;SAAM,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,aAAa,EAAE;QACxD,QAAQ,GAAG,GAAG,aAAa,IAAI,QAAQ,EAAE,CAAC;KAC3C;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,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AAG,CAAC,CAAC;QAEpI,MAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE;YAC3C,IAAA,2BAAc,EAAC;gBACb,QAAQ,EAAE,cAAO,CAAC,QAAQ;gBAC1B,SAAS,EAAE,cAAO,CAAC,SAAS;gBAC5B,IAAI,EAAE,uBAAuB,CAAC,IAAI;gBAClC,YAAY,EAAE,uBAAuB,CAAC,YAAY;gBAClD,cAAc,EAAE,uBAAuB,CAAC,cAAc;gBACtD,WAAW,EAAE,uBAAuB,CAAC,WAAW;gBAChD,YAAY,EAAE,uBAAuB,CAAC,YAAY;gBAClD,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;gBAC1C,IAAI,EAAE,uBAAuB,CAAC,IAAI;gBAClC,KAAK,EAAE,uBAAuB,CAAC,KAAK;aACrC,CAAC;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;AA3CD,8BA2CC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
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
|
+
"viewEncapsulation": {
|
|
55
|
+
"description": "The view encapsulation strategy to use in the new component.",
|
|
56
|
+
"enum": ["Emulated", "None", "ShadowDom"],
|
|
57
|
+
"type": "string",
|
|
58
|
+
"alias": "v",
|
|
59
|
+
"default": "Emulated",
|
|
60
|
+
"x-user-analytics": 11
|
|
61
|
+
},
|
|
62
|
+
"changeDetection": {
|
|
63
|
+
"description": "The change detection strategy to use in the new component.",
|
|
64
|
+
"enum": ["Default", "OnPush"],
|
|
65
|
+
"type": "string",
|
|
66
|
+
"default": "Default",
|
|
67
|
+
"alias": "c"
|
|
68
|
+
},
|
|
69
|
+
"prefix": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"description": "The prefix to apply to the generated component selector.",
|
|
72
|
+
"alias": "p",
|
|
73
|
+
"oneOf": [
|
|
74
|
+
{
|
|
75
|
+
"maxLength": 0
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"minLength": 1,
|
|
79
|
+
"format": "html-selector"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"style": {
|
|
84
|
+
"description": "The file extension or preprocessor to use for style files, or 'none' to skip generating the style file.",
|
|
85
|
+
"type": "string",
|
|
86
|
+
"default": "css",
|
|
87
|
+
"enum": ["css", "scss", "sass", "less", "none"],
|
|
88
|
+
"x-user-analytics": 5
|
|
89
|
+
},
|
|
90
|
+
"type": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\".",
|
|
93
|
+
"default": "Component"
|
|
94
|
+
},
|
|
95
|
+
"skipTests": {
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"description": "Do not create \"spec.ts\" test files for the new component.",
|
|
98
|
+
"default": false,
|
|
99
|
+
"x-user-analytics": 12
|
|
100
|
+
},
|
|
101
|
+
"flat": {
|
|
102
|
+
"type": "boolean",
|
|
103
|
+
"description": "Create the new files at the top level of the current project.",
|
|
104
|
+
"default": false
|
|
105
|
+
},
|
|
106
|
+
"skipImport": {
|
|
107
|
+
"type": "boolean",
|
|
108
|
+
"description": "Do not import this component into the owning NgModule.",
|
|
109
|
+
"default": false,
|
|
110
|
+
"x-user-analytics": 18
|
|
111
|
+
},
|
|
112
|
+
"selector": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"format": "html-selector",
|
|
115
|
+
"description": "The HTML selector to use for this component."
|
|
116
|
+
},
|
|
117
|
+
"skipSelector": {
|
|
118
|
+
"type": "boolean",
|
|
119
|
+
"default": false,
|
|
120
|
+
"description": "Specifies if the component should have a selector or not."
|
|
121
|
+
},
|
|
122
|
+
"module": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"description": "The declaring NgModule.",
|
|
125
|
+
"alias": "m"
|
|
126
|
+
},
|
|
127
|
+
"export": {
|
|
128
|
+
"type": "boolean",
|
|
129
|
+
"default": false,
|
|
130
|
+
"description": "The declaring NgModule exports this component.",
|
|
131
|
+
"x-user-analytics": 19
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"required": ["name"]
|
|
135
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Injectable, Provider } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { Effect, Store, State, Action, NGSSM_EFFECT } from 'ngssm-store';
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export class <%= classify(name) %>Effect implements Effect {
|
|
7
|
+
public readonly processedActions: string[] = [];
|
|
8
|
+
|
|
9
|
+
public processAction(store: Store, state: State, action: Action): void {}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const <%= providerName %>: Provider = {
|
|
13
|
+
provide: NGSSM_EFFECT,
|
|
14
|
+
useClass: <%= classify(name) %>Effect,
|
|
15
|
+
multi: true
|
|
16
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
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.effect = void 0;
|
|
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 find_module_1 = require("@schematics/angular/utility/find-module");
|
|
17
|
+
const helpers_1 = require("../utilities/helpers");
|
|
18
|
+
function effect(options) {
|
|
19
|
+
return (host) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const workspace = yield (0, workspace_1.getWorkspace)(host);
|
|
21
|
+
const project = workspace.projects.get(options.project);
|
|
22
|
+
if (!project) {
|
|
23
|
+
throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
|
|
24
|
+
}
|
|
25
|
+
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
26
|
+
options.providerName = `${core_1.strings.camelize(options.name)}EffectProvider`;
|
|
27
|
+
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
28
|
+
(0, schematics_1.applyTemplates)({
|
|
29
|
+
classify: core_1.strings.classify,
|
|
30
|
+
dasherize: core_1.strings.dasherize,
|
|
31
|
+
camelize: core_1.strings.camelize,
|
|
32
|
+
name: options.name,
|
|
33
|
+
providerName: options.providerName
|
|
34
|
+
}),
|
|
35
|
+
(0, schematics_1.move)((0, core_1.normalize)(options.path))
|
|
36
|
+
]);
|
|
37
|
+
return (0, schematics_1.chain)([(0, helpers_1.addDeclarationToNgModule)(options, 'effect'), (0, schematics_1.mergeWith)(templateSource)]);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.effect = effect;
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/effect/index.ts"],"names":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0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsEffect",
|
|
4
|
+
"title": "Effect schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"description": "The name of the effect.",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"path": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"format": "path",
|
|
18
|
+
"description": "The path to create the simple schematic within.",
|
|
19
|
+
"visible": false,
|
|
20
|
+
"$default": {
|
|
21
|
+
"$source": "workingDirectory"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"module": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "The declaring NgModule.",
|
|
27
|
+
"visible": false
|
|
28
|
+
},
|
|
29
|
+
"project": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "The name of the project.",
|
|
32
|
+
"$default": {
|
|
33
|
+
"$source": "projectName"
|
|
34
|
+
},
|
|
35
|
+
"visible": false
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"required": [
|
|
39
|
+
"name"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
4
|
+
function default_1() {
|
|
5
|
+
return (tree, context) => {
|
|
6
|
+
context.logger.info('Lint execution...');
|
|
7
|
+
(0, child_process_1.execSync)('npm run lint -- --fix', { stdio: 'inherit' });
|
|
8
|
+
return tree;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
exports.default = default_1;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/exec-lint/index.ts"],"names":[],"mappings":";;AACA,iDAAyC;AAEzC;IACE,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QACzC,IAAA,wBAAQ,EAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAExD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAPD,4BAOC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsExeclint",
|
|
4
|
+
"title": "Execute lint when installation is done",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"description": "Execute lint when installation is done",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
},
|
|
10
|
+
"required": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import update, { Spec } from 'immutability-helper';
|
|
2
|
+
|
|
3
|
+
import { NgSsmFeatureState, State } from 'ngssm-store';
|
|
4
|
+
|
|
5
|
+
export const select<%= classify(name) %>State = (state: State): <%= classify(name) %>State =>
|
|
6
|
+
state[<%= classify(name) %>StateSpecification.featureStateKey] as <%= classify(name) %>State;
|
|
7
|
+
|
|
8
|
+
export const update<%= classify(name) %>State = (state: State, command: Spec<<%= classify(name) %>State, never>): State =>
|
|
9
|
+
update(state, {
|
|
10
|
+
[<%= classify(name) %>StateSpecification.featureStateKey]: command
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export interface <%= classify(name) %>State {}
|
|
14
|
+
|
|
15
|
+
@NgSsmFeatureState({
|
|
16
|
+
featureStateKey: <%= classify(name) %>StateSpecification.featureStateKey,
|
|
17
|
+
initialState: <%= classify(name) %>StateSpecification.initialState
|
|
18
|
+
})
|
|
19
|
+
export class <%= classify(name) %>StateSpecification {
|
|
20
|
+
public static readonly featureStateKey = '<%= dasherize(name) %>-state';
|
|
21
|
+
public static readonly initialState: <%= classify(name) %>State = {};
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.featureState = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const core_1 = require("@angular-devkit/core");
|
|
6
|
+
function featureState(options) {
|
|
7
|
+
return () => {
|
|
8
|
+
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
9
|
+
(0, schematics_1.applyTemplates)({
|
|
10
|
+
classify: core_1.strings.classify,
|
|
11
|
+
dasherize: core_1.strings.dasherize,
|
|
12
|
+
camelize: core_1.strings.camelize,
|
|
13
|
+
name: options.name
|
|
14
|
+
}),
|
|
15
|
+
(0, schematics_1.move)((0, core_1.normalize)(options.path))
|
|
16
|
+
]);
|
|
17
|
+
return (0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
exports.featureState = featureState;
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/feature-state/index.ts"],"names":[],"mappings":";;;AAAA,2DAAsG;AACtG,+CAA0D;AAI1D,SAAgB,YAAY,CAAC,OAAoB;IAC/C,OAAO,GAAG,EAAE;QACV,MAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE;YAC3C,IAAA,2BAAc,EAAC;gBACb,QAAQ,EAAE,cAAO,CAAC,QAAQ;gBAC1B,SAAS,EAAE,cAAO,CAAC,SAAS;gBAC5B,QAAQ,EAAE,cAAO,CAAC,QAAQ;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC;YACF,IAAA,iBAAI,EAAC,IAAA,gBAAS,EAAC,OAAO,CAAC,IAAc,CAAC,CAAC;SACxC,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC,CAAC,IAAA,sBAAS,EAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC;AACJ,CAAC;AAdD,oCAcC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsFeatureState",
|
|
4
|
+
"title": "Feature state schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"description": "The name of the feature state.",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"path": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"format": "path",
|
|
18
|
+
"description": "The path to create the simple schematic within.",
|
|
19
|
+
"visible": false,
|
|
20
|
+
"$default": {
|
|
21
|
+
"$source": "workingDirectory"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": [
|
|
26
|
+
"name"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { RouterModule, Routes } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
const routes: Routes = [];
|
|
5
|
+
|
|
6
|
+
@NgModule({
|
|
7
|
+
imports: [RouterModule.forChild(routes)],
|
|
8
|
+
providers: [RouterModule]
|
|
9
|
+
})
|
|
10
|
+
export class <%= classify(name) %>RoutingModule {}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { <%= classify(name) %>RoutingModule } from './<%= dasherize(name) %>-routing.module';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
declarations: [],
|
|
7
|
+
imports: [<%= classify(name) %>RoutingModule],
|
|
8
|
+
providers: []
|
|
9
|
+
})
|
|
10
|
+
export class <%= classify(name) %>Module {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export enum <%= classify(name) %>ActionType {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './<%= dasherize(name) %>-action-type';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './<%= dasherize(name) %>.module';
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import update, { Spec } from 'immutability-helper';
|
|
2
|
+
|
|
3
|
+
import { NgSsmFeatureState, State } from 'ngssm-store';
|
|
4
|
+
|
|
5
|
+
export const select<%= classify(name) %>State = (state: State): <%= classify(name) %>State =>
|
|
6
|
+
state[<%= classify(name) %>StateSpecification.featureStateKey] as <%= classify(name) %>State;
|
|
7
|
+
|
|
8
|
+
export const update<%= classify(name) %>State = (state: State, command: Spec<<%= classify(name) %>State, never>): State =>
|
|
9
|
+
update(state, {
|
|
10
|
+
[<%= classify(name) %>StateSpecification.featureStateKey]: command
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export interface <%= classify(name) %>State {}
|
|
14
|
+
|
|
15
|
+
@NgSsmFeatureState({
|
|
16
|
+
featureStateKey: <%= classify(name) %>StateSpecification.featureStateKey,
|
|
17
|
+
initialState: <%= classify(name) %>StateSpecification.initialState
|
|
18
|
+
})
|
|
19
|
+
export class <%= classify(name) %>StateSpecification {
|
|
20
|
+
public static readonly featureStateKey = '<%= dasherize(name) %>-state';
|
|
21
|
+
public static readonly initialState: <%= classify(name) %>State = {};
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './<% dasherize(name) %>.state';
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
13
|
+
const core_1 = require("@angular-devkit/core");
|
|
14
|
+
function default_1(options) {
|
|
15
|
+
return (_, __) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const modulePath = options.path + '/' + options.name;
|
|
17
|
+
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
18
|
+
(0, schematics_1.applyTemplates)({
|
|
19
|
+
classify: core_1.strings.classify,
|
|
20
|
+
dasherize: core_1.strings.dasherize,
|
|
21
|
+
camelize: core_1.strings.camelize,
|
|
22
|
+
name: options.name
|
|
23
|
+
}),
|
|
24
|
+
(0, schematics_1.move)((0, core_1.normalize)(modulePath))
|
|
25
|
+
]);
|
|
26
|
+
return (0, schematics_1.mergeWith)(templateSource, schematics_1.MergeStrategy.Overwrite);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.default = default_1;
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/module/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAsI;AACtI,+CAA0D;AAG1D,mBAAyB,OAAsB;IAC7C,OAAO,CAAO,CAAO,EAAE,EAAoB,EAAE,EAAE;QAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,GAAG,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;QACrD,MAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE;YAC3C,IAAA,2BAAc,EAAC;gBACb,QAAQ,EAAE,cAAO,CAAC,QAAQ;gBAC1B,SAAS,EAAE,cAAO,CAAC,SAAS;gBAC5B,QAAQ,EAAE,cAAO,CAAC,QAAQ;gBAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC;YACF,IAAA,iBAAI,EAAC,IAAA,gBAAS,EAAC,UAAU,CAAC,CAAC;SAC5B,CAAC,CAAC;QAEH,OAAO,IAAA,sBAAS,EAAC,cAAc,EAAE,0BAAa,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC,CAAA,CAAC;AACJ,CAAC;AAfD,4BAeC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-options.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/module/module-options.ts"],"names":[],"mappings":""}
|