Rename 'examples' to 'docs/storybook'

Also changes several npm script names
This commit is contained in:
Nicolas Gallagher
2017-05-25 22:19:22 -07:00
parent a84ecefa5d
commit a388ef3e26
30 changed files with 61 additions and 48 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,2 @@
node_modules
dist
dist-examples

View File

@@ -6,7 +6,7 @@ Before opening an issue, please search the [issue
tracker](https://github.com/necolas/react-native-web/issues) to make sure your
issue hasn't already been reported.
## Development
## Getting started
Visit the [Issue tracker](https://github.com/necolas/react-native-web/issues)
to find a list of open issues that need attention.
@@ -23,51 +23,63 @@ Install dependencies (requires [yarn](https://yarnpkg.com/en/docs/install):
yarn
```
Run the examples:
## Unit tests
To run the unit tests:
```
npm run examples
npm test
```
Run the benchmarks in a browser by opening `./performance/index.html` after running:
```
npm run build:performance
```
### Building
```
npm run build
```
To create a UMD build:
```
npm run build:umd
```
### Testing and Linting
To run the tests:
```
npm run test
```
To continuously watch and run tests, run the following:
…in watch mode:
```
npm run test:watch
```
Before create a commit run:
## Visual tests
Run the interactive storybook:
```
npm run docs:start
```
Run generate a static build of the storybook:
```
npm run docs:build
```
Run the performance benchmarks in a browser (opening `./performance/index.html`):
```
npm run benchmarks
```
## Compile and build
Compile the source code to `dist`:
```
npm run compile
```
To create a UMD bundle of the library:
```
npm run build
```
### Pre-commit
Before creating a commit run:
```
npm run precommit
```
To format or lint the entire project:
To format and lint the entire project:
```
npm run fmt
@@ -88,8 +100,10 @@ that we won't want to accept.
* Make sure all tests pass and there are no linting errors.
* Submit a pull request, referencing any issues it addresses.
Please try to keep your pull request focused in scope and avoid including unrelated commits.
Please try to keep your pull request focused in scope and avoid including
unrelated commits.
After you have submitted your pull request, we'll try to get back to you as soon as possible. We may suggest some changes or improvements.
After you have submitted your pull request, we'll try to get back to you as
soon as possible. We may suggest some changes or improvements.
Thank you for contributing!

View File

@@ -27,7 +27,7 @@ module.exports = {
],
resolve: {
alias: {
'react-native': path.join(__dirname, '../../src/module')
'react-native': path.join(__dirname, '../../../src/module')
}
}
};

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 850 B

After

Width:  |  Height:  |  Size: 850 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,3 +1,5 @@
/* eslint-disable react/jsx-no-bind */
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
@@ -14,12 +16,10 @@
* @providesModule TicTacToeApp
* @flow
*/
'use strict';
import createReactClass from 'create-react-class';
const React = require('react');
const ReactNative = require('react-native');
const { AppRegistry, StyleSheet, Text, TouchableHighlight, View } = ReactNative;
import React from 'react';
import { AppRegistry, StyleSheet, Text, TouchableHighlight, View } from 'react-native';
class Board {
grid: Array<Array<number>>;

View File

@@ -10,18 +10,18 @@
],
"scripts": {
"benchmarks": "cd benchmarks && yarn && webpack && open index.html",
"build": "del ./dist && mkdir dist && babel src -d dist --ignore **/__tests__",
"build:examples": "build-storybook -o dist-examples -c ./examples/.storybook",
"build:umd": "webpack --config webpack.config.js --sort-assets-by --progress",
"deploy:examples": "git checkout gh-pages && rm -rf ./storybook && mv dist-examples storybook && git add -A && git commit -m \"Storybook deploy\" && git push origin gh-pages && git checkout -",
"examples": "start-storybook -p 9001 -c ./examples/.storybook --dont-track",
"build": "webpack --config webpack.config.js --sort-assets-by --progress",
"compile": "del ./dist && mkdir dist && babel src -d dist --ignore **/__tests__",
"docs:build": "build-storybook -o ./docs/dist -c ./docs/storybook/.storybook",
"docs:start": "start-storybook -p 9001 -c ./docs/storybook/.storybook --dont-track",
"docs:publish": "git checkout gh-pages && rm -rf ./storybook && mv docs/dist storybook && git add -A && git commit -m \"Storybook deploy\" && git push origin gh-pages && git checkout -",
"flow": "flow",
"fmt": "find benchmarks examples src -name '*.js' | grep -v -E '(node_modules|dist)' | xargs npm run fmt:cmd",
"fmt": "find benchmarks docs src -name '*.js' | grep -v -E '(node_modules|dist)' | xargs npm run fmt:cmd",
"fmt:cmd": "prettier --print-width=100 --single-quote --write",
"lint": "npm run lint:cmd -- benchmarks examples src",
"lint": "npm run lint:cmd -- benchmarks docs src",
"lint:cmd": "eslint --fix --ignore-path .gitignore",
"precommit": "lint-staged",
"release": "npm run build && npm run build:umd && npm publish",
"release": "npm run compile && npm run build && npm publish",
"test": "jest",
"test:watch": "npm run test -- --watch"
},