diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-08-16 05:13:07 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-08-23 06:39:03 +0800 |
commit | dd9c4b6e5d0f10bdaaae61f40bdf017e83e5f606 (patch) | |
tree | 8e711a77d49f8eac85570086d1d8eff7b1af99b9 /packages/forwarder-helper | |
parent | e915d72202f66155e74e22cf7df66d37e726f38f (diff) | |
download | dexon-sol-tools-dd9c4b6e5d0f10bdaaae61f40bdf017e83e5f606.tar.gz dexon-sol-tools-dd9c4b6e5d0f10bdaaae61f40bdf017e83e5f606.tar.zst dexon-sol-tools-dd9c4b6e5d0f10bdaaae61f40bdf017e83e5f606.zip |
Initial skeleton of forwarder-helper package
Diffstat (limited to 'packages/forwarder-helper')
-rw-r--r-- | packages/forwarder-helper/.npmignore | 8 | ||||
-rw-r--r-- | packages/forwarder-helper/CHANGELOG.json | 1 | ||||
-rw-r--r-- | packages/forwarder-helper/CHANGELOG.md | 0 | ||||
-rw-r--r-- | packages/forwarder-helper/README.md | 83 | ||||
-rw-r--r-- | packages/forwarder-helper/package.json | 78 | ||||
-rw-r--r-- | packages/forwarder-helper/src/forwarder_helper_impl.ts | 0 | ||||
-rw-r--r-- | packages/forwarder-helper/src/globals.d.ts | 6 | ||||
-rw-r--r-- | packages/forwarder-helper/src/index.ts | 0 | ||||
-rw-r--r-- | packages/forwarder-helper/src/monorepo_scripts/postpublish.ts | 8 | ||||
-rw-r--r-- | packages/forwarder-helper/src/monorepo_scripts/stage_docs.ts | 8 | ||||
-rw-r--r-- | packages/forwarder-helper/src/types.ts | 0 | ||||
-rw-r--r-- | packages/forwarder-helper/test/forwarder_helper_impl_test.ts | 12 | ||||
-rw-r--r-- | packages/forwarder-helper/test/utils/chai_setup.ts | 13 | ||||
-rw-r--r-- | packages/forwarder-helper/tsconfig.json | 7 | ||||
-rw-r--r-- | packages/forwarder-helper/tslint.json | 3 |
15 files changed, 227 insertions, 0 deletions
diff --git a/packages/forwarder-helper/.npmignore b/packages/forwarder-helper/.npmignore new file mode 100644 index 000000000..5333847e7 --- /dev/null +++ b/packages/forwarder-helper/.npmignore @@ -0,0 +1,8 @@ +.* +yarn-error.log +/src/ +/scripts/ +/schemas/ +test/ +tsconfig.json +/lib/src/monorepo_scripts/ diff --git a/packages/forwarder-helper/CHANGELOG.json b/packages/forwarder-helper/CHANGELOG.json new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/packages/forwarder-helper/CHANGELOG.json @@ -0,0 +1 @@ +[] diff --git a/packages/forwarder-helper/CHANGELOG.md b/packages/forwarder-helper/CHANGELOG.md new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/packages/forwarder-helper/CHANGELOG.md diff --git a/packages/forwarder-helper/README.md b/packages/forwarder-helper/README.md new file mode 100644 index 000000000..c74526910 --- /dev/null +++ b/packages/forwarder-helper/README.md @@ -0,0 +1,83 @@ +## @0xproject/forwarder-helper + +Provides convenience objects to help work with the Forwarder Contract + +### Read the [Documentation](https://0xproject.com/docs/forwarder-helper). + +## Installation + +```bash +yarn add @0xproject/forwarder-helper +``` + +**Import** + +```typescript +import { forwarderHelperFactory } from '@0xproject/forwarder-helper'; +``` + +or + +```javascript +var forwarderHelperFactory = require('@0xproject/forwarder-helper').forwarderHelperFactory; +``` + +If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`: + +```json +"compilerOptions": { + "typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"], +} +``` + +## Contributing + +We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository. + +Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started. + +### Install dependencies + +If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them: + +```bash +yarn config set workspaces-experimental true +``` + +Then install dependencies + +```bash +yarn install +``` + +### Build + +To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory: + +```bash +PKG=@0xproject/forwarder-helper yarn build +``` + +Or continuously rebuild on change: + +```bash +PKG=@0xproject/forwarder-helper yarn watch +``` + +### Clean + +```bash +yarn clean +``` + +### Lint + +```bash +yarn lint +``` + +### Run Tests + +```bash +yarn test +``` diff --git a/packages/forwarder-helper/package.json b/packages/forwarder-helper/package.json new file mode 100644 index 000000000..7f7b595c2 --- /dev/null +++ b/packages/forwarder-helper/package.json @@ -0,0 +1,78 @@ +{ + "name": "@0xproject/forwarder-helper", + "version": "1.0.0-rc.1", + "engines": { + "node": ">=6.12" + }, + "description": "Convenience object for working with the forwarder contract", + "main": "lib/src/index.js", + "types": "lib/src/index.d.ts", + "scripts": { + "watch_without_deps": "tsc -w", + "lint": "tslint --project .", + "test": "yarn run_mocha", + "rebuild_and_test": "run-s clean build test", + "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", + "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", + "test:circleci": "yarn test:coverage", + "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", + "clean": "shx rm -rf lib test_temp scripts", + "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", + "manual:postpublish": "yarn build; node ./scripts/postpublish.js", + "docs:stage": "node scripts/stage_docs.js", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", + "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" + }, + "config": { + "postpublish": { + "assets": [], + "docPublishConfigs": { + "extraFileIncludes": [ + "../types/src/index.ts", + "../ethereum-types/src/index.ts" + ], + "s3BucketPath": "s3://doc-jsons/forwarder-helper/", + "s3StagingBucketPath": "s3://staging-doc-jsons/forwarder-helper/" + } + } + }, + "repository": { + "type": "git", + "url": "https://github.com/0xProject/0x-monorepo.git" + }, + "author": "", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/0xProject/0x-monorepo/issues" + }, + "homepage": "https://github.com/0xProject/0x-monorepo/packages/forwarder-helper/README.md", + "dependencies": { + "@0xproject/typescript-typings": "^1.0.4", + "@types/node": "^8.0.53" + }, + "devDependencies": { + "@0xproject/monorepo-scripts": "^1.0.5", + "@0xproject/tslint-config": "^1.0.5", + "@0xproject/utils": "^1.0.5", + "@types/lodash.foreach": "^4.5.3", + "@types/lodash.values": "^4.3.3", + "@types/mocha": "^2.2.42", + "chai": "^4.0.1", + "chai-as-promised": "^7.1.0", + "chai-bignumber": "^2.0.1", + "copyfiles": "^1.2.0", + "dirty-chai": "^2.0.1", + "lodash.foreach": "^4.5.0", + "make-promises-safe": "^1.1.0", + "mocha": "^4.1.0", + "npm-run-all": "^4.1.2", + "nyc": "^11.0.1", + "shx": "^0.2.2", + "tslint": "5.11.0", + "typedoc": "0xProject/typedoc", + "typescript": "3.0.1" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts diff --git a/packages/forwarder-helper/src/globals.d.ts b/packages/forwarder-helper/src/globals.d.ts new file mode 100644 index 000000000..94e63a32d --- /dev/null +++ b/packages/forwarder-helper/src/globals.d.ts @@ -0,0 +1,6 @@ +declare module '*.json' { + const json: any; + /* tslint:disable */ + export default json; + /* tslint:enable */ +} diff --git a/packages/forwarder-helper/src/index.ts b/packages/forwarder-helper/src/index.ts new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/packages/forwarder-helper/src/index.ts diff --git a/packages/forwarder-helper/src/monorepo_scripts/postpublish.ts b/packages/forwarder-helper/src/monorepo_scripts/postpublish.ts new file mode 100644 index 000000000..dcb99d0f7 --- /dev/null +++ b/packages/forwarder-helper/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/forwarder-helper/src/monorepo_scripts/stage_docs.ts b/packages/forwarder-helper/src/monorepo_scripts/stage_docs.ts new file mode 100644 index 000000000..e732ac8eb --- /dev/null +++ b/packages/forwarder-helper/src/monorepo_scripts/stage_docs.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.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd); diff --git a/packages/forwarder-helper/src/types.ts b/packages/forwarder-helper/src/types.ts new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/packages/forwarder-helper/src/types.ts diff --git a/packages/forwarder-helper/test/forwarder_helper_impl_test.ts b/packages/forwarder-helper/test/forwarder_helper_impl_test.ts new file mode 100644 index 000000000..1d3347d48 --- /dev/null +++ b/packages/forwarder-helper/test/forwarder_helper_impl_test.ts @@ -0,0 +1,12 @@ +import * as chai from 'chai'; +import 'mocha'; + +import { chaiSetup } from './utils/chai_setup'; + +chaiSetup.configure(); +const expect = chai.expect; + +describe('ForwarderHelperImpl', () => { + describe('#getMarketBuyOrdersInfo', () => {}); + describe('#getMarketSellOrdersInfo', () => {}); +}); diff --git a/packages/forwarder-helper/test/utils/chai_setup.ts b/packages/forwarder-helper/test/utils/chai_setup.ts new file mode 100644 index 000000000..1a8733093 --- /dev/null +++ b/packages/forwarder-helper/test/utils/chai_setup.ts @@ -0,0 +1,13 @@ +import * as chai from 'chai'; +import chaiAsPromised = require('chai-as-promised'); +import ChaiBigNumber = require('chai-bignumber'); +import * as dirtyChai from 'dirty-chai'; + +export const chaiSetup = { + configure(): void { + chai.config.includeStack = true; + chai.use(ChaiBigNumber()); + chai.use(dirtyChai); + chai.use(chaiAsPromised); + }, +}; diff --git a/packages/forwarder-helper/tsconfig.json b/packages/forwarder-helper/tsconfig.json new file mode 100644 index 000000000..e35816553 --- /dev/null +++ b/packages/forwarder-helper/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/forwarder-helper/tslint.json b/packages/forwarder-helper/tslint.json new file mode 100644 index 000000000..ffaefe83a --- /dev/null +++ b/packages/forwarder-helper/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": ["@0xproject/tslint-config"] +} |