-
Notifications
You must be signed in to change notification settings - Fork 19
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
Showing
41 changed files
with
1,678 additions
and
473 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 |
---|---|---|
@@ -1,36 +1,179 @@ | ||
## React Front end Boilerplate | ||
|
||
In order to use the boilerplate you will need NodeJS to be installed on your system. | ||
|
||
## Setup Node.js | ||
|
||
In order to setup NodeJS you need to follow the current steps: | ||
|
||
### Mac OS X | ||
|
||
* Step1: Install Home brew | ||
|
||
``` | ||
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | ||
$ brew -v | ||
``` | ||
|
||
* Step2: Install Node using Brew | ||
|
||
``` | ||
$ brew install node | ||
$ node -v | ||
$ npm -v | ||
``` | ||
|
||
### Linux Systems | ||
|
||
* Step1: Install Node using apt-get | ||
|
||
``` | ||
$ sudo apt-get install curl python-software-properties | ||
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - | ||
$ sudo apt-get install nodejs | ||
$ node -v | ||
$ npm -v | ||
``` | ||
## Setup React Frontend Boilerplate Application | ||
|
||
* Step1: Git clone the application | ||
|
||
``` | ||
$ git clone https://github.com/deakin-launchpad/react-frontend-boilerplate.git | ||
$ cd react-frontend-boilerplate | ||
``` | ||
|
||
* Step2: Install node modules | ||
|
||
``` | ||
$ npm i | ||
or | ||
$ npm install | ||
``` | ||
|
||
* Step3: Start the application | ||
|
||
``` | ||
For Development Mode | ||
$ npm start | ||
``` | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
## Configuration | ||
|
||
The basic configuration of the application is defined in JSON files. In the future, these files can be used to define application configuration during development. The config files are already created with basic configuration to start with. | ||
- Dev Mode | ||
1. File location: `src/configurations/devMode.json`. | ||
2. The Dev mode button allows users to login into an application without entering login credentials. Instead, they can be configured by updating `user & password` keys and will be auto-filled for quick login. This will only work when the application is connected to a server and the user already is registered inside the database. | ||
3. During development, the login using server can be skipped by changing `"bypassBackend": false` to `"bypassBackend": true` . | ||
4. The dev mode button position can be configured using keys namely `verticlePosition` which accepts `top or bottom` value & `horizontalPosition` accepts `left or right` value. | ||
- Application Layout | ||
1. File location `src/configurations/layout.json`. | ||
2. The application side menu can be configured easily using a JSON file to avoid writing long lines of code. | ||
``` | ||
{ | ||
items: [ | ||
{ | ||
"name": Name of button, | ||
"type": "button", | ||
"icon": "home", // COMMENT: Add icon name you would like to display | ||
"controller": "/home", // COMMENT: Add path name to you view | ||
"customTitle": "This is my custom title" // COMMENT: The title will be displayed along with icon in side menu | ||
} | ||
``` | ||
3. You can find icon names from [Material Icons](https://material.io/resources/icons/?style=baseline). | ||
|
||
- IDB config | ||
1. File location `src/database/idb/config.json`. | ||
2. The idb uses IndexedDB API to store a significant amount of structured data, including files/blobs. | ||
3. The boilerplate provides the basic configuration for idb where the main configurable key is `dbName`. The name provided in the file will be used for storage in the client browser. | ||
|
||
- Socket | ||
1. File Location `src/configurations/socket.json` | ||
2. The boilerplate already has socket client which can be enabled by changing `"initSocket": false` to `"initSocket": true` | ||
3. If the socket requires to use the access token verification it can also be enabled by changing `"accessTokenVerification":false` to `"accessTokenVerification":true` | ||
4. Any other socket options can be defined on the `"socketDefaultOptions"` variable in the configuration. | ||
|
||
|
||
## Available Scripts | ||
|
||
|
||
|
||
In the project directory, you can run: | ||
|
||
|
||
|
||
### `npm start` | ||
|
||
|
||
|
||
Runs the app in the development mode. | ||
|
||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
|
||
|
||
The page will reload if you make edits. | ||
|
||
You will also see any lint errors in the console. | ||
|
||
|
||
|
||
### `npm test` | ||
|
||
|
||
|
||
Launches the test runner in the interactive watch mode. | ||
|
||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. | ||
|
||
|
||
|
||
### `npm run build` | ||
|
||
|
||
|
||
Builds the app for production to the `build` folder.<br> | ||
|
||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
|
||
|
||
The build is minified and the filenames include the hashes.<br> | ||
|
||
Your app is ready to be deployed! | ||
|
||
|
||
|
||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
|
||
|
||
|
||
### `npm run eject` | ||
|
||
|
||
|
||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!** | ||
|
||
|
||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
|
||
|
||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. | ||
|
||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. |
Oops, something went wrong.