@featurevisor/cli
Advanced tools
Comparing version 1.17.0 to 1.18.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.18.0](https://github.com/featurevisor/featurevisor/compare/v1.17.0...v1.18.0) (2024-04-16) | ||
### Features | ||
* assess traffic distribution via CLI ([#297](https://github.com/featurevisor/featurevisor/issues/297)) ([2063ad9](https://github.com/featurevisor/featurevisor/commit/2063ad9a5408071bfb1636c748cabe616065191d)) | ||
# [1.17.0](https://github.com/featurevisor/featurevisor/compare/v1.16.0...v1.17.0) (2024-04-07) | ||
@@ -8,0 +19,0 @@ |
@@ -499,2 +499,53 @@ "use strict"; | ||
/** | ||
* Assess distribution | ||
*/ | ||
.command({ | ||
command: "assess-distribution", | ||
handler: function (options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var deps, e_8; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!options.environment) { | ||
console.error("Please specify an environment with --environment flag."); | ||
process.exit(1); | ||
} | ||
if (!options.feature) { | ||
console.error("Please specify a feature with --feature flag."); | ||
process.exit(1); | ||
} | ||
return [4 /*yield*/, getDependencies(options)]; | ||
case 1: | ||
deps = _a.sent(); | ||
_a.label = 2; | ||
case 2: | ||
_a.trys.push([2, 4, , 5]); | ||
return [4 /*yield*/, (0, core_1.assessDistribution)(deps, { | ||
environment: options.environment, | ||
feature: options.feature, | ||
context: options.context ? JSON.parse(options.context) : {}, | ||
populateUuid: Array.isArray(options.populateUuid) | ||
? options.populateUuid | ||
: [options.populateUuid].filter(Boolean), | ||
n: parseInt(options.n, 10) || 1, | ||
verbose: options.verbose, | ||
})]; | ||
case 3: | ||
_a.sent(); | ||
return [3 /*break*/, 5]; | ||
case 4: | ||
e_8 = _a.sent(); | ||
console.error(e_8.message); | ||
process.exit(1); | ||
return [3 /*break*/, 5]; | ||
case 5: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}, | ||
}) | ||
.example("$0 assess-distribution", "test traffic distribution of a feature") | ||
.example("$0 assess-distribution --environment=production --feature=my_feature --context='{}' --populateUuid=userId --n=100", "test traffic distribution a feature against provided context") | ||
/** | ||
* Options | ||
@@ -501,0 +552,0 @@ */ |
{ | ||
"name": "@featurevisor/cli", | ||
"version": "1.17.0", | ||
"version": "1.18.0", | ||
"description": "CLI package of Featurevisor", | ||
@@ -50,3 +50,3 @@ "main": "bin.js", | ||
"dependencies": { | ||
"@featurevisor/core": "^1.17.0", | ||
"@featurevisor/core": "^1.18.0", | ||
"yargs": "^17.6.2" | ||
@@ -57,3 +57,3 @@ }, | ||
}, | ||
"gitHead": "41b21ee48a1508fad58824b255403125ce175f95" | ||
"gitHead": "beedecac433ebb53ec5c856ecdf5bf8c5ea159fd" | ||
} |
@@ -28,2 +28,3 @@ import * as fs from "fs"; | ||
evaluateFeature, | ||
assessDistribution, | ||
} from "@featurevisor/core"; | ||
@@ -372,2 +373,43 @@ | ||
/** | ||
* Assess distribution | ||
*/ | ||
.command({ | ||
command: "assess-distribution", | ||
handler: async function (options) { | ||
if (!options.environment) { | ||
console.error("Please specify an environment with --environment flag."); | ||
process.exit(1); | ||
} | ||
if (!options.feature) { | ||
console.error("Please specify a feature with --feature flag."); | ||
process.exit(1); | ||
} | ||
const deps = await getDependencies(options); | ||
try { | ||
await assessDistribution(deps, { | ||
environment: options.environment, | ||
feature: options.feature, | ||
context: options.context ? JSON.parse(options.context) : {}, | ||
populateUuid: Array.isArray(options.populateUuid) | ||
? options.populateUuid | ||
: [options.populateUuid as string].filter(Boolean), | ||
n: parseInt(options.n, 10) || 1, | ||
verbose: options.verbose, | ||
}); | ||
} catch (e) { | ||
console.error(e.message); | ||
process.exit(1); | ||
} | ||
}, | ||
}) | ||
.example("$0 assess-distribution", "test traffic distribution of a feature") | ||
.example( | ||
"$0 assess-distribution --environment=production --feature=my_feature --context='{}' --populateUuid=userId --n=100", | ||
"test traffic distribution a feature against provided context", | ||
) | ||
/** | ||
* Options | ||
@@ -374,0 +416,0 @@ */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
84415
962
+ Added@featurevisor/core@1.30.1(transitive)
+ Added@featurevisor/sdk@1.30.1(transitive)
+ Added@featurevisor/site@1.29.2(transitive)
+ Added@featurevisor/types@1.29.2(transitive)
+ Addedzod@3.24.1(transitive)
- Removed@featurevisor/core@1.31.0(transitive)
- Removed@featurevisor/sdk@1.31.0(transitive)
- Removed@featurevisor/site@1.31.0(transitive)
- Removed@featurevisor/types@1.31.0(transitive)
- Removedzod@3.24.2(transitive)
Updated@featurevisor/core@^1.18.0