aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-03-06 16:18:58 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-03-06 16:18:58 +0800
commiteb201c4084834e06fc8376434e8a7f793f916c24 (patch)
tree4ac032658b58d0fc1e73a21d550b79a523f40dea
parent61ad8d4c1055096c98075282514f8a6fad020acc (diff)
downloaddexon-sol-tools-eb201c4084834e06fc8376434e8a7f793f916c24.tar.gz
dexon-sol-tools-eb201c4084834e06fc8376434e8a7f793f916c24.tar.zst
dexon-sol-tools-eb201c4084834e06fc8376434e8a7f793f916c24.zip
Add options for exporting environment and collection files
-rw-r--r--packages/sra-report/src/index.ts21
1 files changed, 18 insertions, 3 deletions
diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts
index 4e93708ee..37c7a8f04 100644
--- a/packages/sra-report/src/index.ts
+++ b/packages/sra-report/src/index.ts
@@ -27,7 +27,7 @@ const args = yargs
})
.option('output', {
alias: ['o', 'out'],
- describe: 'Folder where to write the reports',
+ describe: 'The relative path to write the report generated by the collection run, prints to console by default',
type: 'string',
normalize: true,
demandOption: false,
@@ -38,7 +38,21 @@ const args = yargs
type: 'number',
default: DEFAULT_NETWORK_ID,
})
- .example("$0 --endpoint-url 'http://api.example.com' --out 'src/contracts/generated/' --network-id 42", 'Full usage example')
+ .option('export-collection', {
+ alias: ['ec'],
+ describe: 'The relative path to write the postman collection file used by the collection run',
+ type: 'string',
+ normalize: true,
+ demandOption: false,
+ })
+ .option('export-environment', {
+ alias: ['ee'],
+ describe: 'The relative path to write the postman environment file used by the collection run',
+ type: 'string',
+ normalize: true,
+ demandOption: false,
+ })
+ .example("$0 --endpoint-url 'http://api.example.com' --out 'path/to/report.json' --network-id 42 --export-environment 'path/to/environment.json' --export-collection 'path/to/collection.json'", 'Full usage example')
.argv;
// perform extra validation on command line arguments
try {
@@ -52,7 +66,6 @@ if (!_.includes(SUPPORTED_NETWORK_IDS, args.networkId)) {
utils.log(`${chalk.bold(`Supported network ids:`)} ${SUPPORTED_NETWORK_IDS}`);
process.exit(1);
}
-
const mainAsync = async () => {
const httpClient = new HttpClient(args.endpointUrl);
const orders = await httpClient.getOrdersAsync();
@@ -75,6 +88,8 @@ const mainAsync = async () => {
const newmanRunOptions = {
collection: sraReportCollectionJSON,
environment: postmanEnvironmentFactory.createPostmanEnvironment(args.endpointUrl, args.networkId, firstOrder),
+ exportCollection: args.exportCollection,
+ exportEnvironment: args.exportEnvironment,
...newmanReporterOptions,
};
await newmanRunAsync(newmanRunOptions);