aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-report
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sra-report')
-rw-r--r--packages/sra-report/CHANGELOG.md1
-rw-r--r--packages/sra-report/package.json6
-rw-r--r--packages/sra-report/scripts/postpublish.js5
-rw-r--r--packages/sra-report/src/index.ts11
-rw-r--r--packages/sra-report/src/monorepo_scripts/postpublish.ts8
-rw-r--r--packages/sra-report/src/postman_environment_factory.ts4
-rw-r--r--packages/sra-report/src/utils.ts9
7 files changed, 20 insertions, 24 deletions
diff --git a/packages/sra-report/CHANGELOG.md b/packages/sra-report/CHANGELOG.md
index 8a62d0266..458b0d6f7 100644
--- a/packages/sra-report/CHANGELOG.md
+++ b/packages/sra-report/CHANGELOG.md
@@ -3,5 +3,6 @@
## v0.0.2 - _TBD, 2018_
* Added postman collection unit tests (#451)
+ * Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
## v0.0.1 - _March 8, 2018_
diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json
index a4a12b875..d1866a706 100644
--- a/packages/sra-report/package.json
+++ b/packages/sra-report/package.json
@@ -6,8 +6,9 @@
"types": "lib/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
+ "clean": "shx rm -rf lib scripts",
+ "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
- "clean": "shx rm -rf lib",
"build": "tsc",
"test": "run-s clean build copy_test_environments copy_test_fixtures run_mocha",
"copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures",
@@ -38,6 +39,7 @@
"yargs": "^10.0.3"
},
"devDependencies": {
+ "@0xproject/monorepo-scripts": "^0.1.12",
"@0xproject/tslint-config": "^0.4.10",
"@types/lodash": "^4.14.86",
"@types/mocha": "^2.2.48",
@@ -48,7 +50,7 @@
"chai-as-promised": "^7.1.0",
"chai-as-promised-typescript-typings": "^0.0.10",
"chai-typescript-typings": "^0.0.4",
- "copyfiles": "^2.0.0",
+ "copyfiles": "^1.2.0",
"dirty-chai": "^2.0.1",
"mocha": "^4.0.1",
"nock": "^9.2.3",
diff --git a/packages/sra-report/scripts/postpublish.js b/packages/sra-report/scripts/postpublish.js
deleted file mode 100644
index 639656c7e..000000000
--- a/packages/sra-report/scripts/postpublish.js
+++ /dev/null
@@ -1,5 +0,0 @@
-const postpublish_utils = require('../../../scripts/postpublish_utils');
-const packageJSON = require('../package.json');
-
-const subPackageName = packageJSON.name;
-postpublish_utils.standardPostPublishAsync(subPackageName);
diff --git a/packages/sra-report/src/index.ts b/packages/sra-report/src/index.ts
index 022464d28..bce9d17ec 100644
--- a/packages/sra-report/src/index.ts
+++ b/packages/sra-report/src/index.ts
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import { assert } from '@0xproject/assert';
import { Schema, schemas } from '@0xproject/json-schemas';
-import { promisify } from '@0xproject/utils';
+import { logUtils, promisify } from '@0xproject/utils';
import chalk from 'chalk';
import * as _ from 'lodash';
import * as newman from 'newman';
@@ -10,7 +10,6 @@ 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 SUPPORTED_NETWORK_IDS = [1, 3, 4, 42];
@@ -65,12 +64,12 @@ const args = yargs
try {
assert.isWebUri('args', args.endpointUrl);
} catch (err) {
- utils.log(`${chalk.red(`Invalid url format:`)} ${args.endpointUrl}`);
+ logUtils.log(`${chalk.red(`Invalid url format:`)} ${args.endpointUrl}`);
process.exit(1);
}
if (!_.includes(SUPPORTED_NETWORK_IDS, args.networkId)) {
- utils.log(`${chalk.red(`Unsupported network id:`)} ${args.networkId}`);
- utils.log(`${chalk.bold(`Supported network ids:`)} ${SUPPORTED_NETWORK_IDS}`);
+ 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 () => {
@@ -98,4 +97,4 @@ const mainAsync = async () => {
};
await utils.newmanRunAsync(newmanRunOptions);
};
-mainAsync().catch(utils.log);
+mainAsync().catch(logUtils.log);
diff --git a/packages/sra-report/src/monorepo_scripts/postpublish.ts b/packages/sra-report/src/monorepo_scripts/postpublish.ts
new file mode 100644
index 000000000..dcb99d0f7
--- /dev/null
+++ b/packages/sra-report/src/monorepo_scripts/postpublish.ts
@@ -0,0 +1,8 @@
+import { postpublishUtils } from '@0xproject/monorepo-scripts';
+
+import * as packageJSON from '../package.json';
+import * as tsConfigJSON from '../tsconfig.json';
+
+const cwd = `${__dirname}/..`;
+// tslint:disable-next-line:no-floating-promises
+postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/sra-report/src/postman_environment_factory.ts b/packages/sra-report/src/postman_environment_factory.ts
index ffac7ac2e..530cacb07 100644
--- a/packages/sra-report/src/postman_environment_factory.ts
+++ b/packages/sra-report/src/postman_environment_factory.ts
@@ -1,6 +1,7 @@
import { SignedOrder, ZeroEx } from '0x.js';
import { HttpClient } from '@0xproject/connect';
import { Schema, schemas as schemasByName } from '@0xproject/json-schemas';
+import { logUtils } from '@0xproject/utils';
import chalk from 'chalk';
import * as _ from 'lodash';
@@ -8,7 +9,6 @@ import { addresses as kovanAddresses } from './contract_addresses/kovan_addresse
import { addresses as mainnetAddresses } from './contract_addresses/mainnet_addresses';
import { addresses as rinkebyAddresses } from './contract_addresses/rinkeby_addresses';
import { addresses as ropstenAddresses } from './contract_addresses/ropsten_addresses';
-import { utils } from './utils';
const ENVIRONMENT_NAME = 'SRA Report';
@@ -81,7 +81,7 @@ async function createOrderEnvironmentValuesAsync(url: string) {
createEnvironmentValue('orderHash', ZeroEx.getOrderHashHex(orderIfExists)),
];
} else {
- utils.log(`${chalk.red(`No orders from /orders found`)}`);
+ logUtils.log(`${chalk.red(`No orders from /orders found`)}`);
return [
createEnvironmentValue('order', ''),
createEnvironmentValue('orderMaker', ''),
diff --git a/packages/sra-report/src/utils.ts b/packages/sra-report/src/utils.ts
deleted file mode 100644
index 57c1b5af3..000000000
--- a/packages/sra-report/src/utils.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { promisify } from '@0xproject/utils';
-import { NewmanRunSummary, run as newmanRun } from 'newman';
-
-export const utils = {
- log(...args: any[]): void {
- console.log(...args); // tslint:disable-line:no-console
- },
- newmanRunAsync: promisify<NewmanRunSummary>(newmanRun),
-};