Skip to content
This repository was archived by the owner on Jun 10, 2019. It is now read-only.

Commit 1eb79f1

Browse files
RickRhollomancer
authored andcommitted
Move README to CONTRIBUTING
1 parent 7f34a65 commit 1eb79f1

File tree

2 files changed

+287
-260
lines changed

2 files changed

+287
-260
lines changed

CONTRIBUTING.md

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
2+
# OperationCode Frontend
3+
4+
This is OperationCode.org's repository for their new front-end implementation using React.js
5+
6+
![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=<badge_key>)
7+
8+
## Table Of Contents
9+
- [Technologies](#technologies)
10+
- [Getting Started](#getting-started)
11+
- [Brush up on Development Tools](#brush-up-on-development-tools)
12+
- [Git and basic Command Line](#git-and-basic-command-line)
13+
- [NodeJS](#nodejs)
14+
- [Development Environment](#development-environment)
15+
- [Mac OSX](#mac-osx)
16+
- [Update your mac](#update-your-mac)
17+
- [Xcode Command Line Tools](#xcode-command-line-tools)
18+
- [Homebrew](#homebrew)
19+
- [Git](#git)
20+
- [NodeJS](#nodejs-1)
21+
- [Windows](#windows)
22+
- [Git](#git-1)
23+
- [NodeJS](#nodejs-2)
24+
- [Developing Operation Code Frontend](#developing-operation-code-frontend)
25+
- [File Structure](#file-structure)
26+
- [Scenes / Component Structure](#scenes--component-structure)
27+
- [Components](#components)
28+
- [Styles](#styles)
29+
- [Running the development Server](#running-the-development-server)
30+
- [Production Builds](#production-builds)
31+
- [Static Site](#static-site)
32+
- [Docker Container](#docker-container)
33+
- [Resources](#resources)
34+
- [Contribute](#contribute)
35+
- [License](#license)
36+
37+
## Technologies
38+
39+
- [NodeJS](https://www.nodejs.org/) - Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine.
40+
- [React.js](https://facebook.github.io/react/) - Facebook's popular JavaScript front-end framework.
41+
- [Create-React-App](https://github.com/facebookincubator/create-react-app) - Create React App was initially used to handle boilerplate. We have since Ejected and customized some of the scripts.
42+
- [Webpack](https://webpack.js.org/) - Webpack acts as a module bundler and almost entirely dispenses with the need for a task runner, like Grunt or Gulp.
43+
- [Babel](https://babeljs.io/) - JavaScript compiler to unify all the different versions of JS that may have been used or will be used in the future.
44+
- [Yarn](https://yarnpkg.com/) - Facebook's open source JavaScript package manager. There are a few differences between Yarn and Node Package Mangaer (npm), but the main differentiation is that Yarn locks dependencies so your project doesn't break when external resources change their code.
45+
- [CSS Modules](https://css-tricks.com/css-modules-part-1-need/) - CSS Modules allow us to encapsulate CSS with components.
46+
47+
## Getting Started
48+
49+
### Brush up on Development Tools
50+
51+
#### Git and basic Command Line
52+
53+
You will be working with Git and Github to manage source code. Understanding the basics and how to set things up will be helpful.
54+
- [Learn about Git and Github](https://help.github.com/articles/git-and-github-learning-resources/)
55+
- [Github for windows](https://mva.microsoft.com/en-US/training-courses/github-for-windows-users-16749?l=KTNeW39wC_6006218965)
56+
- [Github Command Line Training](https://services.github.com/on-demand/github-cli)
57+
58+
Getting comfortable with the Bash Shell will be helpful for both Windows and Mac. You may also want to learn about the Windows Command Prompt if you are using Windows.
59+
- For Mac or Linux - [Learn console commands](https://learnpythonthehardway.org/book/appendixa.html)
60+
- For Windows - [Learn Windows Command Prompt](https://www.youtube.com/watch?v=MBBWVgE0ewk)
61+
62+
#### NodeJS
63+
64+
The OperationCode front end runs on NodeJS. Learning the basics of NodeJS will be helpful.
65+
- [NodeJS Tutorial](https://www.tutorialspoint.com/nodejs/)
66+
67+
### Development Environment
68+
69+
You will need a few technologies installed in order to build and run this application. The installation of these is not always straightforward, but we will do our best to guide you through the process.
70+
71+
The installation will depend on which operating system you are running.
72+
73+
### Mac OSX
74+
75+
#### Update your mac
76+
77+
In order to run the latest version of everything, you will need to be on the latest version of Mac OSX. It's entirely possible to get everything working without updating, but this is the easiest and recommended approach.
78+
- [Apple instructions to Upgrade Mac OSX](http://www.apple.com/osx/how-to-upgrade/)
79+
80+
#### Xcode Command Line Tools
81+
82+
If you have xcode installed ensure that it is updated to the latest version through the app store. The full xcode package is not required for the command line tools.
83+
84+
Running the following in your terminal window should prompt you to install the xcode command line tools if you don't already have it installed.
85+
```console
86+
gcc
87+
```
88+
You can verify installation with the command below, you should see similar output:
89+
```console
90+
gcc --version
91+
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
92+
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
93+
Target: x86_64-apple-darwin14.0.0
94+
Thread model: posix
95+
```
96+
- [A guide to installing xcode command line tools](http://railsapps.github.io/xcode-command-line-tools.html)
97+
98+
#### Homebrew
99+
100+
- [Homebrew website](https://brew.sh/)
101+
- Paste the code below into a terminal window to install homebrew.
102+
```console
103+
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
104+
```
105+
106+
#### Git
107+
108+
The easiest way to install git is with homebrew.
109+
```console
110+
brew install git
111+
```
112+
113+
You can also install Github Desktop for the Graphical interface into github. There is no need to install the Command Line tools if you installed git with homebrew.
114+
- [Github Desktop](https://desktop.github.com/)
115+
116+
#### NodeJS
117+
118+
You can install NodeJS a few different ways. Again, the easiest way to install it is with homebrew
119+
```console
120+
brew install node
121+
```
122+
123+
Another option is to install Node Version Manager, this is helpful if you need to use multiple versions of node for different projects.
124+
- [Node Version Manager](https://github.com/creationix/nvm)
125+
126+
n is another project that manages node versions with possibly an easier install and less maintenance.
127+
-[n](https://github.com/tj/n)
128+
129+
The other option is to install the nodejs package from the official website
130+
- [Nodejs Download Page](https://nodejs.org/en/download/)
131+
132+
### Windows
133+
134+
#### Git
135+
136+
You have many options for getting Git on Windows. We recommend using Git for Windows as it gives you a bash shell which can be very powerful and help you start to learn linux commands.
137+
138+
- [Git For Windows](https://git-scm.com/download/win)
139+
140+
Execute the Installer and follow the prompts. Run Git and included tools from Windows Command Prompt is handy, but beware you will be replacing a few windows commands that you probably don't use anyways.
141+
142+
You can also install Github Desktop for a GUI Interface to Github. If you do this you don't want to install the Command Line tools, as Git For Windows is a more recent version.
143+
144+
- [Github for Desktop](https://desktop.github.com/)
145+
146+
#### NodeJS
147+
148+
There are many ways and guides to install NodeJS on Windows. The resources below are from Microsoft.
149+
- [NodeJS On Windows Guidelines](https://github.com/Microsoft/nodejs-guidelines)
150+
- [Configuring your Windows development environment for NodeJS](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#configuring-your-windows-development-environment)
151+
152+
One way to install NodeJS for windows is to simply download and execute the MSI Package from the official downloads page.
153+
- [Nodejs Download Page](https://nodejs.org/en/download/)
154+
155+
To test the installation open up a Command Prompt or Git Bash and enter the following commands:
156+
```console
157+
node --version
158+
npm --version
159+
```
160+
If your installation was sucessful you will get the versions of node and npm that were installed.
161+
162+
### Developing Operation Code Frontend
163+
164+
#### File Structure
165+
166+
```
167+
├── config (Build Configuration Files)
168+
│   ├── jest
169+
│   ├── env.js
170+
│   ├── paths.js
171+
│   ├── polyfills.js
172+
│   ├── webpack.config.dev.js
173+
│   └── webpack.config.prod.js
174+
├── public (Static files to be included in the build. Icon files excluded for brevity)
175+
│   ├── favicon.ico
176+
│   ├── index.html
177+
├── scripts (Build Scripts)
178+
│   ├── build.js
179+
│   ├── start.js
180+
│   └── test.js
181+
├── src
182+
│   ├── images
183+
│   ├── scenes (see scenes section below)
184+
│   ├── shared (Shared React Components and Services)
185+
│   ├── styles (Shared Styles to be used with CSS Modules Composition)
186+
│   ├── App.js
187+
│   ├── App.test.js
188+
│   ├── index.css
189+
│   └── index.js
190+
├── Dockerfile
191+
├── LICENSE
192+
├── README.md
193+
├── docker-compose.yml
194+
├── index.html
195+
├── package.json
196+
├── server.js
197+
└── yarn.lock
198+
199+
```
200+
201+
#### Scenes / Component Structure
202+
203+
The idea of scenes were inspired by this post:
204+
- [How to better organize your react applications](https://medium.com/@alexmngn/how-to-better-organize-your-react-applications-2fd3ea1920f1)
205+
206+
Scenes give us the ability to have different views of our application. For example, we could have a home page view, or a mentors page view with a different navigation menu.
207+
208+
##### Components
209+
Components should be nested in a scene, or within another component. The idea is that a component will be declared at the level that it will be shared. If a component can be shared across the whole site, it should go in the /shared folder.
210+
211+
##### Styles
212+
We are using CSS modules for styling. Each components styles should be next to the component, and contain all the information to render that component. React favors [Composition over Inheritance](https://facebook.github.io/react/docs/composition-vs-inheritance.html)
213+
214+
```
215+
├── scenes
216+
│   └── home
217+
│   ├── about
218+
│   │   └── about.js
219+
│   ├── families
220+
│   │   ├── facts
221+
│   │   └── jumboQuote
222+
│   ├── footer
223+
│   │   ├── footer.css
224+
│   │   └── footer.js
225+
│   ├── header
226+
│   │   ├── logo
227+
│   │   ├── topNav
228+
│   │   ├── header.css
229+
│   │   └── header.js
230+
│   ├── landing
231+
│   │   ├── landing.css
232+
│   │   └── landing.js
233+
│   ├── home.css
234+
│   └── home.js
235+
```
236+
237+
#### Running the development Server
238+
239+
- `npm install -g yarn` - Install Yarn Globally
240+
241+
- `yarn install` - Install Package dependencies. Be sure to run this each time you pull from Github to update the dependencies.
242+
243+
- `yarn start` - Start the development server
244+
245+
### Production Builds
246+
247+
#### Static Site
248+
249+
- `yarn run build` - This bundles the application into static files for production (minimization, post-processing, etc.)
250+
251+
- `yarn test` - This starts the test runner.
252+
253+
- `yarn start:server` - Runs express js serving production static files.
254+
255+
#### Docker Container
256+
257+
- `docker-compose up -d --build` - Builds and starts the Docker Container listening port 80.
258+
259+
## Resources
260+
261+
- [Learning React With Create-React-App](https://medium.com/@diamondgfx/learning-react-with-create-react-app-part-1-a12e1833fdc)
262+
- [What Is Webpack?](https://survivejs.com/webpack/what-is-webpack/)
263+
- [Routed React with Express.js and Docker](https://medium.com/@patriciolpezjuri/using-create-react-app-with-react-router-express-js-8fa658bf892d)
264+
- [React Lifecycle Methods - How And When To Use Them](https://engineering.musefind.com/react-lifecycle-methods-how-and-when-to-use-them-2111a1b692b1)
265+
- [Let's test React components with TDD< Mocha, Chai, and jsdom](https://medium.freecodecamp.com/simple-react-testing-d9e25ec87e2)
266+
267+
## Contribute
268+
269+
[Operation Code Contribution Guide](https://github.com/OperationCode/START_HERE)
270+
271+
## License
272+
273+
[MIT](LICENSE) © OperationCode

0 commit comments

Comments
 (0)