Skip to content

Commit

Permalink
Update Repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Dec 11, 2024
1 parent 9d855b9 commit f01ab65
Show file tree
Hide file tree
Showing 565 changed files with 26,442 additions and 28,459 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120

[*.{md,markdown}]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HYPIXEL_KEY=HYPIXEL_API_KEY
79 changes: 74 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,78 @@

If you want to contribute to hypixel-api-reborn, feel free to fork the repository and submit pull request.

## Setup
## Table of contents

1. Fork the repository.
2. Run `npm ci`.
3. Code your idea.
4. Run `npm run eslint` to run ESlint.
- [Requirements](#requirements)
- [Project Setup](#project-setup)
- [Testing your changes](#testing-your-changes)
- [Submitting a pull request](#submitting-a-pull-request)
- [Common issues](#common-issues)

### Requirements

- [Node v20.16.0 or higher](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs)
- [pnpm v9.7.1 or higher](https://pnpm.io/installation)

### Project Setup

Once you have the requirements installed, you can clone the repository and install the dependencies.

```bash
pnpm install
```

Once you have all the packages installed, you will need to create a `.env` file. This file will contain the Hypixel API
key. You can get one by going to the [Hypixel Developer Portal.](https://developer.hypixel.net/) This key will be used
in the tests. Your `.env` file should look like this:

```env
HYPIXEL_KEY=HYPIXEL_API_KEY
```

**If your using vscode** With vscode we have a few recommended extensions that you can install to help with development.
You will be promoted to install these when you open the project in vscode. If you don't see the prompt, you can install
the extensions manually. Here are the recommended extensions:

- [Editor Config](https://marketplace.visualstudio.com/items?itemName=editorconfig.editorconfig)
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- [Gitlens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
- [Better Comments](https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments)
- [Vitest](https://marketplace.visualstudio.com/items?itemName=vitest.explorer)
- [GitHub Pull Requests](https://marketplace.visualstudio.com/items?itemName=github.vscode-pull-request-github)

### Testing your changes

Before submitting a pull request, make sure to test your changes. You can run the tests with the following command:

```bash
pnpm test
```

### Submitting a pull request

When submitting a pull request, make sure to provide a detailed description of the changes you made. If you are adding a
new feature, make sure to include tests for it. If you are fixing a bug, make sure to include the bug report
information. When making a pull request we have a few requirements:

- Tests must pass (`pnpm test`)
- Code must be linted (`pnpm lint`)
- Code must be formatted (`pnpm prettier`)
- A clear and detailed description of the changes that you have done
- Checkboxes for the changes you made
- Screenshots of the code running (if applicable)

### Common issues

There are a few common issues that can come up when contributing to the project. Here are a few of them:

- **Tests failing**: Tests will fail when making a pull request. This is because it's missing an API key set in github
actions. If this is the case, you can ignore the tests and someone will run them for you when reviewing the pull
request.

- **Code formatting**: Code must be formatted and the github actions will check for this. If the code is not formatted,
the github action will fail and you will need to correct this before the pull request can be merged.

- **Code using npm**: Any code that includes an npm lock file will not be accepted. This is because we use pnpm for
package management. If you have an npm lock file, you will need to remove it and use pnpm to install the packages.
13 changes: 11 additions & 2 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@ about: Report a bug

### Bug report

- Part of code where error occurred
- What error occurred
- Part of code where error occurred:
- What error occurred:

### Expected behavior

- What you expected to happen:

### Additional context

- Node version:
- Package version:
9 changes: 4 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
<details>
<summary>Checkboxes</summary>

- [x] I've added new features. (methods or parameters)
- [ ] I've added jsdoc and typings.
- [ ] I've added new features. (methods or parameters)
- [ ] I've fixed bug. (_optional_ you can mention a issue if there is one)
- [ ] I've corrected the spelling in README, documentation, etc.
- [ ] I've tested my code. (`npm run tests`)
- [ ] I've check for issues. (`npm run eslint`)
- [ ] I've fixed my formatting. (`npm run prettier`)
- [ ] I've tested my code. (`pnpm test`)
- [ ] I've check for issues. (`pnpm lint`)
- [ ] I've fixed my formatting. (`pnpm prettier`)

</details>
2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ be no issue and the team will be greatful for your actions.
To report a vulnerability you can do so in the [Discord Server](https://discord.gg/NSEBNMM) by openeing a support ticket
or you can contact the primary contributor of this repository using the following contact methods:

- @kathund. on Discord
- @.kathund on Discord
- @kathundd on Telegram
19 changes: 0 additions & 19 deletions .github/dependabot.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
XS:
name: size/XS
lines: 0
color: 3CBF00
S:
name: size/S
lines: 50
color: 5D9801
M:
name: size/M
lines: 200
color: 7F7203
L:
name: size/L
lines: 1000
color: A14C05
XL:
name: size/XL
lines: 3000
color: C32607
XXL:
name: size/XXL
lines: 7500
color: E50009
27 changes: 27 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", "group:allNonMajor"],
"rebaseWhen": "behind-base-branch",
"ignoreDeps": ["pnpm", "node"],
"semanticCommits": "enabled",
"labels": ["dependencies"],
"schedule": ["* 0 * * *"],
"enabledManagers": ["npm"],
"rangeStrategy": "bump",
"prConcurrentLimit": 5,
"includeForks": true,
"prHourlyLimit": 0,
"timezone": "UTC",
"packageRules": [
{
"matchPackageNames": ["skyhelper-networth"],
"updateTypes": ["minor"],
"automerge": true
},
{
"matchUpdateTypes": ["minor", "patch"],
"matchCurrentVersion": "!/^0/",
"commitMessagePrefix": "chore(deps):"
}
]
}
54 changes: 54 additions & 0 deletions .github/scripts/checkCoverage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { parseString } from 'xml2js';
import { readFile } from 'fs';

function parseXMLFile(): Promise<any> {
return new Promise((resolve, reject) => {
readFile('.github/coverageData.xml', 'utf8', (err, data) => {
if (err) {
reject('File Dose not exist!');
return;
}

parseString(data, (err, result) => {
if (err) {
reject('Something Went wrong!');
return;
}

resolve(result);
});
});
});
}

const data = await parseXMLFile();
const codeStats = data.coverage.project[0].metrics[0].$;
const info = {
statements: Number(codeStats.statements),
coveredstatements: Number(codeStats.coveredstatements),
conditionals: Number(codeStats.conditionals),
coveredconditionals: Number(codeStats.coveredconditionals),
methods: Number(codeStats.methods),
coveredmethods: Number(codeStats.coveredmethods)
};

if (95 > (info.coveredstatements / info.statements) * 100) {
throw new Error('Statements is required to be 95% or higher');
}

if (95 > (info.coveredconditionals / info.conditionals) * 100) {
throw new Error('Conditionals is required to be 95% or higher');
}

if (95 > (info.coveredmethods / info.methods) * 100) {
throw new Error('Methods is required to be 95% or higher');
}

if (
95 >
((info.coveredstatements + info.coveredconditionals + info.coveredmethods) /
(info.statements + info.conditionals + info.methods)) *
100
) {
throw new Error('Everythng Combinded is required to be 95% or higher');
}
81 changes: 81 additions & 0 deletions .github/workflows/UpdateDocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: 'Update Docs'
on:
push:
paths:
- src/**
branches:
- master
workflow_dispatch:

env:
NODE_VERSION: '20'

jobs:
pnpm:
name: Install dependencies (pnpm)
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'

- name: Install node dependencies
run: pnpm install

UpdateDocs:
name: Update Documentation
needs: [pnpm]
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'

- name: Install node dependencies
run: pnpm install

- name: Generate Documentation
run: pnpm docgen

- name: Move new documentation to temp directory
run: mv documentation/ tmp/

- name: Switch to documentation branch
run: |
git fetch --all
git checkout docs
- name: Clear Old Documentation files
run:
rm -rf assets/ classes/ functions/ interfaces/ modules/ types/ variables/ 404.html hierarchy.html index.html
modules.html sitemap.xml .nojekyll

- name: Move new Documentation files into place
run: |
mv tmp/.nojekyll ./
mv tmp/* ./
rm -r tmp/
- name: Commit and push changes
run: |
git config --global user.name "Docs Updater[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Update Documentation" || echo "No changes to commit"
git push origin documentation
Loading

0 comments on commit f01ab65

Please sign in to comment.