Skip to content

Commit

Permalink
Revert "update for 2020"
Browse files Browse the repository at this point in the history
  • Loading branch information
gumbelino authored Jul 31, 2019
1 parent 916d097 commit a25ae64
Show file tree
Hide file tree
Showing 347 changed files with 21,551 additions and 8 deletions.
30 changes: 30 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"presets": [
[ "env", { "modules": false } ],
"es2015",
"react",
"stage-0"
],
"plugins": [
"react-hot-loader/babel",
[
"transform-runtime", {
"helpers": false,
"polyfill": false,
"regenerator": true,
"moduleName": "babel-runtime"
}
]
],
"env": {
"production": {
"presets": [
[ "env", { "modules": false } ],
"es2015",
"react-optimize",
"react",
"stage-0"
]
}
}
}
26 changes: 26 additions & 0 deletions .ebextensions/yarn.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
commands:

01_node_get:
# run this command from /tmp directory
cwd: /tmp
# flag -y for no-interaction installation
command: 'sudo curl --silent --location https://rpm.nodesource.com/setup_7.x | sudo bash -'

02_node_install:
# run this command from /tmp directory
cwd: /tmp
command: 'sudo yum -y install nodejs'

03_yarn_get:
# run this command from /tmp directory
cwd: /tmp
# don't run the command if yarn is already installed (file /usr/bin/yarn exists)
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
command: 'sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo'


04_yarn_install:
# run this command from /tmp directory
cwd: /tmp
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
command: 'sudo yum -y install yarn'
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
index.js
*.spec.js
webpack.config.dev.js
webpack.config.prod.js
webpack.config.server.js
webpack.config.babel.js
35 changes: 35 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"extends": [
"airbnb"
],
"parser": "babel-eslint",
"plugins": [
"compat"
],
"env": {
"browser": true,
"node": true
},
"ecmaFeatures": {
"jsx": true,
"es6": true,
"classes": true
},
"rules": {
"comma-dangle": [1, "always-multiline"],
"no-underscore-dangle" : 0,
"max-len": [1, 180, 4],
"arrow-body-style": [0],
"react/jsx-no-bind": [0],
"react/no-did-mount-set-state": [0],
"import/extensions": [0],
"import/no-extraneous-dependencies": [0],
"import/no-unresolved": [0], // Until import plugin supports webpack 2 resolveModules
"compat/compat": 2
},
"settings": {
"polyfills": [
"fetch"
]
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.mp4 filter=lfs diff=lfs merge=lfs -text
78 changes: 78 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# OSX
.DS_Store

# Logs
logs
*.log
.idea
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# Build directories/files
public/humans.txt
client-dist/
server-dist/

# webpack-bundle-analyzer output
bundle-report/

# Secret deploy scripts
ecosystem.config.js

# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
47 changes: 47 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
language: node_js
node_js:
- 7.6.0
script:
- yarn test
- if [ "$TRAVIS_BRANCH" == 'master' ]; then yarn build:all; else yarn build:staging; fi
after_success:
- echo "Build successful; Ready to deploy"
notifications:
email: false
slack:
secure: BFtW2prVs8d8O0jb/HVrzfNAy1i9J/TvmY37wZFvnRO4mfH9zlTAL+EQYu9WwmGsj/+p7bU5VexvaLsF/c4QB2WbyhNi0vbzP5h65Kkm+QoW1CUi54y4EzSWDwdv99jPUw8FGvs0t1dunkdFBabKcXV+2yg6o33cZagF7r+RNX+iGadmVjNJlEfoRxMcukhByWK3TvZ/r5AVM0UoDZa2NTx2vF5yUm20+9BisWnuARiHMsQdh3L+qYGoISLUpOSwzJ1BzWqfeujHnAfR68KsOJQO5M/nJNc4H6Eq3zqSl/CbL2GWLy3npCFr8HwwmiCm7dft5WOXa4yLjbXegleqhH8rlOCFcM6G//01GtJznNRKoeP8sG+UedGY0iLrLAu/WZby+kisR62undKs0gpJl4WRmEKKdmPjh843tDfztU88KcCkprF4MWsQnUHuXg8BRr18ffdjwqWCemF1cniSXMnd4/vpr5SRS2dBkRjXUbxI9tXz2c2nRdSd0fG4/jCz1YErnln2JzWvlCK0H3LHF1Ti9woEeVULWDOvVQ5GP9n90gd1wl5PMz6Y1Dearxaag0cPN133UezMYumemdEWsI+uuEwwAheEPUZ5wR4U39vLndv31w65AFFQabMIHoFpq46gqlm/6oU4ba0MTc+xsCo5bh/8WyccCN4z8yU5rMU=
before_deploy:
- git config user.email "[email protected]"
- git config user.name "Travis CI"
- git add --force server-dist client-dist # To make sure our built files get deployed
- git commit -m "BUILD - Add built files"
deploy:
- provider: elasticbeanstalk
access_key_id:
secure: ODw/WlfOSuSnT2PLDp8QfNRxY3d5r2sIji+UAD1ktmulbpteJ/oNJVONLd1ixqNwMsiCRTHS8/rFw4ERwmy9ysmy+CSRXg6g0564muk5HVh2lqTH7L6NHnzLyVb6RH2KBRnKgczuJT67vZ+vCmFA36dYhdjQTYQEvTBoQIpncV39Zc1UdLePZgX7x7WsrcDFwdLAjCiL1f2VHCJEWTh21Dg3WoZa9nljb0cix/R0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UJ9+G1+MQmREtNt48yeLgJZW772Lqwhr6jb1ZoJkFNKvpSG7LPJFhqKsd7OdGA3hZtGCM39099w=
region: us-west-2
app: d4sd-frontend
env: d4sd-fe-staging
bucket_name: elasticbeanstalk-us-west-2-709500077301
bucket_path: d4sd-frontend/staging
skip_cleanup: true
on:
branch: dev
repo: creativecolab/civicchallenge-frontend
- provider: elasticbeanstalk
access_key_id:
secure: ODw/WlfOSuSnT2PLDp8QfNRxY3d5r2sIji+UAD1ktmulbpteJ/oNJVONLd1ixqNwMsiCRTHS8/rFw4ERwmy9ysmy+CSRXg6g0564muk5HVh2lqTH7L6NHnzLyVb6RH2KBRnKgczuJT67vZ+vCmFA36dYhdjQTYQEvTBoQIpncV39Zc1UdLePZgX7x7WsrcDFwdLAjCiL1f2VHCJEWTh21Dg3WoZa9nljb0cix/R0AXn1wVFtE1VxP70oLYoH4Va4ghz+KBzukL+IWMgfZOuT4JVmNdjK/3c7/ezGDkt0XtFCOXmaIZv97e5SivC/VpyywawAYHrT88U1bZTeARDX8e4VJ1Wa1rJbFpiF4Yylzwzn0cWLrj6HY8PzIeaGHoMGz7K5EaXClMYhgvU9rBCKhnGN1twASKspivdtxX717gOk1kO62zWoCYweao2mYvpGSpPwDa2aWmcYmFjimhFOe/iT1OnVgu88O9Bxg/iAq4Mfs7IqQsqCYPnmB5A0uhI/Jzbh0N7G8O94W24jJ4JUnkYzkYAmQBipgBhf2E/OAhCFwO4dLrCorO6rCnvbiw6rv1Dv+fqt3hw4zLJn9zPiz/tMehQhNl0dbv8zycXIAWwVZdsJ/eNeV0NvgR08kK0GXeDs/OwvgnyEhsKKR7bmPutf5LtNB6PaaDxbqIpN9dY=
secret_access_key:
secure: Ja71DfX2C7Zb/cqMX7Dq5KILeiHUC9U4tH3Hr2xuIXulhkkVC9Ib5IJUiYS9vppX+xEugNTKBCq4p52qg79z9ukD5GnufK88Etvlb7QtAPrtqWQlaBl9J1EuXahQcKJuixFThUJlmj2HcotcLAIk7Sk6Vlp7gP3eZR8DWa7VSZXLOfqn/u3O87Qv0VfmdKR7O+CWjcyNOQsXAcNWfEGQhT2YrSEtzwjKMDjJuhofnz6FMj0wwc7BZ+mP86KA5hfy3DjPNU4Ue47TEILy6KJxy2RPvnLvNhCSYBoapfA93tXamQbjlxWI5DcQklrjAjU3Blyb19ffwd8MwGCnC8ZmwFmG5AUzf9xkMHqnT5QuC9gEFlw0pDB+IgLq9M0sqyBQv4fBJWIBFbsygh2rrHY0nj3NOTS8VDDkpk4O/+9h/4NRb72/oI6WHVOyb19HE4/kmb8grEgMbS3kuVg9zF42sAso1kvvEmOtDySrw3UGJpX34DEELwJlPjSyvbXltmxYGYQRb308Ahyf8kCN6NJqP9PhvcZ8knSr8Trb74zgsyGkj83hQz/nGRD4Hb6CHT0hUqTjspEQzCBb/j4ED15psnvV4srDCgH+UJ9+G1+MQmREtNt48yeLgJZW772Lqwhr6jb1ZoJkFNKvpSG7LPJFhqKsd7OdGA3hZtGCM39099w=
region: us-west-2
app: d4sd-frontend
env: d4sd-fe-production
bucket_name: elasticbeanstalk-us-west-2-709500077301
bucket_path: d4sd-frontend/production
skip_cleanup: true
on:
branch: master
repo: creativecolab/civicchallenge-frontend

7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright (c) 2017 David Luu (https://github.com/davidcluu)

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.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: yarn start:stage
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Frontend for D4SD

> Currently hosted at https://d4sd.org/
[![Build Status](https://travis-ci.org/davidcluu/civicchallenge-frontend.svg?branch=master)](https://travis-ci.org/davidcluu/civicchallenge-frontend) [![dependencies Status](https://david-dm.org/davidcluu/civicchallenge-frontend/status.svg)](https://david-dm.org/davidcluu/civicchallenge-frontend) [![devDependencies Status](https://david-dm.org/davidcluu/civicchallenge-frontend/dev-status.svg)](https://david-dm.org/davidcluu/civicchallenge-frontend?type=dev) [![CodeClimate GPA](https://codeclimate.com/github/davidcluu/civicchallenge-frontend/badges/gpa.svg)](https://codeclimate.com/github/davidcluu/civicchallenge-frontend)

<!--
[![Node.js v7.8.0](https://img.shields.io/badge/Node.js-7.8.0-green.svg)](https://nodejs.org) [![Express v4.15.2](https://img.shields.io/badge/Express-4.15.2-lightgrey.svg)](https://expressjs.com/) [![React v15.5.4](https://img.shields.io/badge/React-15.5.4-blue.svg)](https://facebook.github.io/react/)
-->

## Overview

- Frontend: React w/ Server Side Rendering + Redux + CSS (SCSS)
- Backend: Node.js + Express
- Lint Tools: ESLint (Airbnb Config)
- Build Tools: Webpack + Babel (Stage 0 + React + ES2015 Presets)
- Test Tools: AVA (Unit Testing), **[TODO]** Nightwatch.js (Browser Testing)
- Deployment Tools: pm2

## Requirements

- Node.js [v7.6.0]
- Yarn [1.3.2]

#### Installing Node.js

Visit [the Node.js website](https://nodejs.org/) and follow the instructions to download/install. The Node.js installation comes with npm.

Using [nvm](https://github.com/creationix/nvm) is recommended to manage Node.js versions.

#### Installing Yarn

Visit [the Yarn website](https://yarnpkg.com/) and follow the instructions to download/install.

#### Installing npm packages

In the root directory of the project, run this command:

`yarn` (short for `yarn install`)

## Development Mode

In the root directory of the project, run this command:

`yarn dev` (short for `yarn run dev`)

Development mode currently has these features:
- Hot module reloading
- Source mapping for CSS/JS files

## Linting Info

This project uses [ESLint](http://eslint.org/) with the full [Airbnb config](https://github.com/airbnb/javascript). Linting should work out of the box if the npm modules are installed.

In development mode, lint errors will result in an overlay on the browser window with the errors displayed and lint warnings will result in a warning message on the browser console. Both errors and warnings will be displayed on the terminal window.

To manually run ESLint on all client/server code, run this command:

`yarn lint` (short for `yarn run lint`)

## Build Info

To build the production version of the project, run this command:

`yarn build:all` (short for `yarn run build:all`)

**NOTE:** client-sessions will throw an error in production mode [if the connection is not secure](/server/server.jsx#L81). For local build testing, use this command:

`yarn build:all:stage` (short for `yarn run build:all:stage`)

## Test Info

A barebones testing configuration with [AVA](https://github.com/avajs) for unit testing is set up. [Nightwatch](http://nightwatchjs.org/) for browser testing will be set up. There are no substantial test cases written yet. To test the project, run this command:

`yarn test` (short for `yarn run test`)

## People

Eun-hye, Gus, Lauren, Steven :)

## Known Issues/Fixes

- (4-28-2017) In development mode, an error message similar to the one copied below is displayed on the console. This is caused by [the way that hot module reloading is implemented](/client/index.jsx) and does not cause issues in development mode or persist in producton mode. ([source 1](https://github.com/Hashnode/mern-starter/issues/149), tested and confirmed)
```
Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
(client) <!-- react-empty: 1 -
(server) <div data-reactid="1"
```
27 changes: 27 additions & 0 deletions client/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Provider } from 'react-redux';
import { Router, browserHistory } from 'react-router';

import routes from './routes';

require('./main.scss');

const propTypes = {
store: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
routerKey: PropTypes.number.isRequired,
};

function App(props) {
return (
<Provider store={props.store}>
<Router key={props.routerKey} history={browserHistory}>
{routes}
</Router>
</Provider>
);
}

App.propTypes = propTypes;

export default App;
8 changes: 8 additions & 0 deletions client/CsrfActions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const SET_CSRF_TOKEN = 'SET_CSRF_TOKEN';

export function setToken(_csrf) {
return {
type: SET_CSRF_TOKEN,
_csrf,
};
}
14 changes: 14 additions & 0 deletions client/CsrfReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
SET_CSRF_TOKEN,
} from './CsrfActions';

const initialState = '';

export default function items(state = initialState, action) {
switch (action.type) {
case SET_CSRF_TOKEN:
return action._csrf ? action._csrf : '';
default:
return state;
}
}
Loading

0 comments on commit a25ae64

Please sign in to comment.