Skip to content

Commit

Permalink
Merge pull request #860 from MuntazirHaider/issues
Browse files Browse the repository at this point in the history
Setup Husky #854
  • Loading branch information
shivareddy6 authored Nov 18, 2023
2 parents b6555d8 + 55548e0 commit b1909de
Show file tree
Hide file tree
Showing 250 changed files with 13,842 additions and 11,973 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
env: {
browser: true,
es2021: true
},
extends: ["eslint:recommended", "plugin:react/recommended"],
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2020,
sourceType: "module"
},
plugins: ["react"],
rules: {},
settings: {
react: {
version: "detect"
}
}
};
24 changes: 13 additions & 11 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots or GIF (In case of UI changes):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
Expand Down
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
npm run format

91 changes: 48 additions & 43 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Table of Content

- [Table of Content](#table-of-content)
- [User Guide](#user-guide)
- [Prerequisites](#prerequisites)
Expand All @@ -13,32 +14,35 @@
# User Guide

## Prerequisites

- Node.js version 14.
- Java JDK version 11 or higher. (For running emulators)
- make command line tool. ( optional )
> 📝**NOTE** : `make` is optional here. You can open `Makefile` and type the associated command manually also, but it is recommended to use `make` so you don't need to run multiple commands.
>
> 📝**NOTE** : `make` is optional here. You can open `Makefile` and type the associated command manually also, but it is recommended to use `make` so you don't need to run multiple commands.
## Project Setup

> 📝**NOTE**: Make sure that you are using version 14 of node.
> **Tip**: You can use nvm (node version manager) tool to install multiple node versions and can switch between them easily.
1. Fork the repo as your own copy.
2. Click on `Code` button and then copy HTTPs link. ( it will look like this `https://github.com/<YOUR_USERNAME>/Codelabz.git`)
3. Clone the repo by running `git clone https://github.com/<YOUR_USERNAME>/Codelabz.git`
4. Go to the folder `cd Codelabz`.
5. Run `npm install` or `make install`( this will install all the dependencies in your project)
6. Create a `.env` file in root of directory.
6. Create a `.env` file in root of directory.
7. Setup firebase and get your own set of keys. ( follow steps in [Firebase Setup](#firebase-setup) section to setup firebase )
8. Copy all the key fields from `.env.sample` and place your own set of values there.
9. Run `npm run dev`.
10. Visit [http://127.0.0.1:5173/](http://127.0.0.1:5173/) in your preferred browser.
10. Visit [http://127.0.0.1:5173/](http://127.0.0.1:5173/) in your preferred browser.

>📝**NOTE** : Above steps are enough for you to get started with the Codelabz app. If you want to access the database you need to start the emulators.
> 📝**NOTE** : Above steps are enough for you to get started with the Codelabz app. If you want to access the database you need to start the emulators.For setup husky follow [Husky Setup](#husky-setup)
### Using Docker-Compose
You can also use docker-compose to setup your project. Simply create your `.env` file and run

You can also use docker-compose to setup your project. Simply create your `.env` file and run

```
docker-compose up
```
Expand All @@ -47,94 +51,95 @@ This will setup your project along with firebase emulator in a docker environmen

---



## Firebase Setup

1. Sign in to https://console.firebase.google.com/.
2. Click **Add Project** and necessary information about the project.(Below mentioned the Steps to add project to firebase)
- To add Firebase resources to an existing Google Cloud project, enter its project name or select it from the dropdown menu.
- To create a new project, enter the desired project name. You can also optionally edit the project ID displayed below the project name
- Firebase generates a unique ID for your Firebase project based upon the name you give it. If you want to edit this project ID, you must do it now as it cannot be altered after Firebase provisions resources for your project. Visit Understand Firebase Projects to learn about how Firebase uses the project ID.
2. Click **Add Project** and necessary information about the project.(Below mentioned the Steps to add project to firebase)
- To add Firebase resources to an existing Google Cloud project, enter its project name or select it from the dropdown menu.
- To create a new project, enter the desired project name. You can also optionally edit the project ID displayed below the project name
- Firebase generates a unique ID for your Firebase project based upon the name you give it. If you want to edit this project ID, you must do it now as it cannot be altered after Firebase provisions resources for your project. Visit Understand Firebase Projects to learn about how Firebase uses the project ID.
3. Agree to the terms and click **Create Project**.
4. After creating the project, click **Add Firebase to your web app**.
- In the center of the Firebase console's project overview page, click the Web icon to launch the setup workflow.
- If you've already added an app to your Firebase project, click Add app to display the platform options.
- Enter your app's nickname.
- This nickname is an internal, convenience identifier and is only visible to you in the Firebase console.
- Click Register app.
- In the center of the Firebase console's project overview page, click the Web icon to launch the setup workflow.
- If you've already added an app to your Firebase project, click Add app to display the platform options.
- Enter your app's nickname.
- This nickname is an internal, convenience identifier and is only visible to you in the Firebase console.
- Click Register app.
5. Copy the firebase configuration.
6. Follow the below steps to setup firebase functions
- Go to functions directory (`cd functions`) and install dependencies (`npm install`)
- Create a folder `private` inside functions directory
- Then you have to generate a private key file for your service account. Follow the below steps to get private key:
1. In the Firebase console, open Settings > Service Accounts.
2. Click Generate New Private Key, then confirm by clicking Generate Key.
3. Securely store the JSON file containing the key and rename it to `cl-dev-pk.json`
4. Move the `cl-dev-pk.json` to `Codelabz/functions/private`
- Go to functions directory (`cd functions`) and install dependencies (`npm install`)
- Create a folder `private` inside functions directory
- Then you have to generate a private key file for your service account. Follow the below steps to get private key:
1. In the Firebase console, open Settings > Service Accounts.
2. Click Generate New Private Key, then confirm by clicking Generate Key.
3. Securely store the JSON file containing the key and rename it to `cl-dev-pk.json`
4. Move the `cl-dev-pk.json` to `Codelabz/functions/private`
7. Paste the configuration `.env` file. **(this will be found in the project settings section of firebase cloud)**
8. You can find your `<FIREBASE_DATABASE_URL>` in the Realtime Database section of the Firebase console. Depending on the location of the database, the database URL will be in one of the following forms:
- `https://DATABASE_NAME.firebaseio.com` **(for databases in us-central1)**
- `https://DATABASE_NAME.REGION.firebasedatabase.app`**(for databases in all other locations)**
8. You can find your `<FIREBASE_DATABASE_URL>` in the Realtime Database section of the Firebase console. Depending on the location of the database, the database URL will be in one of the following forms:
- `https://DATABASE_NAME.firebaseio.com` **(for databases in us-central1)**
- `https://DATABASE_NAME.REGION.firebasedatabase.app`**(for databases in all other locations)**
9. You can get your `<FIREBASE_VAPID_KEY>` from Cloud-Messaging tab
- navigate to the setting of your project Open the Cloud Messaging tab.
- scroll to the Web configuration section.
- In the Web Push certificates tab, click Generate Key Pair. The console displays a notice that the key pair was generated. You get your Vapid key form there.
10. As you're using emulator, set `<USE_EMULATOR>` to "true"
- navigate to the setting of your project Open the Cloud Messaging tab.
- scroll to the Web configuration section.
- In the Web Push certificates tab, click Generate Key Pair. The console displays a notice that the key pair was generated. You get your Vapid key form there.
10. As you're using emulator, set `<USE_EMULATOR>` to "true"
11. You can get your `<CYPRESS_PROJECT_ID>` as cypress project id from [cypress cloud](https://cloud.cypress.io)

You should fill in these values in their relevant fields in the `.env` file.

### Firebase Emulator Setup


1. Refer this site [https://firebase.google.com/docs/emulator-suite/install_and_configure]
2. Make sure you have the correct jdk version installed
3. Make sure you are in the parent directory
4. Now lets connect your local firebase to cloub by running command (```firebase login```)
4. Now lets connect your local firebase to cloub by running command (`firebase login`)
5. Then authenticate your firebase using browser and set the selected web app for codelabz
6. Then run the command (```firebase init```)
6. Then run the command (`firebase init`)
7. Select all the emulator necessitites by pressing a or selecting them manually and pressing space
8. Answer the commands
9. Lets set up your credentials of test data
10. Run your firebase emulator by running the following command.

``` shell
```shell
make emulator

```

11. If make command isn't installed then run command
``` shell

```shell
firebase emulators:start --import=testdata

```


12. If you want to start without any testdata , use the following command
``` shell

```shell
make emulator

```

14.If make command isn't installed then run
``` shell

```shell
firebase emulator:start
```
You will observe 3 terminals opening

You will observe 3 terminals opening

### Run Firebase Emulator

Run your firebase emulator by running the following command.

``` shell
```shell
make emulator-import
```

This will run the emulator with the `testdata`. Check out [TESTDATA.md](./TESTDATA.md) for more info.

if you don't want to import testdata, run

```
```
make emulator
```

Expand Down
15 changes: 8 additions & 7 deletions ISSUE_TEMPLATE/Bug_Report.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,9 +24,10 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Device Information (please complete the following information):**
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
7 changes: 3 additions & 4 deletions ISSUE_TEMPLATE/Feature_Request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
Loading

0 comments on commit b1909de

Please sign in to comment.