提交 2d966e72 编写于 作者: P Pierre BURGY

Initial commit

上级
root = true
[*]
end_of_line = lf
insert_final_newline = false
indent_style = space
indent_size = 2
# From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto
#
# The above will handle all files NOT found below
#
#
## These files are text and should be normalized (Convert crlf => lf)
#
# source code
*.php text
*.css text
*.sass text
*.scss text
*.less text
*.styl text
*.js text eol=lf
*.coffee text
*.json text
*.htm text
*.html text
*.xml text
*.svg text
*.txt text
*.ini text
*.inc text
*.pl text
*.rb text
*.py text
*.scm text
*.sql text
*.sh text
*.bat text
# templates
*.ejs text
*.hbt text
*.jade text
*.haml text
*.hbs text
*.dot text
*.tmpl text
*.phtml text
# server config
.htaccess text
# git config
.gitattributes text
.gitignore text
.gitconfig text
# code analysis config
.jshintrc text
.jscsrc text
.jshintignore text
.csslintrc text
# misc config
*.yaml text
*.yml text
.editorconfig text
# build config
*.npmignore text
*.bowerrc text
# Heroku
Procfile text
.slugignore text
# Documentation
*.md text
LICENSE text
AUTHORS text
#
## These files are binary and should be left untouched
#
# (binary is a macro for -text -diff)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.zip binary
*.7z binary
*.ttf binary
*.eot binary
*.woff binary
*.pyc binary
*.pdf binary
# Contributing to react-boilerplate
Love react-boilerplate and want to help? Thanks so much, there's something to do for everybody!
Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
## Using the issue tracker
The [issue tracker](https://github.com/mxstbr/react-boilerplate/issues) is
the preferred channel for [bug reports](#bugs), [features requests](#features)
and [submitting pull requests](#pull-requests).
<a name="bugs"></a>
## Bug reports
A bug is a _demonstrable problem_ that is caused by the code in the repository.
Good bug reports are extremely helpful - thank you!
Guidelines for bug reports:
1. **Use the GitHub issue search** &mdash; check if the issue has already been reported.
2. **Check if the issue has been fixed** &mdash; try to reproduce it using the latest `master` or development branch in the repository.
3. **Isolate the problem** &mdash; ideally create a [reduced test case](https://css-tricks.com/reduced-test-cases/) and a live example.
A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and OS
experience the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
Example:
> Short and descriptive example bug report title
>
> A summary of the issue and the browser/OS environment in which it occurs. If
> suitable, include the steps required to reproduce the bug.
>
> 1. This is the first step
> 2. This is the second step
> 3. Further steps, etc.
>
> `<url>` - a link to the reduced test case
>
> Any other information you want to share that is relevant to the issue being
> reported. This might include the lines of code that you have identified as
> causing the bug, and potential solutions (and your opinions on their
> merits).
<a name="features"></a>
## Feature requests
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
<a name="pull-requests"></a>
## Pull requests
Good pull requests - patches, improvements, new features - are a fantastic
help. They should remain focused in scope and avoid containing unrelated
commits.
**Please ask first** before embarking on any significant pull request (e.g.
implementing features, refactoring code, porting to a different language),
otherwise you risk spending a lot of time working on something that the
project's developers might not want to merge into the project.
Please adhere to the coding conventions used throughout a project (indentation,
accurate comments, etc.) and any other requirements (such as test coverage).
Since the `master` branch is what people actually use in production, we have a
`dev` branch that unstable changes get merged into first. Only when we
consider that stable we merge it into the `master` branch and release the
changes for real.
Adhering to the following process is the best way to get your work
included in the project:
1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork, and configure the remotes:
```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/<your-username>/react-boilerplate.git
# Navigate to the newly cloned directory
cd react-boilerplate
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/mxstbr/react-boilerplate.git
```
2. If you cloned a while ago, get the latest changes from upstream:
```bash
git checkout dev
git pull upstream dev
```
3. Create a new topic branch (off the `dev` branch) to contain your feature, change, or fix:
```bash
git checkout -b <topic-branch-name>
```
4. Commit your changes in logical chunks. Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) or your code is unlikely be merged into the main project. Use Git's [interactive rebase](https://help.github.com/articles/about-git-rebase/) feature to tidy up your commits before making them public.
5. Locally merge (or rebase) the upstream dev branch into your topic branch:
```bash
git pull [--rebase] upstream dev
```
6. Push your topic branch up to your fork:
```bash
git push origin <topic-branch-name>
```
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
with a clear title and description.
**IMPORTANT**: By submitting a patch, you agree to allow the project
owners to license your work under the terms of the [MIT License](https://github.com/mxstbr/react-boilerplate/blob/master/LICENSE.md).
# React Boilerplate
Before opening a new issue, please take a moment to review our [**community guidelines**](https://github.com/mxstbr/react-boilerplate/blob/master/.github/CONTRIBUTING.md) to make the contribution process easy and effective for everyone involved.
Please direct redux-saga related questions to stack overflow:
http://stackoverflow.com/questions/tagged/redux-saga
For questions related to the boilerplate itself, you can also find answers on our gitter chat:
https://gitter.im/mxstbr/react-boilerplate
**Before opening a new issue, you may find an answer in already closed issues**:
https://github.com/mxstbr/react-boilerplate/issues?q=is%3Aissue+is%3Aclosed
## Issue Type
- [ ] Bug (https://github.com/mxstbr/react-boilerplate/blob/master/.github/CONTRIBUTING.md#bug-reports)
- [ ] Feature (https://github.com/mxstbr/react-boilerplate/blob/master/.github/CONTRIBUTING.md#feature-requests)
## Description
(Add images if possible)
## Steps to reproduce
(Add link to a demo on https://jsfiddle.net or similar if possible)
# Versions
- Node/NPM:
- Browser:
## React Boilerplate
Thank you for contributing! Please take a moment to review our [**contributing guidelines**](https://github.com/mxstbr/react-boilerplate/blob/master/.github/CONTRIBUTING.md)
to make the process easy and effective for everyone involved.
**Please open an issue** before embarking on any significant pull request, especially those that
add a new library or change existing tests, otherwise you risk spending a lot of time working
on something that might not end up being merged into the project.
Before opening a pull request, please ensure:
- [ ] You have followed our [**contributing guidelines**](https://github.com/mxstbr/react-boilerplate/blob/master/.github/CONTRIBUTING.md)
- [ ] Pull request has tests (we are going for 100% coverage!)
- [ ] Code is well-commented, linted and follows project conventions
- [ ] Documentation is updated (if necessary)
- [ ] Internal code generators and templates are updated (if necessary)
- [ ] Description explains the issue/use-case resolved and auto-closes related issues
Be kind to code reviewers, please try to keep pull requests as small and focused as possible :)
**IMPORTANT**: By submitting a patch, you agree to allow the project
owners to license your work under the terms of the [MIT License](https://github.com/mxstbr/react-boilerplate/blob/master/LICENSE.md).
# Don't check auto-generated stuff into git
coverage
build
node_modules
stats.json
# Cruft
.DS_Store
npm-debug.log
.idea
language: node_js
sudo: true
dist: trusty
node_js:
- "5.0"
script: npm run build
before_install:
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sudo apt-get update
- sudo apt-get install -y libappindicator1 fonts-liberation
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome*.deb
- sh -e /etc/init.d/xvfb start
notifications:
email:
on_failure: change
after_success: 'npm run coveralls'
# Contributor Code of Conduct
As contributors and maintainers of this project, and in the interest of
fostering an open and welcoming community, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating
documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
By adopting this Code of Conduct, project maintainers commit themselves to
fairly and consistently applying these principles to every aspect of managing
this project. Project maintainers who do not follow or enforce the Code of
Conduct may be permanently removed from the project team.
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project maintainer at contact@mxstbr.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. Maintainers are
obligated to maintain confidentiality with regard to the reporter of an
incident.
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.3.0, available at
[http://contributor-covenant.org/version/1/3/0/][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/3/0/
# Changelog
## RBP v3: The "JS Fatigue Antivenin" Edition
React Boilerplate (RBP) v3.0.0 is out, and it's a _complete_ rewrite! :tada:
We've focused on becoming a rock-solid foundation to start your next project
with, no matter what its scale. You get to focus on writing your app because we
focus on making that as easy as pie.
website!
## Highlights
- **Scaffolding**: Thanks to @somus, you can now run `npm run generate` in your
terminal and immediately create new components, containers, sagas, routes and
selectors! No more context switching, no more "Create new file, copy and paste
that boilerplate structure, bla bla": just `npm run generate <thing>` and go.
Oh... and starting a project got a whole lot easier too: `npm run setup`. Done.
- **Revamped architecture**: Following the incredible discussion in #27 (thanks
everybody for sharing your thoughts), we now have a weapons-grade, domain-driven
application architecture.
"Smart" containers are now isolated from stateless and/or generic components,
tests are now co-located with the code that they validate.
- **New industry-standard JS utilties** We're now making the most of...
- ImmutableJS
- reselect
- react-router-redux
- redux-saga
- **Huge CSS Improvements**
- _[CSS Modules](docs/css/css-modules.md)_: Finally, truly modular, reusable
styles!
- _Page-specific CSS_: smart Webpack configuration means that only the CSS
your components need is served
- _Standards rock:_ Nothing beats consistent styling so we beefed up the
quality checks with **[stylelint](docs/css/stylelint.md)** to help ensure
that you and your team stay on point.
- **Performance**
- _Code splitting_: splitting/chunking by route means the leanest, meanest
payload (because the fastest code is the code you don't load!)
- _PageSpeed Metrics_ are built right in with `npm run pagespeed`
- **Testing setup**: Thanks to @jbinto's herculean efforts, testing is now a
first-class citizen of this boilerplate. (the example app has _99% test coverage!_)
Karma and enzyme take care of unit testing, while ngrok tunnels your local
server for access from anywhere in the world – perfect for testing on different
devices in different locations.
- **New server setup**: Thanks to the mighty @grabbou, we now use express.js to
give users a production-ready server right out of the box. Hot reloading is
still as available as always, but adding a custom API or a non-React page to
your application is now easier than ever :smile:
- **Cleaner layout:** We've taken no prisoners with our approach to keeping your
code the star of the show: wherever possible, the new file layout keeps the
config in the background so that you can keep your focus where it needs to be.
- **Documentation**: Thanks to @oliverturner, this boilerplate has some of the best
documentation going. Not just clearly explained usage guides, but easy-to-follow
_removal_ guides for most features too. RBP is just a launchpad: don't want to
use a bundled feature? Get rid of it quickly and easily without having to dig
through the code.
- **Countless small improvements**: Everything, from linting pre-commit (thanks
@okonet!) to code splitting to cross-OS compatibility is now tested and ready
to go:
- We finally added a **[CoC](CODE_OF_CONDUCT.md)**
- Windows compatibility has improved massively
The MIT License (MIT)
Copyright (c) 2015 Maximilian Stoiber
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
<img src="https://raw.githubusercontent.com/mxstbr/react-boilerplate-brand/master/assets/banner-metal.jpg" alt="react boilerplate banner" align="center" />
<br />
<div align="center"><strong>Start your next react project in seconds</strong></div>
<div align="center">A highly scalable, offline-first foundation with the best DX and a focus on performance and best practices</div>
<br />
<div align="center">
<!-- Dependency Status -->
<a href="https://david-dm.org/mxstbr/react-boilerplate">
<img src="https://david-dm.org/mxstbr/react-boilerplate.svg" alt="Dependency Status" />
</a>
<!-- devDependency Status -->
<a href="https://david-dm.org/mxstbr/react-boilerplate#info=devDependencies">
<img src="https://david-dm.org/mxstbr/react-boilerplate/dev-status.svg" alt="devDependency Status" />
</a>
<!-- Build Status -->
<a href="https://travis-ci.org/mxstbr/react-boilerplate">
<img src="https://travis-ci.org/mxstbr/react-boilerplate.svg" alt="Build Status" />
</a>
<!-- Test Coverage -->
<a href="https://coveralls.io/r/mxstbr/react-boilerplate">
<img src="https://coveralls.io/repos/github/mxstbr/react-boilerplate/badge.svg" alt="Test Coverage" />
</a>
</div>
<div align="center">
<!-- Backers -->
<a href="#backers">
<img src="https://opencollective.com/react-boilerplate/backers/badge.svg" alt="Backers" />
</a>
<!-- Sponsors -->
<a href="#sponsors">
<img src="https://opencollective.com/react-boilerplate/sponsors/badge.svg" alt="Sponsors" />
</a>
<!-- Gitter -->
<a href="https://gitter.im/mxstbr/react-boilerplate">
<img src="https://camo.githubusercontent.com/54dc79dc7da6b76b17bc8013342da9b4266d993c/68747470733a2f2f6261646765732e6769747465722e696d2f6d78737462722f72656163742d626f696c6572706c6174652e737667" alt="Gitter Chat" />
</a>
</div>
<br />
<div align="center">
<sub>Made with ❤︎ by <a href="https://twitter.com/mxstbr">Max Stoiber</a> and <a href="https://github.com/mxstbr/react-boilerplate/graphs/contributors">contributors</a>. <i>If you're using this boilerplate, we'd love to <a href="https://github.com/mxstbr/react-boilerplate/issues/115">hear from you</a>!</i></sub>
</div>
## Features
<dl>
<dt>Quick scaffolding</dt>
<dd>Create components, containers, routes, selectors and sagas - and their tests - right from the CLI!</dd>
<dt>Instant feedback</dt>
<dd>Enjoy the best DX (Developer eXperience) and code your app at the speed of thought! Your saved changes to the CSS and JS are reflected instantaneously without refreshing the page. Preserve application state even when you update something in the underlying code!</dd>
<dt>Predictable state management</dt>
<dd>Unidirectional data flow allows for change logging and time travel debugging.</dd>
<dt>Next generation JavaScript</dt>
<dd>Use template strings, object destructuring, arrow functions, JSX syntax and more, today.</dd>
<dt>Next generation CSS</dt>
<dd>Write composable CSS that's co-located with your components for complete modularity. Unique generated class names keep the specificity low while eliminating style clashes. Ship only the styles that are on the page for the best performance.</dd>
<dt>Industry-standard routing</dt>
<dd>It's natural to want to add pages (e.g. `/about`) to your application, and routing makes this possible.</dd>
<dt>Industry-standard i18n internationalization support</dt>
<dd>Scalable apps need to support multiple languages, easily add and support multiple languages with `react-intl`.</dd>
<dt>Offline-first</dt>
<dd>The next frontier in performant web apps: availability without a network connection from the instant your users load the app.</dd>
<dt>SEO</dt>
<dd>We support SEO (document head tags management) for search engines that support indexing of JavaScript content. (eg. Google)</dd>
</dl>
But wait... there's more!
- *The best test setup:* Automatically guarantee code quality and non-breaking
changes. (Seen a react app with 99% test coverage before?)
- *Native web app:* Your app's new home? The home screen of your users' phones.
- *The fastest fonts:* Say goodbye to vacant text.
- *Stay fast*: Profile your app's performance from the comfort of your command
line!
- *Catch problems:* AppVeyor and TravisCI setups included by default, so your
tests get run automatically on Windows and Unix.
There’s also a <a href="https://vimeo.com/168648012">fantastic video</a> on how to structure your React.js apps with scalability in mind. It provides rationale for the majority of boilerplate's design decisions.
<sub><i>Keywords: React.js, Redux, Hot Reloading, ESNext, Babel, PostCSS, Autoprefixer, react-router, Offline First, ServiceWorker, CSS Modules, redux-saga, FontFaceObserver, PageSpeed Insights</i></sub>
## Quick start
1. Clone this repo using `git clone --depth=1 https://github.com/mxstbr/react-boilerplate.git`
1. Run `npm run setup` to install dependencies and clean the git repo.<br />
*At this point you can run `npm start` to see the example app at `http://localhost:3000`.*
1. Run `npm run clean` to delete the example app.