Remove example from react-docs package to react-docs-example package

This commit is contained in:
Fabio Berger 2018-03-09 10:49:57 +01:00
parent 974c0d2b95
commit e4f90996af
54 changed files with 5291 additions and 59 deletions

View File

@ -0,0 +1,4 @@
.*
yarn-error.log
/src/
tsconfig.json

View File

@ -0,0 +1,55 @@
## @0xproject/react-docs-example
An [example documentation page](http://react-docs-example.s3-website-us-east-1.amazonaws.com/) built using [react-docs](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs) rendering the [@0xproject/web3-wrapper](https://github.com/0xProject/0x-monorepo/tree/development/packages/web3-wrapper) Typescript package. This is a great starter project for hosting your own Solidity or Typescript documentation page.
## Usage
This package is intended as a boilerplate for creating and hosting your own documentation page. Copy it's contents into a new directory to get 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
```
#### Start the dev server
```bash
yarn dev
```
### Deploy Example to S3 bucket
You will need to adapt the `deploy_example` command in the `package.json` to point to an S3 bucket you've created. Make sure the bucket is publicly accessible to everyone.
You will also need to install the [aws-cli](https://github.com/aws/aws-cli) and configure it with your AWS credentials.
```bash
yarn deploy_example
```
### Build
```bash
yarn build
```
### Lint
```bash
yarn lint
```
## Contributing
We strongly encourage the community to help us make improvements. To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.

View File

@ -1,10 +1,15 @@
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as React from 'react'; import * as React from 'react';
import { Documentation } from '../../src/ts/components/documentation'; import {
import { DocsInfo } from '../../src/ts/docs_info'; constants,
import { DocAgnosticFormat, DocsInfoConfig, SupportedDocJson, TypeDocNode } from '../../src/ts/types'; DocAgnosticFormat,
import { constants } from '../../src/ts/utils/constants'; DocsInfo,
DocsInfoConfig,
Documentation,
SupportedDocJson,
TypeDocNode,
} from '@0xproject/react-docs';
import * as v0TypeDocJson from './json/0.1.12.json'; import * as v0TypeDocJson from './json/0.1.12.json';
import * as v2TypeDocJson from './json/0.2.0.json'; import * as v2TypeDocJson from './json/0.2.0.json';

View File

@ -0,0 +1,6 @@
declare module '*.json' {
const json: any;
/* tslint:disable */
export default json;
/* tslint:enable */
}

View File

@ -0,0 +1,61 @@
{
"name": "@0xproject/react-docs-example",
"version": "0.0.1",
"private": true,
"description":
"An example app using react-docs",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"lint": "tslint --project . 'example/ts/**/*.ts' 'example/ts/**/*.tsx'",
"build": "tsc",
"build:example": "NODE_ENV=production webpack",
"build:watch": "tsc -w",
"clean": "shx rm -rf lib",
"dev": "webpack-dev-server --open",
"deploy_example":
"npm run build:example; aws s3 sync ./example/public/. s3://react-docs-example --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers"
},
"author": "Fabio Berger",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
},
"homepage":
"https://github.com/0xProject/0x-monorepo/packages/react-docs-example/README.md",
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
"@0xproject/tslint-config": "^0.4.9",
"@types/material-ui": "0.18.0",
"@types/react": "^15.0.15",
"@types/react-dom": "^0.14.23",
"@types/react-tap-event-plugin": "0.0.30",
"@types/lodash": "^4.14.86",
"@types/node": "^8.0.53",
"awesome-typescript-loader": "^3.1.3",
"css-loader": "^0.28.9",
"json-loader": "^0.5.4",
"less": "^2.7.2",
"less-loader": "^2.2.3",
"raw-loader": "^0.5.1",
"source-map-loader": "^0.2.3",
"style-loader": "^0.20.2",
"shx": "^0.2.2",
"tslint": "^5.9.1",
"typescript": "2.7.1",
"webpack": "^3.11.0",
"webpack-dev-server": "^2.11.1"
},
"dependencies": {
"@0xproject/react-docs": "^0.0.1",
"basscss": "^8.0.3",
"lodash": "^4.17.4",
"material-ui": "^0.17.1",
"react": "15.6.1",
"react-dom": "15.6.1",
"react-tap-event-plugin": "^2.0.1"
}
}

View File

@ -0,0 +1,21 @@
{
"compilerOptions": {
"outDir": "./lib/",
"jsx": "react",
"baseUrl": "./",
"strictNullChecks": false,
"paths": {
"*": ["node_modules/@types/*", "*"]
},
"module": "commonjs",
"target": "es5",
"lib": ["es2017", "dom"],
"sourceMap": true,
"declaration": true,
"experimentalDecorators": true,
"noImplicitReturns": true,
"pretty": true,
"strict": true
},
"include": ["./example/ts/**/*"]
}

View File

@ -0,0 +1,8 @@
{
"extends": ["@0xproject/tslint-config"],
"rules": {
"no-object-literal-type-assertion": false,
"completed-docs": false,
"prefer-function-over-method": false
}
}

View File

@ -7,7 +7,7 @@ module.exports = {
path: path.join(__dirname, '/example/public'), path: path.join(__dirname, '/example/public'),
filename: 'bundle.js', filename: 'bundle.js',
chunkFilename: 'bundle-[name].js', chunkFilename: 'bundle-[name].js',
publicPath: '/', publicPath: '/'
}, },
devtool: 'source-map', devtool: 'source-map',
resolve: { resolve: {
@ -16,8 +16,8 @@ module.exports = {
alias: { alias: {
ts: path.join(__dirname, '/example/ts'), ts: path.join(__dirname, '/example/ts'),
less: path.join(__dirname, '/example/less'), less: path.join(__dirname, '/example/less'),
md: path.join(__dirname, '/example/md'), md: path.join(__dirname, '/example/md')
}, }
}, },
module: { module: {
rules: [ rules: [
@ -26,31 +26,31 @@ module.exports = {
loader: 'source-map-loader', loader: 'source-map-loader',
exclude: [ exclude: [
// instead of /\/node_modules\// // instead of /\/node_modules\//
path.join(process.cwd(), 'node_modules'), path.join(process.cwd(), 'node_modules')
], ]
}, },
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
loader: 'awesome-typescript-loader', loader: 'awesome-typescript-loader'
}, },
{ {
test: /\.css$/, test: /\.css$/,
loaders: ['style-loader', 'css-loader'], loaders: ['style-loader', 'css-loader']
}, },
{ {
test: /\.less$/, test: /\.less$/,
loader: 'style-loader!css-loader!less-loader', loader: 'style-loader!css-loader!less-loader',
exclude: /node_modules/, exclude: /node_modules/
}, },
{ {
test: /\.json$/, test: /\.json$/,
loader: 'json-loader', loader: 'json-loader'
}, },
{ {
test: /\.md$/, test: /\.md$/,
use: 'raw-loader', use: 'raw-loader'
}, }
], ]
}, },
devServer: { devServer: {
port: 3000, port: 3000,
@ -64,20 +64,20 @@ module.exports = {
from: /.*$/, from: /.*$/,
to: function() { to: function() {
return 'index.html'; return 'index.html';
}
}
]
}, },
}, contentBase: path.join(__dirname, '/example/public')
],
},
contentBase: path.join(__dirname, '/example/public'),
}, },
plugins: plugins:
process.env.NODE_ENV === 'production' process.env.NODE_ENV === 'production'
? [ ? [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV), NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}, }
}), })
] ]
: [], : []
}; };

File diff suppressed because it is too large Load Diff

View File

@ -3,4 +3,3 @@ yarn-error.log
/src/ /src/
/scripts/ /scripts/
tsconfig.json tsconfig.json
/example/

View File

@ -1,3 +1,5 @@
# CHANGELOG # CHANGELOG
## v0.0.1 - _March 8, 2018_ ## v0.0.2 - _TBD_
* Move example out into a separate sub-package

View File

@ -27,11 +27,11 @@ yarn add @0xproject/react-docs
## Usage ## Usage
View the [live example](http://react-docs-example.s3-website-us-east-1.amazonaws.com/) that renders the [@0xproject/web3-wrapper](https://github.com/0xProject/0x-monorepo/tree/development/packages/web3-wrapper) Typescript package. It's source code is in the [example directory](./example). View the [live example](http://react-docs-example.s3-website-us-east-1.amazonaws.com/) that renders the [@0xproject/web3-wrapper](https://github.com/0xProject/0x-monorepo/tree/development/packages/web3-wrapper) Typescript package. It's source code is in the [react-docs-example](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs-example) 0x monorepo subpackage.
This package exposes both a single `Documentation` react component that will render a docs page, as well as all of it's sub-components in case someone wants to build their own layout. This package exposes both a single `Documentation` react component that will render a docs page, as well as all of it's sub-components in case someone wants to build their own layout.
Currently this package still has some external dependencies outside of the `Documentation` component, so please start your project off by copying the `example` directory and modifying from there. Currently this package still has some external dependencies outside of the `Documentation` component, so please start your project off by copying the [react-docs-example](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs-example) directory and modifying it there. If you need changes in the [react-docs](https://github.com/0xProject/0x-monorepo/tree/development/packages/react-docs) package, fork the 0x monorepo, make the required changes and submit a PR. Until we merge it, you can have your project depend on your own custom fork.
## Future improvements ## Future improvements
@ -72,19 +72,3 @@ yarn build
```bash ```bash
yarn lint yarn lint
``` ```
### Run Example
```bash
yarn dev
```
### Deploy Example to S3 bucket
You will need to adapt the `deploy_example` command in the `package.json` to point to an S3 bucket you've created. Make sure the bucket is publicly accessible to everyone.
You will also need to install the [aws-cli](https://github.com/aws/aws-cli) and configure it with your AWS credentials.
```bash
yarn deploy_example
```

View File

@ -7,11 +7,8 @@
"scripts": { "scripts": {
"lint": "tslint --project . 'src/ts/**/*.ts' 'src/ts/**/*.tsx'", "lint": "tslint --project . 'src/ts/**/*.ts' 'src/ts/**/*.tsx'",
"build": "tsc", "build": "tsc",
"build:example": "NODE_ENV=production webpack",
"build:watch": "tsc -w", "build:watch": "tsc -w",
"clean": "shx rm -rf lib", "clean": "shx rm -rf lib"
"dev": "webpack-dev-server --open",
"deploy_example": "npm run build:example; aws s3 sync ./example/public/. s3://react-docs-example --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers"
}, },
"author": "Fabio Berger", "author": "Fabio Berger",
"license": "Apache-2.0", "license": "Apache-2.0",
@ -32,19 +29,9 @@
"@types/react-dom": "^0.14.23", "@types/react-dom": "^0.14.23",
"@types/react-scroll": "0.0.31", "@types/react-scroll": "0.0.31",
"@types/react-tap-event-plugin": "0.0.30", "@types/react-tap-event-plugin": "0.0.30",
"awesome-typescript-loader": "^3.1.3",
"css-loader": "^0.28.9",
"json-loader": "^0.5.4",
"less": "^2.7.2",
"less-loader": "^2.2.3",
"raw-loader": "^0.5.1",
"shx": "^0.2.2", "shx": "^0.2.2",
"source-map-loader": "^0.2.3",
"style-loader": "^0.20.2",
"tslint": "^5.9.1", "tslint": "^5.9.1",
"typescript": "2.7.1", "typescript": "2.7.1"
"webpack": "^3.11.0",
"webpack-dev-server": "^2.11.1"
}, },
"dependencies": { "dependencies": {
"@0xproject/react-shared": "^0.0.1", "@0xproject/react-shared": "^0.0.1",