diff options
author | Fabio Berger <me@fabioberger.com> | 2018-05-16 22:18:47 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-05-16 22:18:47 +0800 |
commit | 78623ae3bdba39b629a22aa2d15d8aee5e6225ab (patch) | |
tree | f44871dc1b081669c83cf041cebe559ecb57bace /packages/sra-report | |
parent | 136c6d01b3f01e6db8aab01c4b4b7315abadba24 (diff) | |
parent | 4de6221825447e77d7b1ee6bab28ce3407939301 (diff) | |
download | dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.gz dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.bz2 dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.lz dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.xz dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.tar.zst dexon-sol-tools-78623ae3bdba39b629a22aa2d15d8aee5e6225ab.zip |
Merge branch 'development' into v2-prototype
* development: (29 commits)
Do not remove artifacts when running `clean`
fix style errors
Fix circular dependency
Add my profile image to images
Add myself to about page
Add dogfood configs to website
Revert to lerna:run lint
Do lint sequentially
Exclude monorepo-scripts from tslint as test
Fix prettier
Add hover state to top tokens
Change to weekly txn volume
Change minimum Node version to 6.12
Document Node.js version requirement and add it to package.json
Apply prettier to some files which were not formatted correctly
Fix TSLint issues
Fix TSLint issues
Update ethereeumjs-testrpc to ganache-cli
Fix infinite loop
Add changelog entries for packages where executable binary exporting fixed
...
# Conflicts:
# packages/contracts/package.json
# packages/contracts/util/formatters.ts
# packages/contracts/util/signed_order_utils.ts
# packages/migrations/package.json
# yarn.lock
Diffstat (limited to 'packages/sra-report')
-rw-r--r-- | packages/sra-report/CHANGELOG.json | 9 | ||||
-rw-r--r-- | packages/sra-report/README.md | 18 | ||||
-rwxr-xr-x | packages/sra-report/bin/sra-report.js | 2 | ||||
-rw-r--r-- | packages/sra-report/package.json | 7 | ||||
-rw-r--r-- | packages/sra-report/src/postman_environment_factory.ts | 31 | ||||
-rw-r--r-- | packages/sra-report/test/test_runner.ts | 13 |
6 files changed, 51 insertions, 29 deletions
diff --git a/packages/sra-report/CHANGELOG.json b/packages/sra-report/CHANGELOG.json index 22aa8ce16..90a807c85 100644 --- a/packages/sra-report/CHANGELOG.json +++ b/packages/sra-report/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "version": "0.1.0", + "changes": [ + { + "note": "Properly export the executable binary", + "pr": 588 + } + ] + }, + { "timestamp": 1525477860, "version": "0.0.14", "changes": [ diff --git a/packages/sra-report/README.md b/packages/sra-report/README.md index 806ac3bf4..d8df36a29 100644 --- a/packages/sra-report/README.md +++ b/packages/sra-report/README.md @@ -107,28 +107,16 @@ yarn install ### Build -If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory: +To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory: ```bash -yarn lerna:rebuild +PKG=@0xproject/sra-report yarn build ``` Or continuously rebuild on change: ```bash -yarn dev -``` - -You can also build this specific package by running the following from within its directory: - -```bash -yarn build -``` - -or continuously rebuild on change: - -```bash -yarn build:watch +PKG=@0xproject/sra-report yarn watch ``` ### Clean diff --git a/packages/sra-report/bin/sra-report.js b/packages/sra-report/bin/sra-report.js new file mode 100755 index 000000000..8d6bdccf8 --- /dev/null +++ b/packages/sra-report/bin/sra-report.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('../lib/src/index.js') diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index 1fc0d3ade..5d2245cc1 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -1,11 +1,14 @@ { "name": "@0xproject/sra-report", "version": "0.0.14", + "engines": { + "node" : ">=6.12" + }, "description": "Generate reports for standard relayer API compliance", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "build:watch": "tsc -w", + "watch": "tsc -w", "clean": "shx rm -rf lib scripts", "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "lint": "tslint --project .", @@ -16,7 +19,7 @@ "manual:postpublish": "yarn build; node ./scripts/postpublish.js" }, "bin": { - "sra-report": "lib/src/index.js" + "sra-report": "bin/sra-report.js" }, "repository": { "type": "git", diff --git a/packages/sra-report/src/postman_environment_factory.ts b/packages/sra-report/src/postman_environment_factory.ts index 530cacb07..42389aea2 100644 --- a/packages/sra-report/src/postman_environment_factory.ts +++ b/packages/sra-report/src/postman_environment_factory.ts @@ -12,8 +12,22 @@ import { addresses as ropstenAddresses } from './contract_addresses/ropsten_addr const ENVIRONMENT_NAME = 'SRA Report'; -interface EnvironmentValue { +export interface EnvironmentValue { key: string; + value: string; + enabled: true; + type: 'text'; +} + +export interface Environment { + name: string; + values: EnvironmentValue[]; +} + +export interface Addresses { + WETH: string; + ZRX: string; + EXCHANGE: string; } export const postmanEnvironmentFactory = { @@ -25,7 +39,7 @@ export const postmanEnvironmentFactory = { * - Contract addresses based on the network id for making specific queries (ex. baseTokenAddress=ZRX_address) * - Order properties for making specific queries (ex. maker=orderMaker) */ - async createPostmanEnvironmentAsync(url: string, networkId: number) { + async createPostmanEnvironmentAsync(url: string, networkId: number): Promise<Environment> { const orderEnvironmentValues = await createOrderEnvironmentValuesAsync(url); const allEnvironmentValues = _.concat( createSchemaEnvironmentValues(), @@ -40,7 +54,7 @@ export const postmanEnvironmentFactory = { return environment; }, }; -function createSchemaEnvironmentValues() { +function createSchemaEnvironmentValues(): EnvironmentValue[] { const schemas: Schema[] = _.values(schemasByName); const schemaEnvironmentValues = _.compact( _.map(schemas, (schema: Schema) => { @@ -60,7 +74,7 @@ function createSchemaEnvironmentValues() { const result = _.concat(schemaEnvironmentValues, createEnvironmentValue('schemaKeys', JSON.stringify(schemaKeys))); return result; } -function createContractAddressEnvironmentValues(networkId: number) { +function createContractAddressEnvironmentValues(networkId: number): EnvironmentValue[] { const contractAddresses = getContractAddresses(networkId); return [ createEnvironmentValue('tokenContractAddress1', contractAddresses.WETH), @@ -68,7 +82,7 @@ function createContractAddressEnvironmentValues(networkId: number) { createEnvironmentValue('exchangeContractAddress', contractAddresses.EXCHANGE), ]; } -async function createOrderEnvironmentValuesAsync(url: string) { +async function createOrderEnvironmentValuesAsync(url: string): Promise<EnvironmentValue[]> { const httpClient = new HttpClient(url); const orders = await httpClient.getOrdersAsync(); const orderIfExists = _.head(orders); @@ -91,7 +105,7 @@ async function createOrderEnvironmentValuesAsync(url: string) { ]; } } -function getContractAddresses(networkId: number) { +function getContractAddresses(networkId: number): Addresses { switch (networkId) { case 1: return mainnetAddresses; @@ -105,7 +119,7 @@ function getContractAddresses(networkId: number) { throw new Error('Unsupported network id'); } } -function convertSchemaIdToKey(schemaId: string) { +function convertSchemaIdToKey(schemaId: string): string { let result = schemaId; if (_.startsWith(result, '/')) { result = result.substr(1); @@ -113,7 +127,8 @@ function convertSchemaIdToKey(schemaId: string) { result = `${result}Schema`; return result; } -function createEnvironmentValue(key: string, value: string) { + +function createEnvironmentValue(key: string, value: string): EnvironmentValue { return { key, value, diff --git a/packages/sra-report/test/test_runner.ts b/packages/sra-report/test/test_runner.ts index bf9b923e7..91ef6aa4e 100644 --- a/packages/sra-report/test/test_runner.ts +++ b/packages/sra-report/test/test_runner.ts @@ -3,7 +3,12 @@ import * as chaiAsPromised from 'chai-as-promised'; import * as dirtyChai from 'dirty-chai'; import * as _ from 'lodash'; import 'mocha'; -import { NewmanRunExecution, NewmanRunExecutionAssertion, NewmanRunSummary } from 'newman'; +import { + NewmanRunExecution, + NewmanRunExecutionAssertion, + NewmanRunExecutionAssertionError, + NewmanRunSummary, +} from 'newman'; import * as nock from 'nock'; import * as sraReportCollectionJSON from '../../postman_collections/sra_report.postman_collection.json'; @@ -33,7 +38,7 @@ export const testRunner = { nockInterceptor: nock.Interceptor, postmanCollectionFolderName: string, postmanCollectionRequestName: string, - ) { + ): void { const newmanRunOptions = { ...baseNewmanRunOptions, folder: postmanCollectionFolderName, @@ -87,7 +92,7 @@ export const testRunner = { postmanCollectionRequestName: string, malformedJson: object, correctJson: object, - ) { + ): void { const newmanRunOptions = { ...baseNewmanRunOptions, folder: postmanCollectionFolderName, @@ -116,7 +121,7 @@ function findAssertionErrorIfExists( summary: NewmanRunSummary, postmanCollectionRequestName: string, postmanCollectionAssertionName: string, -) { +): NewmanRunExecutionAssertionError | undefined { const matchingExecutionIfExists = _.find(summary.run.executions, (execution: NewmanRunExecution) => { return execution.item.name === postmanCollectionRequestName; }); |