@featurevisor/core 2.13.0 → 2.15.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 +22 -0
- package/coverage/clover.xml +1499 -1028
- package/coverage/coverage-final.json +21 -17
- package/coverage/lcov-report/builder/allocator.ts.html +1 -1
- package/coverage/lcov-report/builder/buildScopedConditions.ts.html +1 -1
- package/coverage/lcov-report/builder/buildScopedDatafile.ts.html +1 -1
- package/coverage/lcov-report/builder/buildScopedSegments.ts.html +1 -1
- package/coverage/lcov-report/builder/index.html +38 -8
- package/coverage/lcov-report/builder/mutateVariables.ts.html +400 -0
- package/coverage/lcov-report/builder/mutator.ts.html +796 -0
- package/coverage/lcov-report/builder/revision.ts.html +1 -1
- package/coverage/lcov-report/builder/traffic.ts.html +1 -1
- package/coverage/lcov-report/config/index.html +30 -15
- package/coverage/lcov-report/config/index.ts.html +88 -0
- package/coverage/lcov-report/config/projectConfig.ts.html +79 -46
- package/coverage/lcov-report/datasource/adapter.ts.html +74 -11
- package/coverage/lcov-report/datasource/datasource.ts.html +77 -26
- package/coverage/lcov-report/datasource/filesystemAdapter.ts.html +693 -69
- package/coverage/lcov-report/datasource/index.html +35 -35
- package/coverage/lcov-report/datasource/index.ts.html +1 -1
- package/coverage/lcov-report/index.html +53 -53
- package/coverage/lcov-report/linter/attributeSchema.ts.html +4 -4
- package/coverage/lcov-report/linter/checkCircularDependency.ts.html +1 -1
- package/coverage/lcov-report/linter/checkPercentageExceedingSlot.ts.html +1 -1
- package/coverage/lcov-report/linter/conditionSchema.ts.html +7 -7
- package/coverage/lcov-report/linter/featureSchema.ts.html +848 -389
- package/coverage/lcov-report/linter/groupSchema.ts.html +3 -3
- package/coverage/lcov-report/linter/index.html +50 -35
- package/coverage/lcov-report/linter/lintProject.ts.html +437 -92
- package/coverage/lcov-report/linter/mutationNotation.ts.html +1309 -0
- package/coverage/lcov-report/linter/printError.ts.html +9 -9
- package/coverage/lcov-report/linter/schema.ts.html +69 -69
- package/coverage/lcov-report/linter/segmentSchema.ts.html +3 -3
- package/coverage/lcov-report/linter/testSchema.ts.html +10 -10
- package/coverage/lcov-report/list/index.html +1 -1
- package/coverage/lcov-report/list/matrix.ts.html +1 -1
- package/coverage/lcov-report/parsers/index.html +1 -1
- package/coverage/lcov-report/parsers/index.ts.html +4 -4
- package/coverage/lcov-report/parsers/json.ts.html +2 -2
- package/coverage/lcov-report/parsers/yml.ts.html +6 -6
- package/coverage/lcov-report/tester/cliFormat.ts.html +1 -1
- package/coverage/lcov-report/tester/helpers.ts.html +1 -1
- package/coverage/lcov-report/tester/index.html +1 -1
- package/coverage/lcov-report/utils/git.ts.html +118 -16
- package/coverage/lcov-report/utils/index.html +14 -14
- package/coverage/lcov.info +2918 -1932
- package/lib/builder/buildDatafile.js +8 -3
- package/lib/builder/buildDatafile.js.map +1 -1
- package/lib/builder/mutateVariables.d.ts +14 -0
- package/lib/builder/mutateVariables.js +90 -0
- package/lib/builder/mutateVariables.js.map +1 -0
- package/lib/builder/mutateVariables.spec.d.ts +1 -0
- package/lib/builder/mutateVariables.spec.js +1045 -0
- package/lib/builder/mutateVariables.spec.js.map +1 -0
- package/lib/builder/mutator.d.ts +20 -0
- package/lib/builder/mutator.js +223 -0
- package/lib/builder/mutator.js.map +1 -0
- package/lib/builder/mutator.spec.d.ts +1 -0
- package/lib/builder/mutator.spec.js +368 -0
- package/lib/builder/mutator.spec.js.map +1 -0
- package/lib/config/projectConfig.d.ts +3 -0
- package/lib/config/projectConfig.js +7 -1
- package/lib/config/projectConfig.js.map +1 -1
- package/lib/config/projectConfig.spec.d.ts +1 -0
- package/lib/config/projectConfig.spec.js +24 -0
- package/lib/config/projectConfig.spec.js.map +1 -0
- package/lib/datasource/adapter.d.ts +7 -0
- package/lib/datasource/adapter.js +7 -0
- package/lib/datasource/adapter.js.map +1 -1
- package/lib/datasource/datasource.d.ts +3 -1
- package/lib/datasource/datasource.js +6 -0
- package/lib/datasource/datasource.js.map +1 -1
- package/lib/datasource/filesystemAdapter.d.ts +8 -0
- package/lib/datasource/filesystemAdapter.js +134 -7
- package/lib/datasource/filesystemAdapter.js.map +1 -1
- package/lib/datasource/filesystemAdapter.spec.d.ts +1 -0
- package/lib/datasource/filesystemAdapter.spec.js +88 -0
- package/lib/datasource/filesystemAdapter.spec.js.map +1 -0
- package/lib/linter/conditionSchema.spec.js +2 -0
- package/lib/linter/conditionSchema.spec.js.map +1 -1
- package/lib/linter/featureSchema.d.ts +7 -7
- package/lib/linter/featureSchema.js +176 -103
- package/lib/linter/featureSchema.js.map +1 -1
- package/lib/linter/featureSchema.spec.js +167 -0
- package/lib/linter/featureSchema.spec.js.map +1 -1
- package/lib/linter/lintProject.d.ts +2 -0
- package/lib/linter/lintProject.js +85 -8
- package/lib/linter/lintProject.js.map +1 -1
- package/lib/linter/lintProject.spec.js +37 -0
- package/lib/linter/lintProject.spec.js.map +1 -1
- package/lib/linter/mutationNotation.d.ts +47 -0
- package/lib/linter/mutationNotation.js +381 -0
- package/lib/linter/mutationNotation.js.map +1 -0
- package/lib/linter/mutationNotation.spec.d.ts +1 -0
- package/lib/linter/mutationNotation.spec.js +549 -0
- package/lib/linter/mutationNotation.spec.js.map +1 -0
- package/lib/linter/segmentSchema.spec.js +2 -0
- package/lib/linter/segmentSchema.spec.js.map +1 -1
- package/lib/utils/git.js +32 -7
- package/lib/utils/git.js.map +1 -1
- package/package.json +2 -2
- package/src/builder/buildDatafile.ts +29 -3
- package/src/builder/mutateVariables.spec.ts +1134 -0
- package/src/builder/mutateVariables.ts +105 -0
- package/src/builder/mutator.spec.ts +413 -0
- package/src/builder/mutator.ts +237 -0
- package/src/config/projectConfig.spec.ts +31 -0
- package/src/config/projectConfig.ts +11 -0
- package/src/datasource/adapter.ts +21 -0
- package/src/datasource/datasource.ts +18 -1
- package/src/datasource/filesystemAdapter.spec.ts +153 -0
- package/src/datasource/filesystemAdapter.ts +216 -8
- package/src/linter/conditionSchema.spec.ts +2 -0
- package/src/linter/featureSchema.spec.ts +203 -0
- package/src/linter/featureSchema.ts +320 -167
- package/src/linter/lintProject.spec.ts +74 -0
- package/src/linter/lintProject.ts +123 -8
- package/src/linter/mutationNotation.spec.ts +642 -0
- package/src/linter/mutationNotation.ts +408 -0
- package/src/linter/segmentSchema.spec.ts +2 -0
- package/src/utils/git.ts +41 -7
package/lib/utils/git.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCommit = getCommit;
|
|
4
4
|
const path = require("path");
|
|
5
|
+
function isWithinDirectory(directoryPath, fileDirectoryPath) {
|
|
6
|
+
return (fileDirectoryPath === directoryPath || fileDirectoryPath.startsWith(directoryPath + path.sep));
|
|
7
|
+
}
|
|
5
8
|
function parseGitCommitShowOutput(gitShowOutput) {
|
|
6
9
|
const result = {
|
|
7
10
|
hash: "",
|
|
@@ -72,22 +75,26 @@ function getCommit(gitShowOutput, options) {
|
|
|
72
75
|
const relativeDir = path.dirname(absolutePath);
|
|
73
76
|
// get entity type
|
|
74
77
|
let type = "attribute";
|
|
75
|
-
if (
|
|
78
|
+
if (isWithinDirectory(projectConfig.attributesDirectoryPath, relativeDir)) {
|
|
76
79
|
type = "attribute";
|
|
77
80
|
}
|
|
78
|
-
else if (
|
|
81
|
+
else if (isWithinDirectory(projectConfig.segmentsDirectoryPath, relativeDir)) {
|
|
79
82
|
type = "segment";
|
|
80
83
|
}
|
|
81
|
-
else if (
|
|
84
|
+
else if (isWithinDirectory(projectConfig.featuresDirectoryPath, relativeDir)) {
|
|
85
|
+
type = "feature";
|
|
86
|
+
}
|
|
87
|
+
else if (projectConfig.splitByEnvironment &&
|
|
88
|
+
isWithinDirectory(projectConfig.environmentsDirectoryPath, relativeDir)) {
|
|
82
89
|
type = "feature";
|
|
83
90
|
}
|
|
84
|
-
else if (
|
|
91
|
+
else if (isWithinDirectory(projectConfig.groupsDirectoryPath, relativeDir)) {
|
|
85
92
|
type = "group";
|
|
86
93
|
}
|
|
87
|
-
else if (
|
|
94
|
+
else if (isWithinDirectory(projectConfig.schemasDirectoryPath, relativeDir)) {
|
|
88
95
|
type = "schema";
|
|
89
96
|
}
|
|
90
|
-
else if (
|
|
97
|
+
else if (isWithinDirectory(projectConfig.testsDirectoryPath, relativeDir)) {
|
|
91
98
|
type = "test";
|
|
92
99
|
}
|
|
93
100
|
else {
|
|
@@ -101,7 +108,25 @@ function getCommit(gitShowOutput, options) {
|
|
|
101
108
|
// unknown extension
|
|
102
109
|
return;
|
|
103
110
|
}
|
|
104
|
-
|
|
111
|
+
let key = fileName.replace(extensionWithDot, "");
|
|
112
|
+
if (type === "feature" &&
|
|
113
|
+
projectConfig.splitByEnvironment &&
|
|
114
|
+
absolutePath.startsWith(projectConfig.environmentsDirectoryPath + path.sep)) {
|
|
115
|
+
const featureRelativePath = absolutePath
|
|
116
|
+
.replace(projectConfig.environmentsDirectoryPath + path.sep, "")
|
|
117
|
+
.split(path.sep)
|
|
118
|
+
.slice(1)
|
|
119
|
+
.join(path.sep)
|
|
120
|
+
.replace(extensionWithDot, "");
|
|
121
|
+
key = featureRelativePath.replace(/\\/g, "/");
|
|
122
|
+
}
|
|
123
|
+
else if (type === "feature" &&
|
|
124
|
+
absolutePath.startsWith(projectConfig.featuresDirectoryPath + path.sep)) {
|
|
125
|
+
key = absolutePath
|
|
126
|
+
.replace(projectConfig.featuresDirectoryPath + path.sep, "")
|
|
127
|
+
.replace(extensionWithDot, "")
|
|
128
|
+
.replace(/\\/g, "/");
|
|
129
|
+
}
|
|
105
130
|
const entityDiff = {
|
|
106
131
|
type,
|
|
107
132
|
key,
|
package/lib/utils/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":";;AAoEA,8B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YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,qBAAqB,GAAG,IAAI,CAAC,GAAG,CAAC,EACvE,CAAC;YACD,GAAG,GAAG,YAAY;iBACf,OAAO,CAAC,aAAa,CAAC,qBAAqB,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;iBAC3D,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC;iBAC7B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACzB,CAAC;QAED,MAAM,UAAU,GAAe;YAC7B,IAAI;YACJ,GAAG;YACH,OAAO,EAAE,IAAI;SACd,CAAC;QAEF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;QAC5B,CAAC;aAAM,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAChC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;QAC5B,CAAC;QAED,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@featurevisor/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "Core package of Featurevisor for Node.js usage",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"yargs": "^17.7.2",
|
|
50
50
|
"zod": "^3.22.4"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "5d3bb98dcc4f3570d5fc43413b095e753f5bcd59"
|
|
53
53
|
}
|
|
@@ -30,6 +30,10 @@ import { generateHashForDatafile, generateHashForFeature, getSegmentHashes } fro
|
|
|
30
30
|
import { getTraffic } from "./traffic";
|
|
31
31
|
import { getFeatureRanges } from "./getFeatureRanges";
|
|
32
32
|
import { convertToV1 } from "./convertToV1";
|
|
33
|
+
import {
|
|
34
|
+
resolveMutationsForMultipleVariables,
|
|
35
|
+
resolveMutationsForSingleVariable,
|
|
36
|
+
} from "./mutateVariables";
|
|
33
37
|
|
|
34
38
|
export interface CustomDatafileOptions {
|
|
35
39
|
featureKey?: string;
|
|
@@ -210,7 +214,10 @@ export async function buildDatafile(
|
|
|
210
214
|
const mappedVariation: any = {
|
|
211
215
|
value: variation.value,
|
|
212
216
|
weight: variation.weight, // @NOTE: added so state files can maintain weight info, but datafiles don't need this. find a way to remove it from datafiles later
|
|
213
|
-
variables:
|
|
217
|
+
variables: resolveMutationsForMultipleVariables(
|
|
218
|
+
parsedFeature.variablesSchema,
|
|
219
|
+
variation.variables,
|
|
220
|
+
),
|
|
214
221
|
variableOverrides: variation.variableOverrides,
|
|
215
222
|
};
|
|
216
223
|
|
|
@@ -235,7 +242,11 @@ export async function buildDatafile(
|
|
|
235
242
|
projectConfig.stringify && typeof override.conditions !== "string"
|
|
236
243
|
? JSON.stringify(override.conditions)
|
|
237
244
|
: override.conditions,
|
|
238
|
-
value:
|
|
245
|
+
value: resolveMutationsForSingleVariable(
|
|
246
|
+
parsedFeature.variablesSchema,
|
|
247
|
+
variableKey,
|
|
248
|
+
override.value,
|
|
249
|
+
),
|
|
239
250
|
};
|
|
240
251
|
}
|
|
241
252
|
|
|
@@ -252,7 +263,11 @@ export async function buildDatafile(
|
|
|
252
263
|
projectConfig.stringify && typeof override.segments !== "string"
|
|
253
264
|
? JSON.stringify(override.segments)
|
|
254
265
|
: override.segments,
|
|
255
|
-
value:
|
|
266
|
+
value: resolveMutationsForSingleVariable(
|
|
267
|
+
parsedFeature.variablesSchema,
|
|
268
|
+
variableKey,
|
|
269
|
+
override.value,
|
|
270
|
+
),
|
|
256
271
|
};
|
|
257
272
|
}
|
|
258
273
|
|
|
@@ -272,6 +287,10 @@ export async function buildDatafile(
|
|
|
272
287
|
).map((t: Traffic) => {
|
|
273
288
|
return {
|
|
274
289
|
...t,
|
|
290
|
+
variables: resolveMutationsForMultipleVariables(
|
|
291
|
+
parsedFeature.variablesSchema,
|
|
292
|
+
t.variables,
|
|
293
|
+
),
|
|
275
294
|
segments:
|
|
276
295
|
typeof t.segments !== "string" && projectConfig.stringify
|
|
277
296
|
? JSON.stringify(t.segments)
|
|
@@ -352,6 +371,13 @@ export async function buildDatafile(
|
|
|
352
371
|
: f.conditions;
|
|
353
372
|
}
|
|
354
373
|
|
|
374
|
+
if (f.variables) {
|
|
375
|
+
f.variables = resolveMutationsForMultipleVariables(
|
|
376
|
+
parsedFeature.variablesSchema,
|
|
377
|
+
f.variables,
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
|
|
355
381
|
return f;
|
|
356
382
|
});
|
|
357
383
|
}
|