@coolon/angular-ui-powerups 3.2.0 → 3.3.1
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 +15 -0
- package/package.json +1 -1
- package/schematics/bootstrap-app/index.js +9 -3
- package/schematics/bootstrap-app/index.js.map +1 -1
- package/schematics/bootstrap-app/schema.d.ts +1 -0
- package/schematics/bootstrap-app/schema.json +5 -1
- package/schematics/bootstrap-app/templates/app/auth/auth.guard.ts.template +8 -8
- package/schematics/bootstrap-app/templates/styles.scss.template +5 -0
- package/schematics/collection.json +5 -0
- package/schematics/place-add/index.js +30 -19
- package/schematics/place-add/index.js.map +1 -1
- package/schematics/place-add/index.spec.d.ts +1 -0
- package/schematics/place-add/index.spec.js +364 -0
- package/schematics/place-add/index.spec.js.map +1 -0
- package/schematics/place-add/schema.d.ts +2 -0
- package/schematics/place-add/schema.json +20 -1
- package/schematics/place-add/templates/component/__name@dasherize__.component.html.template +1 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.spec.ts.template +25 -0
- package/schematics/place-add/templates/component/__name@dasherize__.component.ts.template +29 -0
- package/schematics/place-add/templates/files/i18n/places/__name@dasherize__.yml.template +7 -0
- package/schematics/utils/build-context.d.ts +34 -0
- package/schematics/utils/build-context.js +133 -0
- package/schematics/utils/build-context.js.map +1 -0
- package/schematics/utils/decorators/decorated-class.d.ts +13 -0
- package/schematics/utils/decorators/decorated-class.js +28 -0
- package/schematics/utils/decorators/decorated-class.js.map +1 -0
- package/schematics/utils/decorators/decorated-source-file.d.ts +15 -0
- package/schematics/utils/decorators/decorated-source-file.js +27 -0
- package/schematics/utils/decorators/decorated-source-file.js.map +1 -0
- package/schematics/utils/import-def.d.ts +30 -0
- package/schematics/utils/import-def.js +89 -0
- package/schematics/utils/import-def.js.map +1 -0
- package/schematics/utils/method-scanner.d.ts +16 -0
- package/schematics/utils/method-scanner.js +61 -0
- package/schematics/utils/method-scanner.js.map +1 -0
- package/schematics/utils/parameter-def.d.ts +5 -0
- package/schematics/utils/parameter-def.js +3 -0
- package/schematics/utils/parameter-def.js.map +1 -0
- package/schematics/utils/path-helper.d.ts +18 -0
- package/schematics/utils/path-helper.js +56 -0
- package/schematics/utils/path-helper.js.map +1 -0
- package/schematics/utils/schematic-tree-file-system.d.ts +28 -0
- package/schematics/utils/schematic-tree-file-system.js +101 -0
- package/schematics/utils/schematic-tree-file-system.js.map +1 -0
- package/schematics/utils/source-file-scanner.d.ts +14 -0
- package/schematics/utils/source-file-scanner.js +89 -0
- package/schematics/utils/source-file-scanner.js.map +1 -0
- package/schematics/utils/source-file-utilities.d.ts +6 -0
- package/schematics/utils/source-file-utilities.js +35 -0
- package/schematics/utils/source-file-utilities.js.map +1 -0
- package/schematics/utils/template-utilities.d.ts +2 -0
- package/schematics/utils/template-utilities.js +24 -0
- package/schematics/utils/template-utilities.js.map +1 -0
- package/schematics/bootstrap-app/templates/app/places/home/home.component.html.template +0 -1
- package/schematics/bootstrap-app/templates/app/places/home/home.component.spec.ts.template +0 -25
- package/schematics/bootstrap-app/templates/app/places/home/home.component.ts.template +0 -25
- package/schematics/bootstrap-app/templates/i18n/places/home.yml.template +0 -6
- /package/schematics/{bootstrap-app/templates/app/places/home/home.component.scss.template → place-add/templates/component/__name@dasherize__.component.scss.template} +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import { FileSystemHost } from 'ts-morph';
|
|
3
|
+
export declare class SchematicTreeFileSystem implements FileSystemHost {
|
|
4
|
+
private readonly tree;
|
|
5
|
+
constructor(tree: Tree);
|
|
6
|
+
copy(srcPath: string, destPath: string): Promise<void>;
|
|
7
|
+
copySync(srcPath: string, destPath: string): void;
|
|
8
|
+
delete(path: string): Promise<void>;
|
|
9
|
+
deleteSync(path: string): void;
|
|
10
|
+
directoryExists(dirPath: string): Promise<boolean>;
|
|
11
|
+
directoryExistsSync(dirPath: string): boolean;
|
|
12
|
+
fileExists(filePath: string): Promise<boolean>;
|
|
13
|
+
fileExistsSync(filePath: string): boolean;
|
|
14
|
+
getCurrentDirectory(): string;
|
|
15
|
+
glob(patterns: ReadonlyArray<string>): Promise<string[]>;
|
|
16
|
+
globSync(patterns: ReadonlyArray<string>): string[];
|
|
17
|
+
isCaseSensitive(): boolean;
|
|
18
|
+
mkdir(dirPath: string): Promise<void>;
|
|
19
|
+
mkdirSync(dirPath: string): void;
|
|
20
|
+
move(srcPath: string, destPath: string): Promise<void>;
|
|
21
|
+
moveSync(srcPath: string, destPath: string): void;
|
|
22
|
+
readDirSync(dirPath: string): string[];
|
|
23
|
+
readFile(filePath: string, encoding?: string): Promise<string>;
|
|
24
|
+
readFileSync(filePath: string, encoding?: string): string;
|
|
25
|
+
realpathSync(path: string): string;
|
|
26
|
+
writeFile(filePath: string, fileText: string): Promise<void>;
|
|
27
|
+
writeFileSync(filePath: string, fileText: string): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
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.SchematicTreeFileSystem = void 0;
|
|
13
|
+
const typescript_utilities_1 = require("@coolon/typescript-utilities");
|
|
14
|
+
class SchematicTreeFileSystem {
|
|
15
|
+
constructor(tree) {
|
|
16
|
+
this.tree = tree;
|
|
17
|
+
}
|
|
18
|
+
copy(srcPath, destPath) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return typescript_utilities_1.lang.notImplemented();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
copySync(srcPath, destPath) {
|
|
24
|
+
return typescript_utilities_1.lang.notImplemented();
|
|
25
|
+
}
|
|
26
|
+
delete(path) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return this.deleteSync(path);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
deleteSync(path) {
|
|
32
|
+
return this.tree.delete(path);
|
|
33
|
+
}
|
|
34
|
+
directoryExists(dirPath) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return this.directoryExistsSync(dirPath);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
directoryExistsSync(dirPath) {
|
|
40
|
+
return this.tree.exists(dirPath);
|
|
41
|
+
}
|
|
42
|
+
fileExists(filePath) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return this.fileExistsSync(filePath);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
fileExistsSync(filePath) {
|
|
48
|
+
return this.tree.exists(filePath);
|
|
49
|
+
}
|
|
50
|
+
getCurrentDirectory() {
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
glob(patterns) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
return typescript_utilities_1.lang.notImplemented();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
globSync(patterns) {
|
|
59
|
+
return typescript_utilities_1.lang.notImplemented();
|
|
60
|
+
}
|
|
61
|
+
isCaseSensitive() {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
mkdir(dirPath) {
|
|
65
|
+
return typescript_utilities_1.lang.notImplemented();
|
|
66
|
+
}
|
|
67
|
+
mkdirSync(dirPath) {
|
|
68
|
+
return typescript_utilities_1.lang.notImplemented();
|
|
69
|
+
}
|
|
70
|
+
move(srcPath, destPath) {
|
|
71
|
+
return Promise.resolve(undefined);
|
|
72
|
+
}
|
|
73
|
+
moveSync(srcPath, destPath) {
|
|
74
|
+
return typescript_utilities_1.lang.notImplemented();
|
|
75
|
+
}
|
|
76
|
+
readDirSync(dirPath) {
|
|
77
|
+
const dir = this.tree.getDir(dirPath);
|
|
78
|
+
return dir.subdirs.concat(dir.subfiles).map(name => `${dirPath}/${name}`);
|
|
79
|
+
}
|
|
80
|
+
readFile(filePath, encoding) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
return this.readFileSync(filePath, encoding);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
readFileSync(filePath, encoding) {
|
|
86
|
+
return this.tree.get(filePath).content.toString(encoding || 'UTF-8');
|
|
87
|
+
}
|
|
88
|
+
realpathSync(path) {
|
|
89
|
+
return path;
|
|
90
|
+
}
|
|
91
|
+
writeFile(filePath, fileText) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
return this.writeFileSync(filePath, fileText);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
writeFileSync(filePath, fileText) {
|
|
97
|
+
this.tree.create(filePath, fileText);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.SchematicTreeFileSystem = SchematicTreeFileSystem;
|
|
101
|
+
//# sourceMappingURL=schematic-tree-file-system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schematic-tree-file-system.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/utils/schematic-tree-file-system.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uEAAoD;AAGpD,MAAa,uBAAuB;IAElC,YAA6B,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IACvC,CAAC;IAEK,IAAI,CAAC,OAAe,EAAE,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gB;QACpC,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,QAAQ,CAAC,OAAe,EAAE,QAAgB;QACxC,OAAO,2BAAI,CAAC,cAAc,EAAE,CAAC;IAC/B,CAAC;IAED,WAAW,CAAC,OAAe;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO,IAAI,IAAI,EAAE,CAAC,CAAC;IAC5E,CAAC;IAEK,QAAQ,CAAC,QAAgB,EAAE,QAAiB;;YAChD,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/C,CAAC;KAAA;IAED,YAAY,CAAC,QAAgB,EAAE,QAAiB;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC;IACvE,CAAC;IAED,YAAY,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAEK,SAAS,CAAC,QAAgB,EAAE,QAAgB;;YAChD,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAChD,CAAC;KAAA;IAED,aAAa,CAAC,QAAgB,EAAE,QAAgB;QAC9C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;CAMF;AAlGD,0DAkGC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Decorator, ImportDeclaration, ObjectLiteralExpression, SourceFile, TypeNode } from 'ts-morph';
|
|
2
|
+
import { ImportDef } from './import-def';
|
|
3
|
+
export declare class SourceFileScanner {
|
|
4
|
+
readonly sourceFile: SourceFile;
|
|
5
|
+
constructor(sourceFile: SourceFile);
|
|
6
|
+
extractImports(type: TypeNode): ImportDef[];
|
|
7
|
+
getImportDeclaration(typeName: string): ImportDeclaration;
|
|
8
|
+
getObjectLiteralArgument(annotation: Decorator, position: number): ObjectLiteralExpression;
|
|
9
|
+
getOptionsArg<T extends {}>(annotation: Decorator, structure: T, options?: {
|
|
10
|
+
position: number;
|
|
11
|
+
required: boolean;
|
|
12
|
+
}): T;
|
|
13
|
+
scanObjectLiteral<T extends object>(structure: T, expression: ObjectLiteralExpression): T;
|
|
14
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SourceFileScanner = void 0;
|
|
4
|
+
const _ = require("lodash");
|
|
5
|
+
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
const import_def_1 = require("./import-def");
|
|
7
|
+
const source_file_utilities_1 = require("./source-file-utilities");
|
|
8
|
+
class SourceFileScanner {
|
|
9
|
+
constructor(sourceFile) {
|
|
10
|
+
this.sourceFile = sourceFile;
|
|
11
|
+
}
|
|
12
|
+
extractImports(type) {
|
|
13
|
+
const result = [];
|
|
14
|
+
type.getDescendantsOfKind(ts_morph_1.SyntaxKind.Identifier).forEach(v => {
|
|
15
|
+
const importDeclaration = this.getImportDeclaration(v.getFullText());
|
|
16
|
+
if (importDeclaration) {
|
|
17
|
+
// console.log(importDeclaration.getModuleSpecifierValue());
|
|
18
|
+
result.push(import_def_1.ImportDef.create(v.getFullText().trim(), importDeclaration));
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
getImportDeclaration(typeName) {
|
|
24
|
+
// importDecl.getModuleSpecifierSourceFile().getFilePath()
|
|
25
|
+
const baseName = typeName.split('.')[0].trim(); // Page.Criteria we check for Page.
|
|
26
|
+
return this.sourceFile.getImportDeclarations().find(d => {
|
|
27
|
+
const namedImports = d.getNamedImports().map(i => i.getText());
|
|
28
|
+
const result = namedImports.includes(baseName);
|
|
29
|
+
// console.log(`${baseName} in [${namedImports.join(',')}] -> ${result}`);
|
|
30
|
+
return result;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
getObjectLiteralArgument(annotation, position) {
|
|
34
|
+
const args = annotation.getArguments();
|
|
35
|
+
if (args.length > position && args[position] instanceof ts_morph_1.ObjectLiteralExpression) {
|
|
36
|
+
return args[position];
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
getOptionsArg(annotation, structure, options = {
|
|
41
|
+
position: 0,
|
|
42
|
+
required: true
|
|
43
|
+
}) {
|
|
44
|
+
const objectLiteralArgument = this.getObjectLiteralArgument(annotation, options.position);
|
|
45
|
+
if (!objectLiteralArgument) {
|
|
46
|
+
if (options.required) {
|
|
47
|
+
console.error(`expected object literal arg at position ${options.position}`, { expectedType: structure });
|
|
48
|
+
}
|
|
49
|
+
return structure;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return this.scanObjectLiteral(structure, objectLiteralArgument);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
scanObjectLiteral(structure, expression) {
|
|
56
|
+
return Object.keys(structure).reduce((result, key) => {
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
const defaultValue = structure[key];
|
|
59
|
+
const property = expression.getProperty(key);
|
|
60
|
+
if (property) {
|
|
61
|
+
if (_.isPlainObject(defaultValue)) {
|
|
62
|
+
const children = property.getChildren();
|
|
63
|
+
const objectLiteral = children[2];
|
|
64
|
+
return Object.assign(Object.assign({}, result), { [key]: this.scanObjectLiteral(defaultValue, objectLiteral) });
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const pas = property.getStructure();
|
|
68
|
+
if (_.isArray(defaultValue)) {
|
|
69
|
+
return Object.assign(Object.assign({}, result), { [pas.name]: source_file_utilities_1.parseArrayLiteralValue(pas.initializer) });
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return Object.assign(Object.assign({}, result), { [pas.name]: pas.initializer });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
if (_.isPlainObject(defaultValue)) {
|
|
78
|
+
// todo: add support for checking nested default values.
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return _.isNil(defaultValue) ? result : Object.assign(Object.assign({}, result), { [key]: defaultValue });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, {});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.SourceFileScanner = SourceFileScanner;
|
|
89
|
+
//# sourceMappingURL=source-file-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file-scanner.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/utils/source-file-scanner.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,uCAQkB;AAElB,6CAAyC;AACzC,mEAAiE;AAEjE,MAAa,iBAAiB;IAE5B,YAAqB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAC3C,CAAC;IAGD,cAAc,CAAC,IAAc;QAC3B,MAAM,MAAM,GAAgB,EAAE,CAAC;QAC/B,IAAI,CAAC,oBAAoB,CAAC,qBAAU,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAC3D,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YACrE,IAAI,iBAAiB,EAAE;gBACrB,4DAA4D;gBAC5D,MAAM,CAAC,IAAI,CAAC,sBAAS,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAC;aAC1E;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,C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AM,MAAM,KAAE,CAAC,GAAG,CAAC,EAAE,YAAY,GAAE,CAAC;iBAC5E;aACF;QACH,CAAC,EAAE,EAAO,CAAC,CAAC;IAEd,CAAC;CAGF;AAnFD,8CAmFC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ClassDeclaration, Decorator, Node, ts, Type } from 'ts-morph';
|
|
2
|
+
export declare function isDecoratorNode(node: Node, name: string): node is Decorator;
|
|
3
|
+
export declare function stripEnclosingQuotes(value: string): string;
|
|
4
|
+
export declare function parseArrayLiteralValue(value: string): string[];
|
|
5
|
+
export declare function findClassDecoratorNode(classDecl: ClassDeclaration, decoratorName: string): Decorator;
|
|
6
|
+
export declare function stripImports(type: Type<ts.Type>): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripImports = exports.findClassDecoratorNode = exports.parseArrayLiteralValue = exports.stripEnclosingQuotes = exports.isDecoratorNode = void 0;
|
|
4
|
+
const _ = require("lodash");
|
|
5
|
+
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
function isDecoratorNode(node, name) {
|
|
7
|
+
return node.getKind() === ts_morph_1.SyntaxKind.Decorator &&
|
|
8
|
+
node.getText().startsWith(`${name}(`); // NOTE: I'm only supporting the @Decorator(...) style of usage (i.e. decorator factories).
|
|
9
|
+
}
|
|
10
|
+
exports.isDecoratorNode = isDecoratorNode;
|
|
11
|
+
function stripEnclosingQuotes(value) {
|
|
12
|
+
return _.isNil(value) ? value : value.replace(/(^["'])|(["']$)/g, '');
|
|
13
|
+
}
|
|
14
|
+
exports.stripEnclosingQuotes = stripEnclosingQuotes;
|
|
15
|
+
function parseArrayLiteralValue(value) {
|
|
16
|
+
return value ? stripEnclosingQuotes(value).trim().slice(1, -1).split(',').map(s => stripEnclosingQuotes(s.trim())) : [];
|
|
17
|
+
}
|
|
18
|
+
exports.parseArrayLiteralValue = parseArrayLiteralValue;
|
|
19
|
+
function findClassDecoratorNode(classDecl, decoratorName) {
|
|
20
|
+
let result = null;
|
|
21
|
+
classDecl.forEachChild((node) => {
|
|
22
|
+
if (isDecoratorNode(node, decoratorName)) {
|
|
23
|
+
result = node;
|
|
24
|
+
// stop iterating when the node is a class declaration
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
exports.findClassDecoratorNode = findClassDecoratorNode;
|
|
31
|
+
function stripImports(type) {
|
|
32
|
+
return type.getText().replace(/import\([^\)]+\)\./g, '');
|
|
33
|
+
}
|
|
34
|
+
exports.stripImports = stripImports;
|
|
35
|
+
//# sourceMappingURL=source-file-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file-utilities.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/utils/source-file-utilities.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,uCAAmF;AAEnF,SAAgB,eAAe,CAAC,IAAU,EAAE,IAAY;IACtD,OAAO,IAAI,CAAC,OAAO,EAAE,KAAK,qBAAU,CAAC,SAAS;QAC5C,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,2FAA2F;AACtI,CAAC;AAHD,0CAGC;AAED,SAAgB,oBAAoB,CAAC,KAAa;IAChD,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;AACxE,CAAC;AAFD,oDAEC;AAED,SAAgB,sBAAsB,CAAC,KAAa;IAClD,OAAO,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1H,CAAC;AAFD,wDAEC;AAED,SAAgB,sBAAsB,CAAC,SAA2B,EAAE,aAAqB;IACvF,IAAI,MAAM,GAAc,IAAI,CAAC;IAC7B,SAAS,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE;QAC9B,IAAI,eAAe,CAAC,IAAI,EAAE,aAAa,CAAC,EAAE;YACxC,MAAM,GAAG,IAAiB,CAAC;YAC3B,sDAAsD;YACtD,OAAO,IAAI,CAAC;SACb;IACH,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAVD,wDAUC;AAED,SAAgB,YAAY,CAAC,IAAmB;IAC9C,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;AAC3D,CAAC;AAFD,oCAEC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyTemplatesWithOverwrite = void 0;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
function applyTemplatesWithOverwrite(tree, templateUrl, templateData, outDir) {
|
|
7
|
+
// this.context.logger.info(`${this.workspaceProject.sourceRoot}/${this.projectType}`);
|
|
8
|
+
// this.context.logger.info(placeRoot.dir);
|
|
9
|
+
const newFiles = schematics_1.apply(schematics_1.url(templateUrl), [
|
|
10
|
+
schematics_1.applyTemplates(Object.assign(Object.assign({}, templateData), core_1.strings)),
|
|
11
|
+
schematics_1.move(`${outDir}`),
|
|
12
|
+
// @see https://github.com/angular/angular-cli/issues/11337#issuecomment-448259549
|
|
13
|
+
schematics_1.forEach((fileEntry) => {
|
|
14
|
+
// this.context.logger.info(fileEntry.path);
|
|
15
|
+
if (tree.exists(fileEntry.path)) {
|
|
16
|
+
tree.overwrite(fileEntry.path, fileEntry.content);
|
|
17
|
+
}
|
|
18
|
+
return fileEntry;
|
|
19
|
+
})
|
|
20
|
+
]);
|
|
21
|
+
return schematics_1.mergeWith(newFiles);
|
|
22
|
+
}
|
|
23
|
+
exports.applyTemplatesWithOverwrite = applyTemplatesWithOverwrite;
|
|
24
|
+
//# sourceMappingURL=template-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-utilities.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/utils/template-utilities.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,2DAUoC;AAEpC,SAAgB,2BAA2B,CAAC,IAAU,EAAE,WAAmB,EAAE,YAAoB,EAAE,MAAc;IAC/G,uFAAuF;IACvF,2CAA2C;IAC3C,MAAM,QAAQ,GAAG,kBAAK,CACpB,gBAAG,CAAC,WAAW,CAAC,EAChB;QACE,2BAAc,iCACT,YAAY,GACZ,cAAO,EACV;QACF,iBAAI,CAAC,GAAG,MAAM,EAAE,CAAC;QACjB,kFAAkF;QAClF,oBAAO,CAAC,CAAC,SAAoB,EAAE,EAAE;YAC/B,4CAA4C;YAC5C,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;gBAC/B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;aACnD;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC;KACH,CAAC,CAAC;IACL,OAAO,sBAAS,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC;AArBD,kEAqBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<p>Home works!</p>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { HomeComponent } from './home.component';
|
|
4
|
-
|
|
5
|
-
describe('HomeComponent', () => {
|
|
6
|
-
let component: HomeComponent;
|
|
7
|
-
let fixture: ComponentFixture<HomeComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [ HomeComponent ]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
fixture = TestBed.createComponent(HomeComponent);
|
|
18
|
-
component = fixture.componentInstance;
|
|
19
|
-
fixture.detectChanges();
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should create', () => {
|
|
23
|
-
expect(component).toBeTruthy();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit } from '@angular/core';
|
|
2
|
-
import { Place, PlaceComponent } from '@coolon/angular-ui-powerups';
|
|
3
|
-
import { I18n } from '../../i18n';
|
|
4
|
-
|
|
5
|
-
@Place({
|
|
6
|
-
path: 'home',
|
|
7
|
-
data: {
|
|
8
|
-
nav: I18n.places.home.nav
|
|
9
|
-
},
|
|
10
|
-
authenticate: true
|
|
11
|
-
})
|
|
12
|
-
@Component({
|
|
13
|
-
selector: 'home',
|
|
14
|
-
templateUrl: './home.component.html',
|
|
15
|
-
styleUrls: ['./home.component.scss']
|
|
16
|
-
})
|
|
17
|
-
export class HomeComponent extends PlaceComponent implements OnInit {
|
|
18
|
-
|
|
19
|
-
constructor() {
|
|
20
|
-
super();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
ngOnInit() {
|
|
24
|
-
}
|
|
25
|
-
}
|