diff --git a/.eslintrc.json b/.eslintrc.json index ccb3baf..143067e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,8 +1,7 @@ { - "root": true, - "extends": "fullstack", - "rules": { - "semi": 0, - "new-cap": [1, { "capIsNewExceptions": ["Router"] }] - } + "root": true, + "extends": ["fullstack", "prettier", "prettier/react"], + "rules": { + "semi": 0 + } } diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 8c84fe5..027b7cc 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -12,4 +12,4 @@ For features, please specify at least minimal requirements, e.g.: --- -*Issue description here…* +_Issue description here…_ diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index bfd0426..d78b924 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,8 +1,8 @@ ### Assignee Tasks -- [ ] added unit tests (or none needed) -- [ ] written relevant docs (or none needed) -- [ ] referenced any relevant issues (or none exist) +* [ ] added unit tests (or none needed) +* [ ] written relevant docs (or none needed) +* [ ] referenced any relevant issues (or none exist) ### Guidelines @@ -10,4 +10,4 @@ Please add a description of this Pull Request's motivation, scope, outstanding i --- -*Your PR Notes Here* +_Your PR Notes Here_ diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..4271f6e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +public/bundle.js +public/bundle.js.map +package-lock.json +package.json diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 0000000..1fb03f0 --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1,9 @@ +# printWidth: 80 # 80 +# tabWidth: 2 # 2 +# useTabs: false # false +semi: false # true +singleQuote: true # false +# trailingComma: none # none | es5 | all +bracketSpacing: false # true +# jsxBracketSameLine: false # false +# arrowParens: avoid # avoid | always diff --git a/README.md b/README.md index bc839f9..4b58e31 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Boilermaker -*Good things come in pairs* +_Good things come in pairs_ Looking to mix up a backend with express/sequelize and a frontend with react/redux? That's `boilermaker`! @@ -35,9 +35,10 @@ Now that you've got the code, follow these steps to get acclimated: * Create two postgres databases: `boilermaker` and `boilermaker-test` (you can substitute these with the name of your own application - just be sure to go through and change the `package.json` and `.travis.yml` to refer to the new name) * By default, running `npm test` will use `boilermaker-test`, while regular development uses `boilermaker` * Create a file called `secrets.js` in the project root - * This file is `.gitignore`'d, and will *only* be required in your *development* environment + + * This file is `.gitignore`'d, and will _only_ be required in your _development_ environment * Its purpose is to attach the secret env variables that you'll use while developing - * However, it's **very** important that you **not** push it to Github! Otherwise, *prying eyes* will find your secret API keys! + * However, it's **very** important that you **not** push it to Github! Otherwise, _prying eyes_ will find your secret API keys! * It might look like this: ``` @@ -78,15 +79,19 @@ Ready to go world wide? Here's a guide to deployment! There are two (compatible) Either way, you'll need to set up your deployment server to start: ### Prep -1. Set up the [Heroku command line tools](https://devcenter.heroku.com/articles/heroku-cli) -2. `heroku login` -3. Add a git remote for heroku: - - **If you're creating a new app...** - 1. `heroku create` or `heroku create your-app-name` if you have a name in mind. - 2. `heroku addons:create heroku-postgresql:hobby-dev` to add ("provision") a postgres database to your heroku dyno - - **If you already have a Heroku app...** - 1. `heroku git:remote your-app-name` You'll need to be a collaborator on the app. +1. Set up the [Heroku command line tools](https://devcenter.heroku.com/articles/heroku-cli) +2. `heroku login` +3. Add a git remote for heroku: + +* **If you're creating a new app...** + + 1. `heroku create` or `heroku create your-app-name` if you have a name in mind. + 2. `heroku addons:create heroku-postgresql:hobby-dev` to add ("provision") a postgres database to your heroku dyno + +* **If you already have a Heroku app...** + + 1. `heroku git:remote your-app-name` You'll need to be a collaborator on the app. ### When you're ready to deploy @@ -96,14 +101,14 @@ Either way, you'll need to set up your deployment server to start: CI is not about testing per se – it's about _continuously integrating_ your changes into the live application, instead of periodically _releasing_ new versions. CI tools can not only test your code, but then automatically deploy your app. Boilermaker comes with a `.travis.yml` configuration almost ready for deployment; follow these steps to complete the job. -1. Run `git checkout master && git pull && git checkout -b f/travis-deploy` (or use some other new branch name). -2. Un-comment the bottom part of `.travis.yml` (the `before_deploy` and `deploy` sections) -3. Add your Heroku app name to `deploy.app`, where it says "YOUR HEROKU APP NAME HERE". For example, if your domain is `cool-salty-conifer.herokuapp.com`, your app name is `cool-salty-conifer`. -4. Install the Travis CLI tools by following [the instructions here](https://github.com/travis-ci/travis.rb#installation). -5. Run `travis encrypt $(heroku auth:token) --org` to encrypt your Heroku API key. _**Warning:** do not run the `--add` command suggested by Travis, that will rewrite part of our existing config!_ -6. Copy-paste your encrypted API key into the `.travis.yml` file under `deploy.api_key.secure`, where it says "YOUR ENCRYPTED API KEY HERE". -7. `git add -A && git commit -m 'travis: activate deployment' && git push -u origin f/travis-deploy` -8. Make a PR for the new branch, get it approved, and merge it into master. +1. Run `git checkout master && git pull && git checkout -b f/travis-deploy` (or use some other new branch name). +2. Un-comment the bottom part of `.travis.yml` (the `before_deploy` and `deploy` sections) +3. Add your Heroku app name to `deploy.app`, where it says "YOUR HEROKU APP NAME HERE". For example, if your domain is `cool-salty-conifer.herokuapp.com`, your app name is `cool-salty-conifer`. +4. Install the Travis CLI tools by following [the instructions here](https://github.com/travis-ci/travis.rb#installation). +5. Run `travis encrypt $(heroku auth:token)` to encrypt your Heroku API key. _**Warning:** do not run the `--add` command suggested by Travis, that will rewrite part of our existing config!_ +6. Copy-paste your encrypted API key into the `.travis.yml` file under `deploy.api_key.secure`, where it says "YOUR ENCRYPTED API KEY HERE". +7. `git add -A && git commit -m 'travis: activate deployment' && git push -u origin f/travis-deploy` +8. Make a PR for the new branch, get it approved, and merge it into master. That's it! From now on, whenever `master` is updated on GitHub, Travis will automatically push the app to Heroku for you. @@ -111,16 +116,17 @@ That's it! From now on, whenever `master` is updated on GitHub, Travis will auto Some developers may prefer to control deployment rather than rely on automation. Your local copy of the application can be pushed up to Heroku at will, using Boilermaker's handy deployment script: -1. Make sure that all your work is fully committed and pushed to your master branch on Github. -2. If you currently have an existing branch called "deploy", delete it now (`git branch -d deploy`). We're going to use a dummy branch with the name "deploy" (see below), so if you have one lying around, the script below will error -3. `npm run deploy` - this will cause the following commands to happen in order: - - `git checkout -b deploy`: checks out a new branch called "deploy". Note that the name "deploy" here isn't magical, but it needs to match the name of the branch we specify when we push to our heroku remote. - - `webpack -p`: webpack will run in "production mode" - - `git add -f public/bundle.js public/bundle.js.map`: "force" add the otherwise gitignored build files - - `git commit --allow-empty -m 'Deploying'`: create a commit, even if nothing changed - - `git push --force heroku deploy:master`: push your local "deploy" branch to the "master" branch on heroku - - `git checkout master`: return to your master branch - - `git branch -D deploy`: remove the deploy branch +1. Make sure that all your work is fully committed and pushed to your master branch on Github. +2. If you currently have an existing branch called "deploy", delete it now (`git branch -d deploy`). We're going to use a dummy branch with the name "deploy" (see below), so if you have one lying around, the script below will error +3. `npm run deploy` - this will cause the following commands to happen in order: + +* `git checkout -b deploy`: checks out a new branch called "deploy". Note that the name "deploy" here isn't magical, but it needs to match the name of the branch we specify when we push to our heroku remote. +* `webpack -p`: webpack will run in "production mode" +* `git add -f public/bundle.js public/bundle.js.map`: "force" add the otherwise gitignored build files +* `git commit --allow-empty -m 'Deploying'`: create a commit, even if nothing changed +* `git push --force heroku deploy:master`: push your local "deploy" branch to the "master" branch on heroku +* `git checkout master`: return to your master branch +* `git branch -D deploy`: remove the deploy branch Now, you should be deployed! diff --git a/client/app.js b/client/app.js index 19927b2..2dc72eb 100644 --- a/client/app.js +++ b/client/app.js @@ -3,7 +3,6 @@ import React from 'react' import {Navbar} from './components' import Routes from './routes' - const App = () => { return (
diff --git a/client/components/auth-form.js b/client/components/auth-form.js index 54da6cb..14ea510 100644 --- a/client/components/auth-form.js +++ b/client/components/auth-form.js @@ -6,18 +6,22 @@ import {auth} from '../store' /** * COMPONENT */ -const AuthForm = (props) => { +const AuthForm = props => { const {name, displayName, handleSubmit, error} = props return (
- +
- +
@@ -37,7 +41,7 @@ const AuthForm = (props) => { * function, and share the same Component. This is a good example of how we * can stay DRY with interfaces that are very similar to each other! */ -const mapLogin = (state) => { +const mapLogin = state => { return { name: 'login', displayName: 'Login', @@ -45,7 +49,7 @@ const mapLogin = (state) => { } } -const mapSignup = (state) => { +const mapSignup = state => { return { name: 'signup', displayName: 'Sign Up', @@ -53,9 +57,9 @@ const mapSignup = (state) => { } } -const mapDispatch = (dispatch) => { +const mapDispatch = dispatch => { return { - handleSubmit (evt) { + handleSubmit(evt) { evt.preventDefault() const formName = evt.target.name const email = evt.target.email.value diff --git a/client/components/navbar.js b/client/components/navbar.js index c140cbc..6e04995 100644 --- a/client/components/navbar.js +++ b/client/components/navbar.js @@ -4,7 +4,7 @@ import {connect} from 'react-redux' import {Link} from 'react-router-dom' import {logout} from '../store' -const Navbar = ({ handleClick, isLoggedIn }) => ( +const Navbar = ({handleClick, isLoggedIn}) => (

BOILERMAKER