-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3317562
Showing
73 changed files
with
23,985 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Logs | ||
logs | ||
*.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules | ||
|
||
#dist folder | ||
dist | ||
|
||
# IDEA/Webstorm project files | ||
.idea | ||
*.iml | ||
|
||
#VSCode metadata | ||
.vscode | ||
|
||
# Mac files | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
instrumentation: | ||
excludes: ['*.spec.js'] | ||
extensions: ['.js'] | ||
include-all-sources: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
save-exact=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
language: node_js | ||
cache: yarn | ||
node_js: | ||
- "8" | ||
script: yarn run test:CI | ||
after_success: | ||
# Send coverage data to coveralls. | ||
- yarn run test:cover:CI |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Contributing | ||
|
||
## Quick Start | ||
|
||
Fork this project, then: | ||
|
||
```bash | ||
npm install | ||
npm start | ||
``` | ||
|
||
Submit a pull request to the master branch to request merging your change. | ||
|
||
## Branch Organization | ||
|
||
All features should be worked out of a well named feature branch. Branch off the master branch. Submit a pull request to merge your work into the master branch when your work is ready for review. | ||
|
||
## npm Scripts | ||
|
||
This project uses npm scripts for automation | ||
|
||
|Script|Description| | ||
|------|-----------| | ||
|start|Start local webserver to host the docs at localhost:3000| | ||
|test|Run tests| | ||
|
||
There are many other scripts in package.json, but these are the two you're most likely to run. | ||
|
||
## Semantic Versioning | ||
|
||
This project follows [semantic versioning](http://semver.org). We release patch versions for bugfixes, minor versions for new features, and major versions for any breaking changes. | ||
|
||
## Proposing a Change | ||
|
||
If you intend to change the public API, or make any non-trivial changes to the implementation, we recommend filing an issue. This lets us reach an agreement on your proposal before you put significant effort into it. | ||
|
||
## Style Guide | ||
|
||
ESLint will catch most styling issues that may exist in your code. You can check the status of your code styling by running npm start. | ||
|
||
However, there are still some styles that the linter cannot pick up. If you are unsure about something, looking at [Airbnb's Style Guide](https://github.com/airbnb/javascript) will guide you in the right direction. | ||
|
||
## Code Conventions | ||
|
||
- Use semicolons ; | ||
- 2 spaces for indentation (no tabs). Install the [Editorconfig](http://editorconfig.org) plugin for your editor to enforce this automatically. | ||
- Prefer ' over " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# contributors | ||
|
||
## react-slingshot | ||
|
||
--- | ||
|
||
* Atif Afzal ([atfzl](https://github.com/atfzl)) | ||
* Andrew Murray ([radarhere](https://github.com/radarhere)) | ||
* Barry Staes ([barrystaes](https://github.com/barrystaes)) | ||
* Benjamin Fleischer ([bf4](https://github.com/bf4)) | ||
* Dave Kerr ([hackerrdave](https://github.com/hackerrdave)) | ||
* demonkoryu ([demonkoryu](https://github.com/demonkoryu)) | ||
* Josh ([zone-ghost](https://github.com/zone-ghost)) | ||
* Kohei TAKATA ([kohei-takata](https://github.com/kohei-takata)) | ||
* Kyle Welch ([kwelch](https://github.com/kwelch)) | ||
* Marco Bettiolo ([bettiolo](https://github.com/bettiolo)) | ||
* Matt Wigdahl ([mlwigdahl](https://github.com/mlwigdahl)) | ||
* Nick Taylor ([nickytonline](https://github.com/nickytonline)) | ||
* ReadmeCritic ([readmecritic](https://github.com/readmecritic)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Cory House | ||
|
||
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<p align="center"> | ||
<img src="https://cloud.githubusercontent.com/assets/3129129/22811426/bb69dc06-ef0c-11e6-8092-a0bea9060b35.png"/> | ||
</p> | ||
|
||
--- | ||
|
||
[](https://travis-ci.org/coryhouse/react-slingshot) | ||
[](https://ci.appveyor.com/project/coryhouse/react-slingshot/branch/master) | ||
[](https://david-dm.org/coryhouse/react-slingshot) | ||
[](https://coveralls.io/github/coryhouse/react-slingshot?branch=master) | ||
|
||
A comprehensive starter kit for rapid application development using React. | ||
|
||
Why Slingshot? | ||
|
||
1. **One command to get started** - Type `npm start` to start development in your default browser. | ||
2. **Rapid feedback** - Each time you hit save, changes hot reload and linting and automated tests run. | ||
3. **One command line to check** - All feedback is displayed on a single command line. | ||
4. **No more JavaScript fatigue** - Slingshot uses [the most popular and powerful libraries](#technologies) for working with React. | ||
5. **Working example app** - The included example app shows how this all works together. | ||
6. **Automated production build** - Type `npm run build` to do all this: | ||
|
||
[](https://www.youtube.com/watch?v=qlfDLsX-J0U) | ||
|
||
# Get Started | ||
|
||
1. **Initial Machine Setup** | ||
|
||
First time running the starter kit? Then complete the [Initial Machine Setup](#initial-machine-setup). | ||
|
||
2. **Clone the project** | ||
|
||
`git clone https://github.com/coryhouse/react-slingshot.git`. | ||
|
||
3. **Run the setup script** | ||
|
||
`npm run setup` | ||
|
||
4. **Run the example app** | ||
|
||
`npm start -s` | ||
|
||
This will run the automated build process, start up a webserver, and open the application in your default browser. When doing development with this kit, this command will continue watching all your files. Every time you hit save the code is rebuilt, linting runs, and tests run automatically. Note: The -s flag is optional. It enables silent mode which suppresses unnecessary messages during the build. | ||
|
||
5. **Review the example app.** | ||
|
||
This starter kit includes a working example app that calculates fuel savings. Note how all source code is placed under /src. Tests are placed alongside the file under test. The final built app is placed under /dist. These are the files you run in production. | ||
|
||
6. **Delete the example app files.** | ||
|
||
Once you're comfortable with how the example app works, you can [delete those files and begin creating your own app](./docs/FAQ.md#i-just-want-an-empty-starter-kit). | ||
|
||
7. **Having issues?** See [Having Issues?](#having-issues-try-these-things-first). | ||
|
||
## Initial Machine Setup | ||
|
||
1. **Install [Node 4.0.0 or greater](https://nodejs.org)** | ||
|
||
(5.0 or greater is recommended for optimal build performance) | ||
Need to run multiple versions of Node? Use [nvm](https://github.com/creationix/nvm). | ||
|
||
2. **Install [Git](https://git-scm.com/downloads)**. | ||
|
||
3. **[Disable safe write in your editor](https://webpack.js.org/guides/development/#adjusting-your-text-editor)** to assure hot reloading works properly. | ||
|
||
4. On a Mac? You're all set. If you're on Linux or Windows, complete the steps for your OS below. | ||
|
||
### On Linux | ||
|
||
* Run this to [increase the limit](http://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc) on the number of files Linux will watch. [Here's why](https://github.com/coryhouse/react-slingshot/issues/6). | ||
|
||
`echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p`. | ||
|
||
### On Windows | ||
|
||
* **Install [Python 2.7](https://www.python.org/downloads/)**. Some node modules may rely on node-gyp, which requires Python on Windows. | ||
* **Install C++ Compiler**. Browser-sync requires a C++ compiler on Windows. | ||
|
||
[Visual Studio Express](https://www.visualstudio.com/en-US/products/visual-studio-express-vs) comes bundled with a free C++ compiler. | ||
|
||
If you already have Visual Studio installed: | ||
Open Visual Studio and go to File -> New -> Project -> Visual C++ -> Install Visual C++ Tools for Windows Desktop. | ||
The C++ compiler is used to compile browser-sync (and perhaps other Node modules). | ||
|
||
--- | ||
|
||
## Having Issues? Try these things first | ||
|
||
1. Make sure you ran all steps in [Get started](#get-started) including the [initial machine setup](#initial-machine-setup). | ||
2. Run `npm install` - If you forget to do this, you'll see this: `babel-node: command not found`. | ||
3. Install the latest version of Node. Or install [Node 5.12.0](https://nodejs.org/download/release/v5.12.0/) if you're having issues on Windows. Node 6 has issues on some Windows machines. | ||
4. Make sure files with names that begin with a dot (.editorconfig, .gitignore, .npmrc) are copied to the project directory root. This is easy to overlook if you copy this repository manually. | ||
5. Don't run the project from a symbolic link. It may cause issues with file watches. | ||
6. Delete any .eslintrc that you're storing in your user directory. Also, disable any ESLint plugin / custom rules that you've enabled within your editor. These will conflict with the ESLint rules defined in this project. | ||
7. Make sure you don't have NODE_ENV set to production on your machine. If you do then the [development dependencies won't be installed](https://github.com/coryhouse/react-slingshot/issues/400#issuecomment-290497767). Here's [how to check](http://stackoverflow.com/a/27939821/26180). | ||
8. Install watchman with `brew install watchman` if you are having the following error after an initial `npm start -s`: | ||
|
||
```bash | ||
2017-09-05 00:44 node[68587] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22) | ||
2017-09-05 00:44 node[68587] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22) | ||
events.js:160 | ||
throw er; // Unhandled 'error' event | ||
^ | ||
|
||
Error: Error watching file for changes: EMFILE | ||
at exports._errnoException (util.js:1022:11) | ||
at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11) | ||
``` | ||
|
||
9. Tip: Things to check if you get an `npm run lint` error or build error: | ||
|
||
* If ESW found an error or warning in your project (e.g. console statement or a missing semi-colon), the lint thread will exit with `Exit status 1`. To fix: | ||
|
||
1. Change the `npm run lint` script to `"esw webpack.config.* src tools; exit 0"` | ||
1. Change the `npm run lint:watch` script to `"esw webpack.config.* src tools --watch; exit 0"` | ||
|
||
> Note: Adding `exit 0` will allow the npm scripts to ignore the status 1 and allow ESW to print all warnings and errors. | ||
* Ensure the `eslint`/`esw` globally installed version matches the version used in the project. This will ensure the `esw` keyword is resolved. | ||
|
||
10. Rebuild node-sass with `npm rebuild node-sass` if you are having and error like `Node Sass does not yet support your current environment on macOS XXX` after an initial `npm start -s`. | ||
|
||
--- | ||
|
||
## Technologies | ||
|
||
Slingshot offers a rich development experience using the following technologies: | ||
|
||
| **Tech** | **Description** |**Learn More**| | ||
|----------|-------|---| | ||
| [React](https://facebook.github.io/react/) | Fast, composable client-side components. | [Pluralsight Course](https://www.pluralsight.com/courses/react-flux-building-applications) | | ||
| [Redux](http://redux.js.org) | Enforces unidirectional data flows and immutable, hot reloadable store. Supports time-travel debugging. Lean alternative to [Facebook's Flux](https://facebook.github.io/flux/docs/overview.html).| [Getting Started with Redux](https://egghead.io/courses/getting-started-with-redux), [Building React Applications with Idiomatic Redux](https://egghead.io/courses/building-react-applications-with-idiomatic-redux), [Pluralsight Course](http://www.pluralsight.com/courses/react-redux-react-router-es6)| | ||
| [React Router](https://github.com/reactjs/react-router) | A complete routing library for React | [Pluralsight Course](https://www.pluralsight.com/courses/react-flux-building-applications) | | ||
| [Babel](http://babeljs.io) | Compiles ES6 to ES5. Enjoy the new version of JavaScript today. | [ES6 REPL](https://babeljs.io/repl/), [ES6 vs ES5](http://es6-features.org), [ES6 Katas](http://es6katas.org), [Pluralsight course](https://www.pluralsight.com/courses/javascript-fundamentals-es6) | | ||
| [Webpack](https://webpack.js.org) | Bundles npm packages and our JS into a single file. Includes hot reloading via [react-transform-hmr](https://www.npmjs.com/package/react-transform-hmr). | [Quick Webpack How-to](https://github.com/petehunt/webpack-howto) [Pluralsight Course](https://www.pluralsight.com/courses/webpack-fundamentals)| | ||
| [Browsersync](https://www.browsersync.io/) | Lightweight development HTTP server that supports synchronized testing and debugging on multiple devices. | [Intro vid](https://www.youtube.com/watch?time_continue=1&v=heNWfzc7ufQ)| | ||
| [Jest](https://facebook.github.io/jest/) | Automated tests with built-in expect assertions and [Enzyme](https://github.com/airbnb/enzyme) for DOM testing without a browser using Node. | [Pluralsight Course](https://www.pluralsight.com/courses/testing-javascript) | | ||
| [TrackJS](https://trackjs.com/) | JavaScript error tracking. | [Free trial](https://my.trackjs.com/signup)| | ||
| [ESLint](http://eslint.org/)| Lint JS. Reports syntax and style issues. Using [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for additional React specific linting rules. | | | ||
| [SASS](http://sass-lang.com/) | Compiled CSS styles with variables, functions, and more. | [Pluralsight Course](https://www.pluralsight.com/courses/better-css)| | ||
| [PostCSS](https://github.com/postcss/postcss) | Transform styles with JS plugins. Used to autoprefix CSS | | ||
| [Editor Config](http://editorconfig.org) | Enforce consistent editor settings (spaces vs tabs, etc). | [IDE Plugins](http://editorconfig.org/#download) | | ||
| [npm Scripts](https://docs.npmjs.com/misc/scripts)| Glues all this together in a handy automated build. | [Pluralsight course](https://www.pluralsight.com/courses/npm-build-tool-introduction), [Why not Gulp?](https://medium.com/@housecor/why-i-left-gulp-and-grunt-for-npm-scripts-3d6853dd22b8#.vtaziro8n) | | ||
The starter kit includes a working example app that puts all of the above to use. | ||
--- | ||
## Questions? | ||
Check out the [FAQ](./docs/FAQ.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Test against this version of Node.js | ||
environment: | ||
matrix: | ||
# node.js | ||
- nodejs_version: "8" | ||
- nodejs_version: "7" | ||
- nodejs_version: "6" | ||
|
||
# Install scripts. (runs after repo cloning) | ||
install: | ||
# Get the latest stable version of Node.js or io.js | ||
- ps: Install-Product node $env:nodejs_version x64 | ||
|
||
# install modules | ||
- yarn | ||
|
||
cache: | ||
- "%LOCALAPPDATA%\\Yarn" | ||
|
||
# Post-install test scripts. | ||
test_script: | ||
# Output useful info for debugging. | ||
- node --version | ||
- npm --version | ||
# run tests | ||
- npm run test:CI | ||
|
||
# Don't actually build. | ||
build: off | ||
|
||
notifications: | ||
- provider: Email | ||
to: | ||
- [email protected] | ||
subject: 'Build failed: react-slingshot' | ||
message: The continuous integration build failed. See https://ci.appveyor.com/project/CoryHouse/react-slingshot/ for details. | ||
on_build_success: false | ||
on_build_failure: true | ||
on_build_status_changed: false |
Oops, something went wrong.