diff options
Diffstat (limited to 'packages/sra-report')
-rw-r--r-- | packages/sra-report/src/index.ts | 21 |
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); |