-
Notifications
You must be signed in to change notification settings - Fork 1
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
247 changed files
with
22,322 additions
and
4,869 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,12 +1,13 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
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 | ||
insert_final_newline = false |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
HYPIXEL_KEY=HYPIXEL_API_KEY |
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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Contributing | ||
|
||
If you want to contribute to hypixel-api-reborn, feel free to fork the repository and submit pull request. | ||
|
||
## Table of contents | ||
|
||
- [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. |
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
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
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
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 |
---|---|---|
@@ -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'); | ||
} |
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
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
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ oldreborn/ | |
dist/ | ||
.eslintcache | ||
coverage/ | ||
.github/coverageData.xml |
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,8 +1,8 @@ | ||
node_modules/ | ||
oldreborn/ | ||
.env | ||
dist/ | ||
.eslintcache | ||
.git | ||
.gitignore | ||
coverage/ | ||
coverage/ | ||
.github/coverageData.xml |
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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"editor.tabSize": 2, | ||
"prettier.useTabs": false, | ||
"files.insertFinalNewline": true, | ||
"files.trimTrailingWhitespace": true, | ||
"editor.trimAutoWhitespace": true | ||
} |
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,4 +1,33 @@ | ||
<div align="center"> | ||
<img src="https://i.imgur.com/cDFoQZU.png?1"> | ||
<h1>Hypixel API • Reborn</h1> | ||
<a href="https://discord.gg/NSEBNMM"><img src="https://discordapp.com/api/guilds/660416184252104705/embed.png"></a> | ||
<a href="https://travis-ci.org/StavZ/hypixel-api-reborn"><img src="https://flat.badgen.net/travis/hypixel-api-reborn/hypixel-api-reborn"></a> | ||
<a href="https://app.codacy.com/gh/Hypixel-API-Reborn/hypixel-api-reborn?utm_source=github.com&utm_medium=referral&utm_content=Hypixel-API-Reborn/hypixel-api-reborn&utm_campaign=Badge_Grade"><img src="https://flat.badgen.net/codacy/grade/71cd7e95499b496cb2dd11c29b9def33/master"></a> | ||
<img src="https://flat.badgen.net/npm/v/hypixel-api-reborn"> | ||
<img src="https://flat.badgen.net/npm/node/hypixel-api-reborn"> | ||
<img src="https://flat.badgen.net/npm/license/hypixel-api-reborn"> | ||
<a href="https://github.com/Hypixel-API-Reborn/hypixel-api-reborn"><img src="https://flat.badgen.net/github/stars/hypixel-api-reborn/hypixel-api-reborn"></a> | ||
<a href="https://www.npmjs.com/package/hypixel-api-reborn"><img src="https://nodei.co/npm/hypixel-api-reborn.png?compact=true"></a> | ||
<h2>A feature-rich Hypixel API wrapper for Node.js</h2> | ||
<br> | ||
</div> | ||
|
||
### Links | ||
|
||
[Discord Support](https://discord.gg/NSEBNMM) | [Documentation](https://hypixel-api-reborn.github.io/) | | ||
[NPM](https://www.npmjs.com/package/hypixel-api-reborn) | | ||
[GitHub](https://github.com/Hypixel-API-Reborn/hypixel-api-reborn) | | ||
|
||
#### Requirements | ||
|
||
**For Node.js users >= v20.16.0** <br> **For TypeScript users >= v5.5.4** | ||
|
||
### Installation & Usage | ||
|
||
```shell | ||
npm i hypixel-api-reborn@next | ||
``` | ||
|
||
**Do note that you are installing a beta version of v12.0.0.** Any issues or bugs you encounter, please report them in | ||
the [Discord Support](https://discord.gg/NSEBNMM). |
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
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,9 +1,10 @@ | ||
{ | ||
"name": "hypixel-api-reborn", | ||
"version": "12.0.0", | ||
"version": "12.0.0-4", | ||
"description": "Feature-rich Hypixel API wrapper for Node.js", | ||
"main": "./src/index.ts", | ||
"types": "./src/typings/index.d.ts", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"module": "dist/index.js", | ||
"keywords": [ | ||
"minecraft", | ||
"client", | ||
|
@@ -22,40 +23,47 @@ | |
"prettier": "npx prettier --write src/", | ||
"build": "npx tsc", | ||
"test": "npx vitest run", | ||
"test:coverage": "npx vitest --ui --coverage" | ||
"test:coverage": "npx vitest run --coverage && mv coverage/clover.xml .github/coverageData.xml && npx tsx .github/checkCoverage.ts", | ||
"test:ui": "npx vitest --ui --coverage" | ||
}, | ||
"engines": { | ||
"node": ">=20.17.0" | ||
"node": ">=20.16.0" | ||
}, | ||
"type": "module", | ||
"packageManager": "[email protected]", | ||
"author": "Kathund", | ||
"dependencies": { | ||
"axios": "^1.7.5", | ||
"farming-weight": "^0.5.0", | ||
"node-cache": "^5.1.2", | ||
"prismarine-nbt": "^2.5.0", | ||
"prismarine-nbt": "github:prismarinejs/prismarine-nbt#70323d8c7f771698a02f3f40aa676bcecc60c5e7", | ||
"rss-parser": "^3.13.0", | ||
"skyhelper-networth": "^1.24.0" | ||
"skyhelper-networth": "^1.25.0" | ||
}, | ||
"license": "MIT", | ||
"readme": "https://github.com/Hypixel-API-Reborn/hypixel-api-reborn?tab=readme-ov-file#hypixel-api--reborn", | ||
"repository": { | ||
"url": "https://github.com/Hypixel-API-Reborn/hypixel-api-reborn" | ||
"url": "git+https://github.com/Hypixel-API-Reborn/hypixel-api-reborn.git" | ||
}, | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"publisher": "Kathund", | ||
"devDependencies": { | ||
"@eslint/js": "^9.9.1", | ||
"@types/eslint": "^9.6.0", | ||
"@vitest/coverage-v8": "^2.0.5", | ||
"@vitest/ui": "^2.0.5", | ||
"@eslint/js": "^9.12.0", | ||
"@j4cobi/eslint-plugin-sort-imports": "^1.0.2", | ||
"@types/eslint": "^9.6.1", | ||
"@types/node": "^20.16.10", | ||
"@types/xml2js": "^0.4.14", | ||
"@vitest/coverage-v8": "^2.1.2", | ||
"@vitest/ui": "^2.1.2", | ||
"dotenv": "^16.4.5", | ||
"@types/node": "^20.16.1", | ||
"eslint": "^9.9.1", | ||
"eslint": "^9.12.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"globals": "^15.9.0", | ||
"globals": "^15.10.0", | ||
"prettier": "^3.3.3", | ||
"typescript": "^5.5.4", | ||
"typescript-eslint": "^8.2.0", | ||
"vitest": "^2.0.5" | ||
"typescript": "^5.6.2", | ||
"typescript-eslint": "^8.8.0", | ||
"vitest": "^2.1.2", | ||
"xml2js": "^0.6.2" | ||
} | ||
} |
Oops, something went wrong.