aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFrancesco Agosti <francesco.agosti93@gmail.com>2018-10-03 08:07:23 +0800
committerGitHub <noreply@github.com>2018-10-03 08:07:23 +0800
commitbce43a0050056195acb9c4890f57526985268da9 (patch)
treee45bd26d0c602d9a1d5a820fba61d56ee67cadab /packages
parent678deccfcad5b0e9039b82b766def6b383ede786 (diff)
parent81b08c0339ba94167d4192261cc5ed42f7614019 (diff)
downloaddexon-0x-contracts-bce43a0050056195acb9c4890f57526985268da9.tar.gz
dexon-0x-contracts-bce43a0050056195acb9c4890f57526985268da9.tar.zst
dexon-0x-contracts-bce43a0050056195acb9c4890f57526985268da9.zip
Merge pull request #1109 from 0xProject/feature/instant/init
[instant] Initialize the package with dev environment and tests etc..
Diffstat (limited to 'packages')
-rw-r--r--packages/instant/.gitignore2
-rw-r--r--packages/instant/CHANGELOG.json1
-rw-r--r--packages/instant/CHANGELOG.md1
-rw-r--r--packages/instant/README.md99
-rw-r--r--packages/instant/jest.config.js10
-rw-r--r--packages/instant/package.json84
-rw-r--r--packages/instant/public/index.html20
-rw-r--r--packages/instant/src/components/zero_ex_instant.tsx5
-rw-r--r--packages/instant/src/globals.d.ts6
-rw-r--r--packages/instant/src/index.ts1
-rw-r--r--packages/instant/src/index.umd.ts10
-rw-r--r--packages/instant/test/components/zero_ex_instant.test.tsx13
-rw-r--r--packages/instant/tsconfig.json17
-rw-r--r--packages/instant/tslint.json3
-rw-r--r--packages/instant/typedoc-tsconfig.json7
-rw-r--r--packages/instant/webpack.config.js28
16 files changed, 307 insertions, 0 deletions
diff --git a/packages/instant/.gitignore b/packages/instant/.gitignore
new file mode 100644
index 000000000..e1ce60fa2
--- /dev/null
+++ b/packages/instant/.gitignore
@@ -0,0 +1,2 @@
+public/main.bundle.js
+public/main.bundle.js.map \ No newline at end of file
diff --git a/packages/instant/CHANGELOG.json b/packages/instant/CHANGELOG.json
new file mode 100644
index 000000000..fe51488c7
--- /dev/null
+++ b/packages/instant/CHANGELOG.json
@@ -0,0 +1 @@
+[]
diff --git a/packages/instant/CHANGELOG.md b/packages/instant/CHANGELOG.md
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/packages/instant/CHANGELOG.md
@@ -0,0 +1 @@
+
diff --git a/packages/instant/README.md b/packages/instant/README.md
new file mode 100644
index 000000000..25aca9d3b
--- /dev/null
+++ b/packages/instant/README.md
@@ -0,0 +1,99 @@
+## @0xproject/instant
+
+## Installation
+
+```bash
+yarn add @0xproject/instant
+```
+
+**Import**
+
+**CommonJS module**
+
+```typescript
+import { ZeroExInstant } from '@0xproject/instant';
+```
+
+or
+
+```javascript
+var ZeroExInstant = require('@0xproject/instant').ZeroExInstant;
+```
+
+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"],
+}
+```
+
+**UMD Module**
+
+The package is also available as a UMD module named `zeroExInstant`.
+
+```html
+<head>
+ <script type="text/javascript" src="[zeroExInstantUMDPath]" charset="utf-8"></script>
+</head>
+<body>
+ <div id="zeroExInstantContainer"></div>
+ <script>
+ zeroExInstant.render({
+ // Initialization options
+ }, '#zeroExInstantContainer');
+ </script>
+</body>
+```
+
+## 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/instant yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0xproject/instant yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
diff --git a/packages/instant/jest.config.js b/packages/instant/jest.config.js
new file mode 100644
index 000000000..29c365835
--- /dev/null
+++ b/packages/instant/jest.config.js
@@ -0,0 +1,10 @@
+module.exports = {
+ roots: ['<rootDir>/test'],
+ coverageDirectory: 'coverage',
+ transform: {
+ '.*.tsx?$': 'ts-jest',
+ },
+ testRegex: '(/__test__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
+ collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/index.tsx'],
+};
diff --git a/packages/instant/package.json b/packages/instant/package.json
new file mode 100644
index 000000000..365312a70
--- /dev/null
+++ b/packages/instant/package.json
@@ -0,0 +1,84 @@
+{
+ "name": "@0xproject/instant",
+ "version": "0.0.1",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "private": true,
+ "description": "0x Instant React Component",
+ "main": "lib/src/index.js",
+ "types": "lib/src/index.d.ts",
+ "scripts": {
+ "build": "yarn build:all",
+ "build:all": "run-p build:umd:prod build:commonjs",
+ "build:umd:prod": "webpack --mode production",
+ "build:commonjs": "tsc -b",
+ "build:ci": "yarn build",
+ "watch_without_deps": "tsc -w",
+ "dev": "webpack-dev-server --mode development",
+ "lint": "tslint --project .",
+ "test": "jest",
+ "test:coverage": "jest --coverage",
+ "rebuild_and_test": "run-s clean build test",
+ "test:circleci": "yarn test:coverage",
+ "clean": "shx rm -rf lib coverage scripts",
+ "manual:postpublish": "yarn build; node ./scripts/postpublish.js"
+ },
+ "config": {
+ "postpublish": {
+ "assets": [
+ "packages/instant/public/index.js",
+ "packages/instant/public/index.min.js"
+ ]
+ }
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "author": "Francesco Agosti",
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/packages/instant/README.md",
+ "dependencies": {
+ "@0xproject/connect": "^2.0.4",
+ "@0xproject/types": "^1.1.1",
+ "@0xproject/typescript-typings": "^2.0.2",
+ "@0xproject/utils": "^1.0.11",
+ "@0xproject/web3-wrapper": "^3.0.1",
+ "ethereum-types": "^1.0.8",
+ "lodash": "^4.17.10",
+ "react": "^16.5.2",
+ "react-dom": "^16.5.2"
+ },
+ "devDependencies": {
+ "@0xproject/tslint-config": "^1.0.7",
+ "@types/enzyme": "^3.1.14",
+ "@types/enzyme-adapter-react-16": "^1.0.3",
+ "@types/lodash": "^4.14.116",
+ "@types/node": "*",
+ "@types/react": "16.4.7",
+ "@types/react-dom": "^16.0.8",
+ "awesome-typescript-loader": "^5.2.1",
+ "copyfiles": "^1.2.0",
+ "enzyme": "^3.6.0",
+ "enzyme-adapter-react-16": "^1.5.0",
+ "jest": "^23.6.0",
+ "make-promises-safe": "^1.1.0",
+ "npm-run-all": "^4.1.2",
+ "nyc": "^11.0.1",
+ "shx": "^0.2.2",
+ "ts-jest": "^23.10.3",
+ "tslint": "5.11.0",
+ "typedoc": "0.12.0",
+ "typescript": "3.0.1",
+ "webpack": "^4.20.2",
+ "webpack-cli": "^3.1.1",
+ "webpack-dev-server": "^3.1.9"
+ },
+ "publishConfig": {
+ "access": "private"
+ }
+}
diff --git a/packages/instant/public/index.html b/packages/instant/public/index.html
new file mode 100644
index 000000000..45968a3c9
--- /dev/null
+++ b/packages/instant/public/index.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>0x Instant Dev Environment</title>
+ <script type="text/javascript" src="/main.bundle.js" charset="utf-8"></script>
+</head>
+
+<body>
+ <div id="zeroExInstantContainer"></div>
+ <script>
+ zeroExInstant.render({
+
+ });
+ </script>
+</body>
+
+</html> \ No newline at end of file
diff --git a/packages/instant/src/components/zero_ex_instant.tsx b/packages/instant/src/components/zero_ex_instant.tsx
new file mode 100644
index 000000000..67e1b683d
--- /dev/null
+++ b/packages/instant/src/components/zero_ex_instant.tsx
@@ -0,0 +1,5 @@
+import * as React from 'react';
+
+export interface ZeroExInstantProps {}
+
+export const ZeroExInstant: React.StatelessComponent<ZeroExInstantProps> = () => <div>ZeroExInstant</div>;
diff --git a/packages/instant/src/globals.d.ts b/packages/instant/src/globals.d.ts
new file mode 100644
index 000000000..94e63a32d
--- /dev/null
+++ b/packages/instant/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/instant/src/index.ts b/packages/instant/src/index.ts
new file mode 100644
index 000000000..54059cdad
--- /dev/null
+++ b/packages/instant/src/index.ts
@@ -0,0 +1 @@
+export { ZeroExInstant, ZeroExInstantProps } from './components/zero_ex_instant';
diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts
new file mode 100644
index 000000000..d4eca177d
--- /dev/null
+++ b/packages/instant/src/index.umd.ts
@@ -0,0 +1,10 @@
+import * as React from 'react';
+import * as ReactDOM from 'react-dom';
+
+import { ZeroExInstant } from './index';
+
+export interface ZeroExInstantOptions {}
+
+export const render = (props: ZeroExInstantOptions, selector: string = '#zeroExInstantContainer') => {
+ ReactDOM.render(React.createElement(ZeroExInstant, props), document.querySelector(selector));
+};
diff --git a/packages/instant/test/components/zero_ex_instant.test.tsx b/packages/instant/test/components/zero_ex_instant.test.tsx
new file mode 100644
index 000000000..5858732cf
--- /dev/null
+++ b/packages/instant/test/components/zero_ex_instant.test.tsx
@@ -0,0 +1,13 @@
+import { configure, shallow } from 'enzyme';
+import * as Adapter from 'enzyme-adapter-react-16';
+import * as React from 'react';
+
+configure({ adapter: new Adapter() });
+
+import { ZeroExInstant } from '../../src';
+
+describe('<ZeroExInstant />', () => {
+ it('shallow renders without crashing', () => {
+ shallow(<ZeroExInstant />);
+ });
+});
diff --git a/packages/instant/tsconfig.json b/packages/instant/tsconfig.json
new file mode 100644
index 000000000..28a6190b8
--- /dev/null
+++ b/packages/instant/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "jsx": "react",
+ "allowSyntheticDefaultImports": true,
+ "noImplicitAny": true,
+ "module": "ESNext",
+ "moduleResolution": "node",
+ "lib": ["es2015", "dom"],
+ "target": "es5",
+ "sourceMap": true
+ },
+ "include": ["./src/**/*", "./test/**/*"],
+ "exclude": ["./src/index.umd.ts"]
+}
diff --git a/packages/instant/tslint.json b/packages/instant/tslint.json
new file mode 100644
index 000000000..ffaefe83a
--- /dev/null
+++ b/packages/instant/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": ["@0xproject/tslint-config"]
+}
diff --git a/packages/instant/typedoc-tsconfig.json b/packages/instant/typedoc-tsconfig.json
new file mode 100644
index 000000000..c9b0af1ae
--- /dev/null
+++ b/packages/instant/typedoc-tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "extends": "../../typedoc-tsconfig",
+ "compilerOptions": {
+ "outDir": "lib"
+ },
+ "include": ["./src/**/*", "./test/**/*"]
+}
diff --git a/packages/instant/webpack.config.js b/packages/instant/webpack.config.js
new file mode 100644
index 000000000..78a33ce90
--- /dev/null
+++ b/packages/instant/webpack.config.js
@@ -0,0 +1,28 @@
+const path = require('path');
+// The common js bundle (not this one) is built using tsc.
+// The umd bundle (this one) has a different entrypoint.
+module.exports = {
+ entry: './src/index.umd.ts',
+ output: {
+ filename: '[name].bundle.js',
+ path: path.resolve(__dirname, 'public'),
+ library: 'zeroExInstant',
+ libraryTarget: 'umd',
+ },
+ devtool: 'source-map',
+ resolve: {
+ extensions: ['.js', '.json', '.ts', '.tsx'],
+ },
+ module: {
+ rules: [
+ {
+ test: /\.(ts|tsx)$/,
+ loader: 'awesome-typescript-loader',
+ },
+ ],
+ },
+ devServer: {
+ contentBase: path.join(__dirname, 'public'),
+ port: 5000,
+ },
+};