1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.CustomCollection = void 0;
|
4 | const fs_1 = require("fs");
|
5 | const path_1 = require("path");
|
6 | const abstract_collection_1 = require("./abstract.collection");
|
7 | class CustomCollection extends abstract_collection_1.AbstractCollection {
|
8 | getSchematics() {
|
9 | const collectionPackagePath = (0, path_1.dirname)(require.resolve(this.collection));
|
10 | const collectionPath = (0, path_1.join)(collectionPackagePath, 'collection.json');
|
11 | const collection = JSON.parse((0, fs_1.readFileSync)(collectionPath, 'utf8'));
|
12 | const schematics = Object.entries(collection.schematics).map(([name, value]) => {
|
13 | var _a;
|
14 | const schematic = value;
|
15 | const description = schematic.description;
|
16 | const alias = ((_a = schematic === null || schematic === void 0 ? void 0 : schematic.aliases) === null || _a === void 0 ? void 0 : _a.length) ? schematic.aliases[0] : '';
|
17 | return { name, description, alias };
|
18 | });
|
19 | return schematics;
|
20 | }
|
21 | }
|
22 | exports.CustomCollection = CustomCollection;
|