This is a repository for the following setup:
- TypeScript as the language extension
- Babel as the script compiler
- React as the framework
- Webpack for serving
- Redux for storehouse
- Jest-Cucumber for bdd
-
Install nodejs if not installed.
-
If you want a version controller, I recommend using nvm.
-
You can simply install node by downloading it from the website or using the os's package manager.
If you're installing on windows there's the option of WSL but be warned, WSL crashes a lot when installing npm libraries. Other options would be using cygwin, or using virtual machines. You will have different options. Here are a few:
-
-
(Optional but highly recommended) Install a version control system (VCS). I recommend git, and creating a github account. Alternatively, you can host your own local repsoitory using solutions like gitlab. You do not need Enterprise edition necessarily, you can just use the free community edition.
-
Choose an Integrated Development Environment (Highly recommended) or text editor. Here are a few options:
- Visual Studio Code
- Eclipse
- NetBeans
- One of JetBrain's IDEs like WebStorm. I chose this one.
- Komodo Edit
-
Create Folder Structure as follows:
- Main project directory. eg. "reaction"
- A sub-directory for static public assets
- A sub-directory for sources
- A sub-directory under sources, for components
- A sub-directory under sources, for types
- A sub-directory under sources, for constants
- A sub-directory under sources, for api
- A sub-directory under sources, for redux
- A sub-directory under redux, for actions
- A sub-directory under redux, for reducers
The final structure will be something like this:
reaction/ ├─ .gitignore * ├─ .babelrc * ├─ .quokka * ├─ images.d.ts * ├─ node_modules/ * ├─ public/ │ ├─ fav.ico * │ ├─ index.html * │ └─ manifest.json * ├─ src/ │ ├─ api │ ├─ components │ ├─ constants │ ├─ redux │ │ └─ actions │ │ └─ reducers │ └─ types ├─ package.json * ├─ README.md * ├─ tsconfig.json * ├─ tsconfig.prod.json * ├─ tsconfig.test.json * └─ tslint.json *
'*' will be added later.
-
(Optional) Create repository and add credentials.
-
Create a github repository and follow instructions.
cd reaction git init git config user.name "Your Name" git config user.email "Your Email" echo "Hello World!" > README.md
-
Prepare credentials for remote project
-
If you do not have multiple github user accounts:
ssh-keygen -t rsa -b 4096
Copy the contents of the id_rsa.pub file under ~/.ssh/ directory and add it to your github user's ssh keys.
-
If you have multiple github accounts:
ssh-keygen -t rsa -b 4096 mv ~/.ssh/id_rsa ~/.ssh/id_rsa_your_github_user mv ~/.ssh/id_rsa.pub ~/.ssh/id_rsa.pub_your_github_user
And create a file named config in ~/.ssh with the following contents:
Host github.com-your_github_user Hostname github.com User git IdentityFile ~/.ssh/id_rsa_your_github_user
Then you need to change permissions on the config file
chmod 600 ~/.ssh/config
Finally copy the contents of the id_rsa.pub_your_github_user file and add it to your github user's ssh keys.
-
-
Add remote repository to local git setup:
-
If you do not have multiple github user accounts:
git remote add origin [email protected]:your_github_user/your_project_name.git
-
If you have multiple github user accounts:
git remote add origin [email protected]_github_user:your_github_user/your_project_name.git
-
-
Create the .gitignore file in the root directory of the project and populate it with files and directory patterns you do not want to include in version control. This usually includes but is not limited to:
- IDE files
- Node Modules
- Debug logs
- Process ID files
- Grunt file
- Compiled Addons
- Packs
For simplicity, you can just use the .gitignore file provided in this project and modify it as you wish.
-
-
Install yarn and typescript globally.
npm i -g yarn typescript