ngssm-schematics 16.1.0 → 16.1.2
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/package.json +1 -1
- package/schematics/effect/files/__name@dasherize__.effect.ts.template +2 -8
- package/schematics/effect/index.js +2 -7
- package/schematics/effect/index.js.map +1 -1
- package/schematics/reducer/files/__name@dasherize__.reducer.ts.template +2 -8
- package/schematics/reducer/index.js +2 -7
- package/schematics/reducer/index.js.map +1 -1
- package/schematics/utilities/helpers.d.ts +1 -3
- package/schematics/utilities/helpers.js +1 -30
- package/schematics/utilities/helpers.js.map +1 -1
- package/schematics/utilities/with-provider-options.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Injectable
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
import { Effect, Store, State, Action
|
|
3
|
+
import { Effect, Store, State, Action } from 'ngssm-store';
|
|
4
4
|
|
|
5
5
|
@Injectable()
|
|
6
6
|
export class <%= classify(name) %>Effect implements Effect {
|
|
@@ -8,9 +8,3 @@ export class <%= classify(name) %>Effect implements Effect {
|
|
|
8
8
|
|
|
9
9
|
public processAction(store: Store, state: State, action: Action): void {}
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
export const <%= providerName %>: Provider = {
|
|
13
|
-
provide: NGSSM_EFFECT,
|
|
14
|
-
useClass: <%= classify(name) %>Effect,
|
|
15
|
-
multi: true
|
|
16
|
-
};
|
|
@@ -13,8 +13,6 @@ exports.effect = void 0;
|
|
|
13
13
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
14
|
const core_1 = require("@angular-devkit/core");
|
|
15
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
16
|
function effect(options) {
|
|
19
17
|
return (host) => __awaiter(this, void 0, void 0, function* () {
|
|
20
18
|
const workspace = yield (0, workspace_1.getWorkspace)(host);
|
|
@@ -22,19 +20,16 @@ function effect(options) {
|
|
|
22
20
|
if (!project) {
|
|
23
21
|
throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
|
|
24
22
|
}
|
|
25
|
-
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
26
|
-
options.providerName = `${core_1.strings.camelize(options.name)}EffectProvider`;
|
|
27
23
|
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
28
24
|
(0, schematics_1.applyTemplates)({
|
|
29
25
|
classify: core_1.strings.classify,
|
|
30
26
|
dasherize: core_1.strings.dasherize,
|
|
31
27
|
camelize: core_1.strings.camelize,
|
|
32
|
-
name: options.name
|
|
33
|
-
providerName: options.providerName
|
|
28
|
+
name: options.name
|
|
34
29
|
}),
|
|
35
30
|
(0, schematics_1.move)((0, core_1.normalize)(options.path))
|
|
36
31
|
]);
|
|
37
|
-
return (0, schematics_1.chain)([(0,
|
|
32
|
+
return (0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]);
|
|
38
33
|
});
|
|
39
34
|
}
|
|
40
35
|
exports.effect = effect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/effect/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAiI;AACjI,+CAA0D;AAC1D,qEAAqE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/effect/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAiI;AACjI,+CAA0D;AAC1D,qEAAqE;AAIrE,SAAgB,MAAM,CAAC,OAA4B;IACjD,OAAO,CAAO,IAAU,EAAE,EAAE;QAC1B,MAAM,SAAS,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAiB,CAAC,CAAC;QAClE,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,gCAAmB,CAAC,YAAY,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAC;SAC/E;QAED,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,CAAA,CAAC;AACJ,CAAC;AApBD,wBAoBC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Injectable
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
2
|
|
|
3
|
-
import { Reducer, State, Action
|
|
3
|
+
import { Reducer, State, Action } from 'ngssm-store';
|
|
4
4
|
|
|
5
5
|
@Injectable()
|
|
6
6
|
export class <%= classify(name) %>Reducer implements Reducer {
|
|
@@ -10,9 +10,3 @@ export class <%= classify(name) %>Reducer implements Reducer {
|
|
|
10
10
|
return state;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
export const <%= providerName %>: Provider = {
|
|
15
|
-
provide: NGSSM_REDUCER,
|
|
16
|
-
useClass: <%= classify(name) %>Reducer,
|
|
17
|
-
multi: true
|
|
18
|
-
};
|
|
@@ -13,8 +13,6 @@ exports.reducer = void 0;
|
|
|
13
13
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
14
|
const core_1 = require("@angular-devkit/core");
|
|
15
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
16
|
function reducer(options) {
|
|
19
17
|
return (host) => __awaiter(this, void 0, void 0, function* () {
|
|
20
18
|
const workspace = yield (0, workspace_1.getWorkspace)(host);
|
|
@@ -22,19 +20,16 @@ function reducer(options) {
|
|
|
22
20
|
if (!project) {
|
|
23
21
|
throw new schematics_1.SchematicsException(`Project "${options.project}" does not exist.`);
|
|
24
22
|
}
|
|
25
|
-
options.module = (0, find_module_1.findModuleFromOptions)(host, options);
|
|
26
|
-
options.providerName = `${core_1.strings.camelize(options.name)}ReducerProvider`;
|
|
27
23
|
const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
|
|
28
24
|
(0, schematics_1.applyTemplates)({
|
|
29
25
|
classify: core_1.strings.classify,
|
|
30
26
|
dasherize: core_1.strings.dasherize,
|
|
31
27
|
camelize: core_1.strings.camelize,
|
|
32
|
-
name: options.name
|
|
33
|
-
providerName: options.providerName
|
|
28
|
+
name: options.name
|
|
34
29
|
}),
|
|
35
30
|
(0, schematics_1.move)((0, core_1.normalize)(options.path))
|
|
36
31
|
]);
|
|
37
|
-
return (0, schematics_1.chain)([(0,
|
|
32
|
+
return (0, schematics_1.chain)([(0, schematics_1.mergeWith)(templateSource)]);
|
|
38
33
|
});
|
|
39
34
|
}
|
|
40
35
|
exports.reducer = reducer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/reducer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAiI;AACjI,+CAA0D;AAC1D,qEAAqE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/reducer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAiI;AACjI,+CAA0D;AAC1D,qEAAqE;AAIrE,SAAgB,OAAO,CAAC,OAA4B;IAClD,OAAO,CAAO,IAAU,EAAE,EAAE;QAC1B,MAAM,SAAS,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAiB,CAAC,CAAC;QAClE,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,gCAAmB,CAAC,YAAY,OAAO,CAAC,OAAO,mBAAmB,CAAC,CAAC;SAC/E;QAED,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,CAAA,CAAC;AACJ,CAAC;AApBD,0BAoBC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
|
-
import { WithProviderOptions } from './with-provider-options';
|
|
4
3
|
export declare function readIntoSourceFile(host: Tree, modulePath: string): ts.SourceFile;
|
|
5
|
-
export declare function addDeclarationToNgModule(options: WithProviderOptions, objectType: string): Rule;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.readIntoSourceFile = void 0;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const core_1 = require("@angular-devkit/core");
|
|
6
|
-
const find_module_1 = require("@schematics/angular/utility/find-module");
|
|
7
|
-
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
|
8
|
-
const change_1 = require("@schematics/angular/utility/change");
|
|
9
5
|
const ts = require("typescript");
|
|
10
6
|
function readIntoSourceFile(host, modulePath) {
|
|
11
7
|
const text = host.read(modulePath);
|
|
@@ -15,29 +11,4 @@ function readIntoSourceFile(host, modulePath) {
|
|
|
15
11
|
return ts.createSourceFile(modulePath, text.toString('utf-8'), ts.ScriptTarget.Latest, true);
|
|
16
12
|
}
|
|
17
13
|
exports.readIntoSourceFile = readIntoSourceFile;
|
|
18
|
-
function addDeclarationToNgModule(options, objectType) {
|
|
19
|
-
return (host, context) => {
|
|
20
|
-
if (options.standalone !== false) {
|
|
21
|
-
context.logger.info(`Standalone ${objectType} => no registration into a module.`);
|
|
22
|
-
return host;
|
|
23
|
-
}
|
|
24
|
-
const modulePath = options.module;
|
|
25
|
-
if (modulePath === undefined) {
|
|
26
|
-
return host;
|
|
27
|
-
}
|
|
28
|
-
const source = readIntoSourceFile(host, modulePath);
|
|
29
|
-
const providerPath = `/${options.path}/${core_1.strings.dasherize(options.name)}.${objectType}`;
|
|
30
|
-
const relativePath = (0, find_module_1.buildRelativePath)(modulePath, providerPath);
|
|
31
|
-
const providerChanges = (0, ast_utils_1.addProviderToModule)(source, modulePath, options.providerName, relativePath);
|
|
32
|
-
const declarationRecorder = host.beginUpdate(modulePath);
|
|
33
|
-
for (const change of providerChanges) {
|
|
34
|
-
if (change instanceof change_1.InsertChange) {
|
|
35
|
-
declarationRecorder.insertLeft(change.pos, change.toAdd);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
host.commitUpdate(declarationRecorder);
|
|
39
|
-
return host;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
exports.addDeclarationToNgModule = addDeclarationToNgModule;
|
|
43
14
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/utilities/helpers.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../projects/ngssm-schematics/schematics/utilities/helpers.ts"],"names":[],"mappings":";;;AAAA,2DAAuE;AAEvE,iCAAiC;AAEjC,SAAgB,kBAAkB,CAAC,IAAU,EAAE,UAAkB;IAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnC,IAAI,IAAI,KAAK,IAAI,EAAE;QACjB,MAAM,IAAI,gCAAmB,CAAC,QAAQ,UAAU,kBAAkB,CAAC,CAAC;KACrE;IAED,OAAO,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC/F,CAAC;AAPD,gDAOC"}
|