Skip to content

Commit

Permalink
resolved conflicts from PR 3
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxada committed Nov 23, 2023
2 parents a6fff4f + 5069dd3 commit d3a4ff8
Show file tree
Hide file tree
Showing 11 changed files with 505 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"*.{js,jsx,ts,tsx,json,md,html}": ["npm run format", "git add"]
"*.{js,jsx,ts,tsx,html}": ["npm run format", "git add"]
}
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

104 changes: 104 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Contributing to BadgingAPI

We are beyond excited to see that you want to contribute!
Your contributions are a big help in improving this project. There are various ways to get involved with the BadgingAPI, and we value every single contribution.

Before you begin, please take a moment to go through these guidelines:

- [Code of Conduct](#code-of-conduct)

- [Who can contribute?](#who-can-contribute)

- [How to Contribute](#how-to-contribute)
- [Set up your Local Development Environment](#set-up-your-local-development-environment)
- [Code Style and Standards](#code-style-and-standards)

## Code of Conduct

Please note that this project has a [Code of Conduct](https://github.com/chaoss/.github/blob/main/CODE_OF_CONDUCT.md). We expect all contributors to adhere to it. Please take a moment to read through these guidelines to ensure a positive and inclusive contributor experience.

## Who can contribute

The BadgingAPI is built by the community and warmly welcomes collaboration. So anyone can contribute to this project.

## How to Contribute

### What you'll need

Before cloning this repository, make sure you have the latest versions;

- [NodeJS and NPM](https://nodejs.org/en/download)
- [MySQL](https://dev.mysql.com/downloads/installer/)

Configure MySQL and make sure it is running on your machine before you proceed with the next steps. create a new **_database_** and a new **_database user_** with a **_password_**. these three values will be used to connect to MySQL and will be needed when setting up your `.env` file.

### Basic Configurations

1. You'll need to [create a GitHub OAuth App](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app) on your personal GitHub account. Creating a GitHub OAuth App will automatically generate a `Client_ID` and will also enable you generate a `Client_Secret` for your OAuth App. Store these values safely because they will be needed while generating a `.env` file for the first time.

2. Create your personal [Augur Application](https://projectbadge.chaoss.io/account/settings?section=application) in order to general an `augur_client_secret`. When your new application is created, the `augur_client_secret` will be listed in the last column of **_Your Apps_** table. Store the `augur_client_secret` together with the above GitHub OAuth credentials since it will be needed too while generating a `.env` file for the first time. The `augur_client_secret` is used to connect to the Augur API in order to submit repositories to the Augur Library for further badging.

After generating those values,

1. **Fork the Repository**: Click the "Fork" button in the upper right-hand corner of the BadgingAPI repository on GitHub.

2. **Clone Your Fork**: Clone your fork of the repository to your local machine:

```bash
git clone https://github.com/your_username/BadgingAPI.git #replace `your_username` with your actual GitHub username
```

### Set up your Local Development Environment

1. **Perform the following to get your working environment ready**:

```bash
cd BadgingAPI # move into project directory
npm install # installs packages and dependencies
```

2. **Create a Branch**: Create a new branch for your contribution:

```bash
git checkout -b your-branch-name
```

3. **Make sure project is running**:

```bash
npm run dev # this command will trigger a series of configuration questions in order setup your environmental variables
```

4. **Make Changes**: Make your desired changes to the codebase. Ensure your code follows our coding standards and guidelines.

5. **Test**: Test your changes to ensure they work as expected.

6. **Commit Changes**: Commit your changes with a clear and descriptive message. Make sure your commits are signed.

```bash
git add .
git commit -S -m "<Brief description of your changes>"
```

7. **Push Changes**: Push your changes to your fork on GitHub:

```bash
git push origin your-branch-name
```

8. Create a Pull Request: Go to the BadgingAPI repository on GitHub and create a new pull request from your fork. Describe your changes and why they should be merged.

9. **Review and Discussion**: Your pull request will be reviewed by the maintainers and the community. Be prepared for feedback and be responsive to any suggested changes.

10. **Merge**: Once your pull request is approved, it will be merged into the main project.

## Code Style and Standards

BadgingAPI follows a specific code style and coding standards. Please make sure to adhere to these standards when contributing.

### Issue Tracking

If you're looking for ways to contribute but don't have specific code changes in mind, you can check the [issue tracker](https://github.com/badging/BadgingAPI/issues) for BadgingAPI on GitHub. You might find issues marked as "help wanted" or "good first issue."
Ask for help
If you have any questions or need assistance with your contribution, please contact get in touch with the project maintainers.
We appreciate your contributions and look forward to working with you to make BadgingAPI even better!
56 changes: 56 additions & 0 deletions configure.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const { input, password } = require("@inquirer/prompts");
const fs = require("fs");

(async () => {
if (!fs.existsSync(__dirname + "/.env")) {
console.info(
"Please input the fields below to configure your project locally"
);
const values = {
db_name: await input({ message: "Your database name:" }),
db_user: await input({ message: "Your database user name:" }),
db_password: await password({
message: "Input your database password:",
mask: true,
}),
db_host: await input({
message: "MySQL database host address:",
default: "localhost",
}),
db_dialect: await input({
message: "Your database dialect:",
default: "mysql",
}),

client_ID: await input({
message: "Your personal Github OAuth App Client ID: ",
}),
client_secret: await input({
message: "Your personal Github OAuth App Client Secret:",
}),
augur_client_secret: await input({
message: "Your Augur Client Secret: ",
}),
port: await input({
message: "Port that you'd like server to run on: ",
default: 4040,
}),
};

const envFile = `
DB_NAME=${values.db_name}
DB_USER=${values.db_user}
DB_PASSWORD=${values.db_password}
DB_HOST=${values.db_host}
DB_DIALECT=${values.db_dialect}
CLIENT_ID=${values.client_ID}
CLIENT_SECRET=${values.client_secret}
AUGUR_CLIENT_SECRET=${values.augur_client_secret}
PORT=${values.port}
`;

fs.writeFileSync(".env", envFile);
console.info("Configuration file (.env) created successfully.");
}
})();
1 change: 1 addition & 0 deletions database/helpers/sequelize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const Sequelize = require("sequelize");
require("dotenv").config();

const sequelize = new Sequelize(
process.env.DB_NAME,
Expand Down
12 changes: 0 additions & 12 deletions docker-compose.yaml

This file was deleted.

9 changes: 3 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
const dotenv = require("dotenv");
dotenv.config({ path: `.env.${process.env.NODE_ENV}` });
dotenv.config({ path: `.env.${process.env.NODE_ENV}.local`, override: true });

const cors = require("cors");
const dbconnect = require("./database/helpers/dbconnect");
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const dbconnect = require("./database/helpers/dbconnect");
const routes = require("./src/routes/index.js");
require("dotenv").config();

const app = express();
app.use(express.static("public"));
Expand Down
Loading

0 comments on commit d3a4ff8

Please sign in to comment.