aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-report/src/index.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-10-18 19:24:49 +0800
committerGitHub <noreply@github.com>2018-10-18 19:24:49 +0800
commit9e8bca69a8a1d3570e30a28f150c0bec3848a760 (patch)
tree11eaac8886369ce40fd7acac66f5aa8985e6af61 /packages/sra-report/src/index.ts
parent325af82217e994fdde8e904b93a76e6e3461f85a (diff)
parentf8876ab60b5e8fa606073d6c48aa1395dbadd88b (diff)
downloaddexon-sol-tools-9e8bca69a8a1d3570e30a28f150c0bec3848a760.tar
dexon-sol-tools-9e8bca69a8a1d3570e30a28f150c0bec3848a760.tar.gz
dexon-sol-tools-9e8bca69a8a1d3570e30a28f150c0bec3848a760.tar.bz2
dexon-sol-tools-9e8bca69a8a1d3570e30a28f150c0bec3848a760.tar.lz
dexon-sol-tools-9e8bca69a8a1d3570e30a28f150c0bec3848a760.tar.xz
dexon-sol-tools-9e8bca69a8a1d3570e30a28f150c0bec3848a760.tar.zst
dexon-sol-tools-9e8bca69a8a1d3570e30a28f150c0bec3848a760.zip
Merge pull request #1155 from 0xProject/feature/RIP-sra-report
Remove sra-report
Diffstat (limited to 'packages/sra-report/src/index.ts')
-rw-r--r--packages/sra-report/src/index.ts111
1 files changed, 0 insertions, 111 deletions
diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts
deleted file mode 100644
index b23b6c8d2..000000000
--- a/packages/sra-report/src/index.ts
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/env node
-import { assert } from '@0xproject/assert';
-import { logUtils } from '@0xproject/utils';
-import chalk from 'chalk';
-import * as _ from 'lodash';
-import * as yargs from 'yargs';
-
-import * as sraReportCollectionJSON from '../../postman_collections/sra_report.postman_collection.json';
-
-import { postmanEnvironmentFactory } from './postman_environment_factory';
-import { utils } from './utils';
-
-const DEFAULT_NETWORK_ID = 1;
-const networkNameToId: { [networkName: string]: number } = {
- mainnet: 1,
- ropsten: 3,
- rinkeby: 4,
- kovan: 42,
-};
-const SUPPORTED_NETWORK_IDS = [
- networkNameToId.mainnet,
- networkNameToId.ropsten,
- networkNameToId.rinkeby,
- networkNameToId.kovan,
-];
-
-// extract command line arguments
-const args = yargs
- .option('endpoint-url', {
- alias: ['e'],
- describe: 'API endpoint url to test for standard relayer API compliance',
- type: 'string',
- demandOption: true,
- })
- .option('output', {
- alias: ['o', 'out'],
- describe: 'The relative path to write the report generated by the collection run, prints to console by default',
- type: 'string',
- normalize: true,
- demandOption: false,
- })
- .option('network-id', {
- alias: ['n'],
- describe: 'ID of the network that the API is serving orders from',
- type: 'number',
- default: DEFAULT_NETWORK_ID,
- })
- .option('environment', {
- alias: ['env'],
- describe: 'The relative path to a postman environment file for the collection run',
- type: 'string',
- normalize: true,
- demandOption: false,
- })
- .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 --environment 'path/to/custom/environment.json' --export-collection 'path/to/collection.json' --export-environment 'path/to/environment.json'",
- 'Full usage example',
- ).argv;
-// perform extra validation on command line arguments
-try {
- assert.isWebUri('args', args.endpointUrl);
-} catch (err) {
- logUtils.log(`${chalk.red(`Invalid url format:`)} ${args.endpointUrl}`);
- process.exit(1);
-}
-if (!_.includes(SUPPORTED_NETWORK_IDS, args.networkId)) {
- logUtils.log(`${chalk.red(`Unsupported network id:`)} ${args.networkId}`);
- logUtils.log(`${chalk.bold(`Supported network ids:`)} ${SUPPORTED_NETWORK_IDS}`);
- process.exit(1);
-}
-const mainAsync = async () => {
- const newmanReporterOptions = !_.isUndefined(args.output)
- ? {
- reporters: 'json',
- reporter: {
- json: {
- export: args.output,
- },
- },
- }
- : {
- reporters: 'cli',
- };
- const environment = !_.isUndefined(args.environment)
- ? args.environment
- : await postmanEnvironmentFactory.createPostmanEnvironmentAsync(args.endpointUrl, args.networkId);
- const newmanRunOptions = {
- collection: sraReportCollectionJSON,
- environment,
- exportCollection: args.exportCollection,
- exportEnvironment: args.exportEnvironment,
- ...newmanReporterOptions,
- };
- await utils.newmanRunAsync(newmanRunOptions);
-};
-
-mainAsync().catch(logUtils.log.bind(logUtils));