@featurevisor/core 1.35.2 → 2.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/CHANGELOG.md +8 -0
- package/README.md +0 -6
- package/coverage/clover.xml +321 -237
- package/coverage/coverage-final.json +8 -8
- package/coverage/lcov-report/index.html +77 -47
- package/coverage/lcov-report/lib/builder/allocator.js.html +14 -14
- package/coverage/lcov-report/lib/builder/index.html +16 -16
- package/coverage/lcov-report/lib/builder/revision.js.html +3 -3
- package/coverage/lcov-report/lib/builder/traffic.js.html +90 -63
- package/coverage/lcov-report/lib/list/index.html +116 -0
- package/coverage/lcov-report/lib/{tester → list}/matrix.js.html +90 -66
- package/coverage/lcov-report/lib/tester/helpers.js.html +295 -0
- package/coverage/lcov-report/lib/tester/index.html +20 -35
- package/coverage/lcov-report/src/builder/allocator.ts.html +2 -2
- package/coverage/lcov-report/src/builder/index.html +15 -15
- package/coverage/lcov-report/src/builder/revision.ts.html +1 -1
- package/coverage/lcov-report/src/builder/traffic.ts.html +101 -23
- package/coverage/lcov-report/src/list/index.html +116 -0
- package/coverage/lcov-report/src/{tester → list}/matrix.ts.html +87 -21
- package/coverage/lcov-report/src/tester/helpers.ts.html +313 -0
- package/coverage/lcov-report/src/tester/index.html +20 -35
- package/coverage/lcov.info +592 -436
- package/lib/assess-distribution/index.d.ts +1 -1
- package/lib/assess-distribution/index.js +102 -162
- package/lib/assess-distribution/index.js.map +1 -1
- package/lib/benchmark/index.js +87 -143
- package/lib/benchmark/index.js.map +1 -1
- package/lib/builder/allocator.d.ts +1 -1
- package/lib/builder/allocator.js +12 -12
- package/lib/builder/allocator.js.map +1 -1
- package/lib/builder/allocator.spec.js +22 -22
- package/lib/builder/allocator.spec.js.map +1 -1
- package/lib/builder/buildDatafile.d.ts +4 -3
- package/lib/builder/buildDatafile.js +311 -388
- package/lib/builder/buildDatafile.js.map +1 -1
- package/lib/builder/buildProject.d.ts +2 -1
- package/lib/builder/buildProject.js +96 -183
- package/lib/builder/buildProject.js.map +1 -1
- package/lib/builder/convertToV1.d.ts +10 -0
- package/lib/builder/convertToV1.js +119 -0
- package/lib/builder/convertToV1.js.map +1 -0
- package/lib/builder/getFeatureRanges.d.ts +1 -1
- package/lib/builder/getFeatureRanges.js +32 -105
- package/lib/builder/getFeatureRanges.js.map +1 -1
- package/lib/builder/hashes.d.ts +4 -0
- package/lib/builder/hashes.js +70 -0
- package/lib/builder/hashes.js.map +1 -0
- package/lib/builder/revision.js +2 -2
- package/lib/builder/revision.js.map +1 -1
- package/lib/builder/revision.spec.js +1 -1
- package/lib/builder/revision.spec.js.map +1 -1
- package/lib/builder/traffic.d.ts +1 -1
- package/lib/builder/traffic.js +57 -48
- package/lib/builder/traffic.js.map +1 -1
- package/lib/builder/traffic.spec.js +14 -14
- package/lib/builder/traffic.spec.js.map +1 -1
- package/lib/cli/cli.js +60 -129
- package/lib/cli/cli.js.map +1 -1
- package/lib/cli/plugins.js +14 -16
- package/lib/cli/plugins.js.map +1 -1
- package/lib/config/parsers.js +1 -1
- package/lib/config/parsers.js.map +1 -1
- package/lib/config/projectConfig.d.ts +8 -6
- package/lib/config/projectConfig.js +31 -72
- package/lib/config/projectConfig.js.map +1 -1
- package/lib/datasource/adapter.d.ts +1 -1
- package/lib/datasource/adapter.js +2 -5
- package/lib/datasource/adapter.js.map +1 -1
- package/lib/datasource/datasource.d.ts +2 -1
- package/lib/datasource/datasource.js +107 -148
- package/lib/datasource/datasource.js.map +1 -1
- package/lib/datasource/filesystemAdapter.d.ts +1 -1
- package/lib/datasource/filesystemAdapter.js +224 -360
- package/lib/datasource/filesystemAdapter.js.map +1 -1
- package/lib/evaluate/index.d.ts +1 -1
- package/lib/evaluate/index.js +120 -188
- package/lib/evaluate/index.js.map +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.d.ts +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.js +40 -128
- package/lib/find-duplicate-segments/findDuplicateSegments.js.map +1 -1
- package/lib/find-duplicate-segments/index.js +27 -82
- package/lib/find-duplicate-segments/index.js.map +1 -1
- package/lib/find-usage/index.d.ts +7 -5
- package/lib/find-usage/index.js +333 -507
- package/lib/find-usage/index.js.map +1 -1
- package/lib/generate-code/index.js +36 -91
- package/lib/generate-code/index.js.map +1 -1
- package/lib/generate-code/typescript.js +117 -157
- package/lib/generate-code/typescript.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/info/index.js +45 -133
- package/lib/info/index.js.map +1 -1
- package/lib/init/index.d.ts +1 -1
- package/lib/init/index.js +16 -64
- package/lib/init/index.js.map +1 -1
- package/lib/linter/attributeSchema.d.ts +21 -6
- package/lib/linter/attributeSchema.js +18 -4
- package/lib/linter/attributeSchema.js.map +1 -1
- package/lib/linter/checkCircularDependency.d.ts +1 -1
- package/lib/linter/checkCircularDependency.js +22 -80
- package/lib/linter/checkCircularDependency.js.map +1 -1
- package/lib/linter/checkPercentageExceedingSlot.d.ts +1 -1
- package/lib/linter/checkPercentageExceedingSlot.js +36 -76
- package/lib/linter/checkPercentageExceedingSlot.js.map +1 -1
- package/lib/linter/conditionSchema.d.ts +1 -1
- package/lib/linter/conditionSchema.js +89 -41
- package/lib/linter/conditionSchema.js.map +1 -1
- package/lib/linter/featureSchema.d.ts +345 -197
- package/lib/linter/featureSchema.js +313 -172
- package/lib/linter/featureSchema.js.map +1 -1
- package/lib/linter/groupSchema.js +6 -6
- package/lib/linter/groupSchema.js.map +1 -1
- package/lib/linter/lintProject.js +306 -480
- package/lib/linter/lintProject.js.map +1 -1
- package/lib/linter/printError.js +7 -7
- package/lib/linter/printError.js.map +1 -1
- package/lib/linter/segmentSchema.js +2 -2
- package/lib/linter/segmentSchema.js.map +1 -1
- package/lib/linter/testSchema.d.ts +155 -3
- package/lib/linter/testSchema.js +47 -17
- package/lib/linter/testSchema.js.map +1 -1
- package/lib/list/index.d.ts +1 -0
- package/lib/list/index.js +349 -517
- package/lib/list/index.js.map +1 -1
- package/lib/{tester → list}/matrix.d.ts +1 -1
- package/lib/{tester → list}/matrix.js +50 -42
- package/lib/list/matrix.js.map +1 -0
- package/lib/{tester → list}/matrix.spec.js +7 -7
- package/lib/list/matrix.spec.js.map +1 -0
- package/lib/site/exportSite.js +25 -71
- package/lib/site/exportSite.js.map +1 -1
- package/lib/site/generateHistory.d.ts +1 -1
- package/lib/site/generateHistory.js +26 -82
- package/lib/site/generateHistory.js.map +1 -1
- package/lib/site/generateSiteSearchIndex.d.ts +1 -1
- package/lib/site/generateSiteSearchIndex.js +182 -259
- package/lib/site/generateSiteSearchIndex.js.map +1 -1
- package/lib/site/getLastModifiedFromHistory.d.ts +1 -1
- package/lib/site/getLastModifiedFromHistory.js +2 -2
- package/lib/site/getLastModifiedFromHistory.js.map +1 -1
- package/lib/site/getOwnerAndRepoFromUrl.js +6 -6
- package/lib/site/getOwnerAndRepoFromUrl.js.map +1 -1
- package/lib/site/getRelativePaths.js +7 -7
- package/lib/site/getRelativePaths.js.map +1 -1
- package/lib/site/getRepoDetails.js +20 -20
- package/lib/site/getRepoDetails.js.map +1 -1
- package/lib/site/index.js +25 -73
- package/lib/site/index.js.map +1 -1
- package/lib/site/serveSite.js +10 -10
- package/lib/site/serveSite.js.map +1 -1
- package/lib/tester/helpers.d.ts +2 -0
- package/lib/tester/helpers.js +71 -0
- package/lib/tester/helpers.js.map +1 -0
- package/lib/tester/helpers.spec.js +115 -0
- package/lib/tester/helpers.spec.js.map +1 -0
- package/lib/tester/index.d.ts +0 -1
- package/lib/tester/index.js +0 -1
- package/lib/tester/index.js.map +1 -1
- package/lib/tester/prettyDuration.js +11 -11
- package/lib/tester/prettyDuration.js.map +1 -1
- package/lib/tester/printTestResult.d.ts +1 -1
- package/lib/tester/printTestResult.js +35 -15
- package/lib/tester/printTestResult.js.map +1 -1
- package/lib/tester/testFeature.d.ts +4 -2
- package/lib/tester/testFeature.js +264 -226
- package/lib/tester/testFeature.js.map +1 -1
- package/lib/tester/testProject.d.ts +3 -7
- package/lib/tester/testProject.js +145 -246
- package/lib/tester/testProject.js.map +1 -1
- package/lib/tester/testSegment.d.ts +5 -2
- package/lib/tester/testSegment.js +65 -102
- package/lib/tester/testSegment.js.map +1 -1
- package/lib/utils/extractKeys.d.ts +2 -1
- package/lib/utils/extractKeys.js +57 -12
- package/lib/utils/extractKeys.js.map +1 -1
- package/lib/utils/git.d.ts +1 -1
- package/lib/utils/git.js +23 -23
- package/lib/utils/git.js.map +1 -1
- package/lib/utils/pretty.js +2 -4
- package/lib/utils/pretty.js.map +1 -1
- package/package.json +5 -6
- package/src/assess-distribution/index.ts +3 -2
- package/src/benchmark/index.ts +3 -3
- package/src/builder/allocator.spec.ts +1 -1
- package/src/builder/allocator.ts +1 -1
- package/src/builder/buildDatafile.ts +161 -124
- package/src/builder/buildProject.ts +6 -3
- package/src/builder/convertToV1.ts +166 -0
- package/src/builder/getFeatureRanges.ts +1 -1
- package/src/builder/hashes.ts +109 -0
- package/src/builder/traffic.ts +41 -15
- package/src/cli/cli.ts +1 -1
- package/src/cli/plugins.ts +0 -2
- package/src/config/projectConfig.ts +13 -10
- package/src/datasource/adapter.ts +1 -1
- package/src/datasource/datasource.ts +23 -2
- package/src/datasource/filesystemAdapter.ts +11 -12
- package/src/evaluate/index.ts +7 -6
- package/src/find-duplicate-segments/findDuplicateSegments.ts +1 -1
- package/src/find-usage/index.ts +111 -44
- package/src/generate-code/index.ts +1 -3
- package/src/generate-code/typescript.ts +7 -29
- package/src/index.ts +0 -1
- package/src/info/index.ts +2 -2
- package/src/init/index.ts +2 -2
- package/src/linter/attributeSchema.ts +18 -2
- package/src/linter/checkCircularDependency.ts +1 -1
- package/src/linter/checkPercentageExceedingSlot.ts +28 -8
- package/src/linter/conditionSchema.ts +66 -10
- package/src/linter/featureSchema.ts +312 -116
- package/src/linter/lintProject.ts +9 -4
- package/src/linter/testSchema.ts +42 -3
- package/src/list/index.ts +18 -30
- package/src/{tester → list}/matrix.ts +33 -11
- package/src/site/exportSite.ts +2 -4
- package/src/site/generateHistory.ts +1 -1
- package/src/site/generateSiteSearchIndex.ts +58 -50
- package/src/site/getLastModifiedFromHistory.ts +1 -1
- package/src/tester/helpers.spec.ts +149 -0
- package/src/tester/helpers.ts +76 -0
- package/src/tester/index.ts +0 -1
- package/src/tester/printTestResult.ts +25 -3
- package/src/tester/testFeature.ts +270 -124
- package/src/tester/testProject.ts +28 -49
- package/src/tester/testSegment.ts +48 -40
- package/src/utils/extractKeys.ts +58 -1
- package/src/utils/git.ts +1 -1
- package/tsconfig.cjs.json +1 -0
- package/coverage/lcov-report/lib/tester/checkIfObjectsAreEqual.js.html +0 -151
- package/coverage/lcov-report/src/tester/checkIfObjectsAreEqual.ts.html +0 -157
- package/lib/restore/index.d.ts +0 -4
- package/lib/restore/index.js +0 -91
- package/lib/restore/index.js.map +0 -1
- package/lib/tester/checkIfArraysAreEqual.d.ts +0 -1
- package/lib/tester/checkIfArraysAreEqual.js +0 -18
- package/lib/tester/checkIfArraysAreEqual.js.map +0 -1
- package/lib/tester/checkIfObjectsAreEqual.d.ts +0 -1
- package/lib/tester/checkIfObjectsAreEqual.js +0 -23
- package/lib/tester/checkIfObjectsAreEqual.js.map +0 -1
- package/lib/tester/checkIfObjectsAreEqual.spec.js +0 -26
- package/lib/tester/checkIfObjectsAreEqual.spec.js.map +0 -1
- package/lib/tester/matrix.js.map +0 -1
- package/lib/tester/matrix.spec.js.map +0 -1
- package/src/restore/index.ts +0 -42
- package/src/tester/checkIfArraysAreEqual.ts +0 -16
- package/src/tester/checkIfObjectsAreEqual.spec.ts +0 -31
- package/src/tester/checkIfObjectsAreEqual.ts +0 -24
- /package/lib/{tester → list}/matrix.spec.d.ts +0 -0
- /package/lib/tester/{checkIfObjectsAreEqual.spec.d.ts → helpers.spec.d.ts} +0 -0
- /package/src/{tester → list}/matrix.spec.ts +0 -0
package/lib/info/index.js
CHANGED
|
@@ -1,144 +1,56 @@
|
|
|
1
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
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.infoPlugin = void 0;
|
|
40
4
|
exports.showProjectInfo = showProjectInfo;
|
|
41
|
-
|
|
42
|
-
function showProjectInfo(deps) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
case 7:
|
|
75
|
-
feature = _d.sent();
|
|
76
|
-
if (feature.variablesSchema) {
|
|
77
|
-
variablesCount += feature.variablesSchema.length;
|
|
78
|
-
}
|
|
79
|
-
_d.label = 8;
|
|
80
|
-
case 8:
|
|
81
|
-
_i++;
|
|
82
|
-
return [3 /*break*/, 6];
|
|
83
|
-
case 9:
|
|
84
|
-
console.log(" - Total attributes: ", attributes.length);
|
|
85
|
-
console.log(" - Total segments: ", segments.length);
|
|
86
|
-
console.log(" - Total features: ", features.length);
|
|
87
|
-
console.log(" - Total variables: ", variablesCount);
|
|
88
|
-
console.log(" - Total groups: ", groups.length);
|
|
89
|
-
console.log("");
|
|
90
|
-
return [4 /*yield*/, datasource.listTests()];
|
|
91
|
-
case 10:
|
|
92
|
-
tests = _d.sent();
|
|
93
|
-
console.log(" - Total test specs: ", tests.length);
|
|
94
|
-
assertionsCount = 0;
|
|
95
|
-
_a = 0, tests_1 = tests;
|
|
96
|
-
_d.label = 11;
|
|
97
|
-
case 11:
|
|
98
|
-
if (!(_a < tests_1.length)) return [3 /*break*/, 14];
|
|
99
|
-
test_1 = tests_1[_a];
|
|
100
|
-
return [4 /*yield*/, datasource.readTest(test_1)];
|
|
101
|
-
case 12:
|
|
102
|
-
testSpec = _d.sent();
|
|
103
|
-
for (_b = 0, _c = testSpec.assertions; _b < _c.length; _b++) {
|
|
104
|
-
assertion = _c[_b];
|
|
105
|
-
if (assertion.matrix) {
|
|
106
|
-
combinations = (0, matrix_1.getMatrixCombinations)(assertion.matrix);
|
|
107
|
-
assertionsCount += combinations.length;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
assertionsCount += 1;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
_d.label = 13;
|
|
114
|
-
case 13:
|
|
115
|
-
_a++;
|
|
116
|
-
return [3 /*break*/, 11];
|
|
117
|
-
case 14:
|
|
118
|
-
console.log(" - Total assertions: ", assertionsCount);
|
|
119
|
-
return [2 /*return*/];
|
|
5
|
+
const matrix_1 = require("../list/matrix");
|
|
6
|
+
async function showProjectInfo(deps) {
|
|
7
|
+
const { datasource } = deps;
|
|
8
|
+
console.log("\nProject info:\n");
|
|
9
|
+
const revision = await datasource.readRevision();
|
|
10
|
+
console.log(" - Revision: ", revision);
|
|
11
|
+
console.log("");
|
|
12
|
+
const attributes = await datasource.listAttributes();
|
|
13
|
+
const segments = await datasource.listSegments();
|
|
14
|
+
const features = await datasource.listFeatures();
|
|
15
|
+
const groups = await datasource.listGroups();
|
|
16
|
+
let variablesCount = 0;
|
|
17
|
+
for (const featureKey of features) {
|
|
18
|
+
const feature = await datasource.readFeature(featureKey);
|
|
19
|
+
if (feature.variablesSchema) {
|
|
20
|
+
variablesCount += Object.keys(feature.variablesSchema).length;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
console.log(" - Total attributes: ", attributes.length);
|
|
24
|
+
console.log(" - Total segments: ", segments.length);
|
|
25
|
+
console.log(" - Total features: ", features.length);
|
|
26
|
+
console.log(" - Total variables: ", variablesCount);
|
|
27
|
+
console.log(" - Total groups: ", groups.length);
|
|
28
|
+
console.log("");
|
|
29
|
+
const tests = await datasource.listTests();
|
|
30
|
+
console.log(" - Total test specs: ", tests.length);
|
|
31
|
+
let assertionsCount = 0;
|
|
32
|
+
for (const test of tests) {
|
|
33
|
+
const testSpec = await datasource.readTest(test);
|
|
34
|
+
for (const assertion of testSpec.assertions) {
|
|
35
|
+
if (assertion.matrix) {
|
|
36
|
+
const combinations = (0, matrix_1.getMatrixCombinations)(assertion.matrix);
|
|
37
|
+
assertionsCount += combinations.length;
|
|
120
38
|
}
|
|
121
|
-
|
|
122
|
-
|
|
39
|
+
else {
|
|
40
|
+
assertionsCount += 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
console.log(" - Total assertions: ", assertionsCount);
|
|
123
45
|
}
|
|
124
46
|
exports.infoPlugin = {
|
|
125
47
|
command: "info",
|
|
126
|
-
handler: function (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
rootDirectoryPath: rootDirectoryPath,
|
|
133
|
-
projectConfig: projectConfig,
|
|
134
|
-
datasource: datasource,
|
|
135
|
-
options: parsed,
|
|
136
|
-
})];
|
|
137
|
-
case 1:
|
|
138
|
-
_c.sent();
|
|
139
|
-
return [2 /*return*/];
|
|
140
|
-
}
|
|
141
|
-
});
|
|
48
|
+
handler: async function ({ rootDirectoryPath, projectConfig, datasource, parsed }) {
|
|
49
|
+
await showProjectInfo({
|
|
50
|
+
rootDirectoryPath,
|
|
51
|
+
projectConfig,
|
|
52
|
+
datasource,
|
|
53
|
+
options: parsed,
|
|
142
54
|
});
|
|
143
55
|
},
|
|
144
56
|
examples: [
|
package/lib/info/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/info/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/info/index.ts"],"names":[],"mappings":";;;AAIA,0CAkDC;AArDD,2CAAuD;AAGhD,KAAK,UAAU,eAAe,CAAC,IAAkB;IACtD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAEjC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC;IAEhD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,cAAc,EAAE,CAAC;IACrD,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,CAAC;IACjD,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;IAE7C,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,KAAK,MAAM,UAAU,IAAI,QAAQ,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAEzD,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;YAC5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AO,EAAE,MAAM;IACf,OAAO,EAAE,KAAK,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE;QAC/E,MAAM,eAAe,CAAC;YACpB,iBAAiB;YACjB,aAAa;YACb,UAAU;YACV,OAAO,EAAE,MAAM;SAChB,CAAC,CAAC;IACL,CAAC;IACD,QAAQ,EAAE;QACR;YACE,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,oCAAoC;SAClD;KACF;CACF,CAAC"}
|
package/lib/init/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "../cli";
|
|
2
|
-
export declare const DEFAULT_EXAMPLE = "
|
|
2
|
+
export declare const DEFAULT_EXAMPLE = "yml";
|
|
3
3
|
export declare const EXAMPLES_ORG_NAME = "fahad19";
|
|
4
4
|
export declare const EXAMPLES_REPO_NAME = "featurevisor";
|
|
5
5
|
export declare const EXAMPLES_BRANCH_NAME = "main";
|
package/lib/init/index.js
CHANGED
|
@@ -1,71 +1,34 @@
|
|
|
1
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
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.initPlugin = exports.EXAMPLES_TAR_URL = exports.EXAMPLES_BRANCH_NAME = exports.EXAMPLES_REPO_NAME = exports.EXAMPLES_ORG_NAME = exports.DEFAULT_EXAMPLE = void 0;
|
|
40
4
|
exports.initProject = initProject;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
exports.DEFAULT_EXAMPLE = "
|
|
5
|
+
const axios_1 = require("axios");
|
|
6
|
+
const tar = require("tar");
|
|
7
|
+
exports.DEFAULT_EXAMPLE = "yml";
|
|
44
8
|
exports.EXAMPLES_ORG_NAME = "fahad19";
|
|
45
9
|
exports.EXAMPLES_REPO_NAME = "featurevisor";
|
|
46
10
|
exports.EXAMPLES_BRANCH_NAME = "main";
|
|
47
|
-
exports.EXAMPLES_TAR_URL =
|
|
11
|
+
exports.EXAMPLES_TAR_URL = `https://codeload.github.com/${exports.EXAMPLES_ORG_NAME}/${exports.EXAMPLES_REPO_NAME}/tar.gz/${exports.EXAMPLES_BRANCH_NAME}`;
|
|
48
12
|
function getExamplePath(exampleName) {
|
|
49
|
-
return
|
|
13
|
+
return `${exports.EXAMPLES_REPO_NAME}-${exports.EXAMPLES_BRANCH_NAME}/examples/example-${exampleName}/`;
|
|
50
14
|
}
|
|
51
|
-
function initProject(directoryPath, exampleName) {
|
|
52
|
-
if (exampleName === void 0) { exampleName = exports.DEFAULT_EXAMPLE; }
|
|
15
|
+
function initProject(directoryPath, exampleName = exports.DEFAULT_EXAMPLE) {
|
|
53
16
|
return new Promise(function (resolve) {
|
|
54
|
-
axios_1.default.get(exports.EXAMPLES_TAR_URL, { responseType: "stream" }).then(
|
|
17
|
+
axios_1.default.get(exports.EXAMPLES_TAR_URL, { responseType: "stream" }).then((response) => {
|
|
55
18
|
response.data
|
|
56
19
|
.pipe(tar.x({
|
|
57
20
|
C: directoryPath,
|
|
58
|
-
filter:
|
|
21
|
+
filter: (path) => path.indexOf(getExamplePath(exampleName)) === 0,
|
|
59
22
|
strip: 3,
|
|
60
23
|
}))
|
|
61
|
-
.on("error",
|
|
24
|
+
.on("error", (e) => {
|
|
62
25
|
console.error(e);
|
|
63
26
|
resolve(false);
|
|
64
27
|
})
|
|
65
|
-
.on("finish",
|
|
66
|
-
console.log(
|
|
67
|
-
console.log(
|
|
68
|
-
console.log(
|
|
28
|
+
.on("finish", () => {
|
|
29
|
+
console.log(`Project scaffolded in ${directoryPath}`);
|
|
30
|
+
console.log(``);
|
|
31
|
+
console.log(`Please run "npm install" in the directory above.`);
|
|
69
32
|
resolve(true);
|
|
70
33
|
});
|
|
71
34
|
});
|
|
@@ -73,20 +36,9 @@ function initProject(directoryPath, exampleName) {
|
|
|
73
36
|
}
|
|
74
37
|
exports.initPlugin = {
|
|
75
38
|
command: "init",
|
|
76
|
-
handler: function (options) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return __generator(this, function (_a) {
|
|
80
|
-
switch (_a.label) {
|
|
81
|
-
case 0:
|
|
82
|
-
rootDirectoryPath = options.rootDirectoryPath, parsed = options.parsed;
|
|
83
|
-
return [4 /*yield*/, initProject(rootDirectoryPath, parsed.example)];
|
|
84
|
-
case 1:
|
|
85
|
-
_a.sent();
|
|
86
|
-
return [2 /*return*/];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
});
|
|
39
|
+
handler: async function (options) {
|
|
40
|
+
const { rootDirectoryPath, parsed } = options;
|
|
41
|
+
await initProject(rootDirectoryPath, parsed.example);
|
|
90
42
|
},
|
|
91
43
|
examples: [
|
|
92
44
|
{
|
package/lib/init/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/init/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/init/index.ts"],"names":[],"mappings":";;;AAiBA,kCA4BC;AA7CD,iCAA0B;AAC1B,2BAA2B;AAId,QAAA,eAAe,GAAG,KAAK,CAAC;AAExB,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAC9B,QAAA,kBAAkB,GAAG,cAAc,CAAC;AACpC,QAAA,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AAO,EAAE,KAAK,WAAW,OAAO;QAC9B,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAE9C,MAAM,WAAW,CAAC,iBAAiB,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;IACD,QAAQ,EAAE;QACR;YACE,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,6CAA6C;SAC3D;QACD;YACE,OAAO,EAAE,4BAA4B;YACrC,WAAW,EAAE,gEAAgE;SAC9E;KACF;CACF,CAAC"}
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare function getAttributeZodSchema(): z.ZodObject<{
|
|
3
3
|
archived: z.ZodOptional<z.ZodBoolean>;
|
|
4
|
-
type: z.ZodEnum<["boolean", "string", "integer", "double", "date", "semver"]>;
|
|
4
|
+
type: z.ZodEnum<["boolean", "string", "integer", "double", "date", "semver", "object", "array"]>;
|
|
5
5
|
description: z.ZodString;
|
|
6
|
-
|
|
6
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
7
|
+
type: z.ZodEnum<["boolean", "string", "integer", "double", "date", "semver", "array"]>;
|
|
8
|
+
description: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
type?: "string" | "boolean" | "integer" | "double" | "date" | "semver" | "array";
|
|
11
|
+
description?: string;
|
|
12
|
+
}, {
|
|
13
|
+
type?: "string" | "boolean" | "integer" | "double" | "date" | "semver" | "array";
|
|
14
|
+
description?: string;
|
|
15
|
+
}>>>;
|
|
7
16
|
}, "strict", z.ZodTypeAny, {
|
|
8
17
|
archived?: boolean;
|
|
9
|
-
type?: "string" | "boolean" | "integer" | "double" | "date" | "semver";
|
|
18
|
+
type?: "string" | "boolean" | "object" | "integer" | "double" | "date" | "semver" | "array";
|
|
10
19
|
description?: string;
|
|
11
|
-
|
|
20
|
+
properties?: Record<string, {
|
|
21
|
+
type?: "string" | "boolean" | "integer" | "double" | "date" | "semver" | "array";
|
|
22
|
+
description?: string;
|
|
23
|
+
}>;
|
|
12
24
|
}, {
|
|
13
25
|
archived?: boolean;
|
|
14
|
-
type?: "string" | "boolean" | "integer" | "double" | "date" | "semver";
|
|
26
|
+
type?: "string" | "boolean" | "object" | "integer" | "double" | "date" | "semver" | "array";
|
|
15
27
|
description?: string;
|
|
16
|
-
|
|
28
|
+
properties?: Record<string, {
|
|
29
|
+
type?: "string" | "boolean" | "integer" | "double" | "date" | "semver" | "array";
|
|
30
|
+
description?: string;
|
|
31
|
+
}>;
|
|
17
32
|
}>;
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAttributeZodSchema = getAttributeZodSchema;
|
|
4
|
-
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
5
|
function getAttributeZodSchema() {
|
|
6
|
-
|
|
6
|
+
const propertySchema = zod_1.z.object({
|
|
7
|
+
type: zod_1.z.enum([
|
|
8
|
+
"boolean",
|
|
9
|
+
"string",
|
|
10
|
+
"integer",
|
|
11
|
+
"double",
|
|
12
|
+
"date",
|
|
13
|
+
"semver",
|
|
14
|
+
"array",
|
|
15
|
+
// @NOTE: intentionally ignored for now to not allow nesting
|
|
16
|
+
// "object",
|
|
17
|
+
]),
|
|
18
|
+
description: zod_1.z.string().optional(),
|
|
19
|
+
});
|
|
20
|
+
const attributeZodSchema = zod_1.z
|
|
7
21
|
.object({
|
|
8
22
|
archived: zod_1.z.boolean().optional(),
|
|
9
|
-
type: zod_1.z.enum(["boolean", "string", "integer", "double", "date", "semver"]),
|
|
23
|
+
type: zod_1.z.enum(["boolean", "string", "integer", "double", "date", "semver", "object", "array"]),
|
|
10
24
|
description: zod_1.z.string(),
|
|
11
|
-
|
|
25
|
+
properties: zod_1.z.record(zod_1.z.string(), propertySchema).optional(),
|
|
12
26
|
})
|
|
13
27
|
.strict();
|
|
14
28
|
return attributeZodSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributeSchema.js","sourceRoot":"","sources":["../../src/linter/attributeSchema.ts"],"names":[],"mappings":";;AAEA,
|
|
1
|
+
{"version":3,"file":"attributeSchema.js","sourceRoot":"","sources":["../../src/linter/attributeSchema.ts"],"names":[],"mappings":";;AAEA,sDA2BC;AA7BD,6BAAwB;AAExB,SAAgB,qBAAqB;IACnC,MAAM,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;QAC9B,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC;YACX,SAAS;YACT,QAAQ;YACR,SAAS;YACT,QAAQ;YACR,MAAM;YACN,QAAQ;YACR,OAAO;YAEP,4DAA4D;YAC5D,YAAY;SACb,CAAC;QACF,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACnC,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,OAAC;SACzB,MAAM,CAAC;QACN,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;QAChC,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7F,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;QACvB,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC,CAAC,QAAQ,EAAE;KAC5D,CAAC;SACD,MAAM,EAAE,CAAC;IAEZ,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FeatureKey, Required } from "@featurevisor/types";
|
|
1
|
+
import type { FeatureKey, Required } from "@featurevisor/types";
|
|
2
2
|
import { Datasource } from "../datasource";
|
|
3
3
|
export declare function checkForCircularDependencyInRequired(datasource: Datasource, featureKey: FeatureKey, required?: Required[], chain?: FeatureKey[]): Promise<void>;
|
|
@@ -1,85 +1,27 @@
|
|
|
1
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
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.checkForCircularDependencyInRequired = checkForCircularDependencyInRequired;
|
|
40
|
-
function checkForCircularDependencyInRequired(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return [4 /*yield*/, datasource.featureExists(featureKey)];
|
|
64
|
-
case 2:
|
|
65
|
-
requiredFeatureExists = _a.sent();
|
|
66
|
-
if (!requiredFeatureExists) {
|
|
67
|
-
throw new Error("required feature \"".concat(requiredKey, "\" not found"));
|
|
68
|
-
}
|
|
69
|
-
return [4 /*yield*/, datasource.readFeature(requiredKey)];
|
|
70
|
-
case 3:
|
|
71
|
-
requiredParsedFeature = _a.sent();
|
|
72
|
-
if (!requiredParsedFeature.required) return [3 /*break*/, 5];
|
|
73
|
-
return [4 /*yield*/, checkForCircularDependencyInRequired(datasource, featureKey, requiredParsedFeature.required, chain)];
|
|
74
|
-
case 4:
|
|
75
|
-
_a.sent();
|
|
76
|
-
_a.label = 5;
|
|
77
|
-
case 5:
|
|
78
|
-
_i++;
|
|
79
|
-
return [3 /*break*/, 1];
|
|
80
|
-
case 6: return [2 /*return*/];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
});
|
|
4
|
+
async function checkForCircularDependencyInRequired(datasource, featureKey, required, chain = []) {
|
|
5
|
+
if (!required) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const requiredKeys = required.map((r) => (typeof r === "string" ? r : r.key));
|
|
9
|
+
if (requiredKeys.length === 0) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
for (const requiredKey of requiredKeys) {
|
|
13
|
+
chain.push(requiredKey);
|
|
14
|
+
if (chain.indexOf(featureKey) > -1) {
|
|
15
|
+
throw new Error(`circular dependency found: ${chain.join(" -> ")}`);
|
|
16
|
+
}
|
|
17
|
+
const requiredFeatureExists = await datasource.featureExists(featureKey);
|
|
18
|
+
if (!requiredFeatureExists) {
|
|
19
|
+
throw new Error(`required feature "${requiredKey}" not found`);
|
|
20
|
+
}
|
|
21
|
+
const requiredParsedFeature = await datasource.readFeature(requiredKey);
|
|
22
|
+
if (requiredParsedFeature.required) {
|
|
23
|
+
await checkForCircularDependencyInRequired(datasource, featureKey, requiredParsedFeature.required, chain);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
84
26
|
}
|
|
85
27
|
//# sourceMappingURL=checkCircularDependency.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkCircularDependency.js","sourceRoot":"","sources":["../../src/linter/checkCircularDependency.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkCircularDependency.js","sourceRoot":"","sources":["../../src/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types";
|
|
1
|
+
import type { Group } from "@featurevisor/types";
|
|
2
2
|
import { Datasource } from "../datasource";
|
|
3
3
|
export declare function checkForFeatureExceedingGroupSlotPercentage(datasource: Datasource, group: Group, availableFeatureKeys: string[]): Promise<void>;
|