@featurevisor/core 1.11.1 → 1.12.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/.eslintcache +1 -1
- package/CHANGELOG.md +11 -0
- package/LICENSE +1 -1
- package/coverage/clover.xml +69 -69
- package/coverage/coverage-final.json +2 -2
- package/coverage/lcov-report/index.html +7 -7
- package/coverage/lcov-report/lib/builder/allocator.js.html +1 -1
- package/coverage/lcov-report/lib/builder/index.html +5 -5
- package/coverage/lcov-report/lib/builder/revision.js.html +1 -1
- package/coverage/lcov-report/lib/builder/traffic.js.html +5 -11
- package/coverage/lcov-report/lib/tester/checkIfObjectsAreEqual.js.html +1 -1
- package/coverage/lcov-report/lib/tester/index.html +1 -1
- package/coverage/lcov-report/lib/tester/matrix.js.html +1 -1
- package/coverage/lcov-report/src/builder/allocator.ts.html +1 -1
- package/coverage/lcov-report/src/builder/index.html +5 -5
- package/coverage/lcov-report/src/builder/revision.ts.html +1 -1
- package/coverage/lcov-report/src/builder/traffic.ts.html +6 -15
- package/coverage/lcov-report/src/tester/checkIfObjectsAreEqual.ts.html +1 -1
- package/coverage/lcov-report/src/tester/index.html +1 -1
- package/coverage/lcov-report/src/tester/matrix.ts.html +1 -1
- package/coverage/lcov.info +113 -117
- package/lib/builder/buildDatafile.js +23 -6
- package/lib/builder/buildDatafile.js.map +1 -1
- package/lib/builder/traffic.js +1 -3
- package/lib/builder/traffic.js.map +1 -1
- package/lib/config/projectConfig.d.ts +1 -0
- package/lib/config/projectConfig.js +3 -1
- package/lib/config/projectConfig.js.map +1 -1
- package/package.json +2 -2
- package/src/builder/buildDatafile.ts +16 -6
- package/src/builder/traffic.ts +2 -5
- package/src/config/projectConfig.ts +4 -1
|
@@ -159,7 +159,9 @@ export async function buildDatafile(
|
|
|
159
159
|
);
|
|
160
160
|
|
|
161
161
|
return {
|
|
162
|
-
conditions:
|
|
162
|
+
conditions: projectConfig.stringify
|
|
163
|
+
? JSON.stringify(override.conditions)
|
|
164
|
+
: override.conditions,
|
|
163
165
|
value: override.value,
|
|
164
166
|
};
|
|
165
167
|
}
|
|
@@ -174,9 +176,9 @@ export async function buildDatafile(
|
|
|
174
176
|
|
|
175
177
|
return {
|
|
176
178
|
segments:
|
|
177
|
-
typeof override.segments
|
|
178
|
-
? override.segments
|
|
179
|
-
:
|
|
179
|
+
typeof override.segments !== "string" && projectConfig.stringify
|
|
180
|
+
? JSON.stringify(override.segments)
|
|
181
|
+
: override.segments,
|
|
180
182
|
value: override.value,
|
|
181
183
|
};
|
|
182
184
|
}
|
|
@@ -195,7 +197,15 @@ export async function buildDatafile(
|
|
|
195
197
|
parsedFeature.environments[options.environment].rules,
|
|
196
198
|
existingState.features[featureKey],
|
|
197
199
|
featureRanges.get(featureKey) || [],
|
|
198
|
-
)
|
|
200
|
+
).map((t: Traffic) => {
|
|
201
|
+
return {
|
|
202
|
+
...t,
|
|
203
|
+
segments:
|
|
204
|
+
typeof t.segments !== "string" && projectConfig.stringify
|
|
205
|
+
? JSON.stringify(t.segments)
|
|
206
|
+
: t.segments,
|
|
207
|
+
};
|
|
208
|
+
}),
|
|
199
209
|
ranges: featureRanges.get(featureKey) || undefined,
|
|
200
210
|
};
|
|
201
211
|
|
|
@@ -278,7 +288,7 @@ export async function buildDatafile(
|
|
|
278
288
|
const segment: Segment = {
|
|
279
289
|
key: segmentKey,
|
|
280
290
|
conditions:
|
|
281
|
-
typeof parsedSegment.conditions !== "string"
|
|
291
|
+
typeof parsedSegment.conditions !== "string" && projectConfig.stringify === true
|
|
282
292
|
? JSON.stringify(parsedSegment.conditions)
|
|
283
293
|
: parsedSegment.conditions,
|
|
284
294
|
};
|
package/src/builder/traffic.ts
CHANGED
|
@@ -79,11 +79,8 @@ export function getTraffic(
|
|
|
79
79
|
const rulePercentage = parsedRule.percentage; // 0 - 100
|
|
80
80
|
|
|
81
81
|
const traffic: Traffic = {
|
|
82
|
-
key: parsedRule.key,
|
|
83
|
-
segments:
|
|
84
|
-
typeof parsedRule.segments !== "string"
|
|
85
|
-
? JSON.stringify(parsedRule.segments)
|
|
86
|
-
: parsedRule.segments,
|
|
82
|
+
key: parsedRule.key,
|
|
83
|
+
segments: parsedRule.segments,
|
|
87
84
|
percentage: rulePercentage * (MAX_BUCKETED_NUMBER / 100),
|
|
88
85
|
allocation: [],
|
|
89
86
|
};
|
|
@@ -42,6 +42,7 @@ export interface ProjectConfig {
|
|
|
42
42
|
parser: Parser;
|
|
43
43
|
prettyState: boolean;
|
|
44
44
|
prettyDatafile: boolean;
|
|
45
|
+
stringify: boolean;
|
|
45
46
|
siteExportDirectoryPath: string;
|
|
46
47
|
adapter: any; // @TODO: type this properly later
|
|
47
48
|
}
|
|
@@ -66,6 +67,7 @@ export function getProjectConfig(rootDirectoryPath: string): ProjectConfig {
|
|
|
66
67
|
|
|
67
68
|
prettyState: DEFAULT_PRETTY_STATE,
|
|
68
69
|
prettyDatafile: DEFAULT_PRETTY_DATAFILE,
|
|
70
|
+
stringify: true,
|
|
69
71
|
|
|
70
72
|
siteExportDirectoryPath: path.join(rootDirectoryPath, SITE_EXPORT_DIRECTORY_NAME),
|
|
71
73
|
|
|
@@ -78,7 +80,8 @@ export function getProjectConfig(rootDirectoryPath: string): ProjectConfig {
|
|
|
78
80
|
const mergedConfig = {};
|
|
79
81
|
|
|
80
82
|
Object.keys(baseConfig).forEach((key) => {
|
|
81
|
-
mergedConfig[key] =
|
|
83
|
+
mergedConfig[key] =
|
|
84
|
+
typeof customConfig[key] !== "undefined" ? customConfig[key] : baseConfig[key];
|
|
82
85
|
|
|
83
86
|
if (key.endsWith("Path") && mergedConfig[key].indexOf(ROOT_DIR_PLACEHOLDER) !== -1) {
|
|
84
87
|
mergedConfig[key] = mergedConfig[key].replace(ROOT_DIR_PLACEHOLDER, rootDirectoryPath);
|