Make basic Lib

This commit is contained in:
Braydon 2024-04-14 13:34:34 -04:00
parent 7ab210edb7
commit 9751a21c9f
12 changed files with 177 additions and 0 deletions

1
Lib/.gitignore vendored Normal file

@ -0,0 +1 @@
node_modules

1
Lib/README.md Normal file

@ -0,0 +1 @@
# Lib

8
Lib/build.mjs Normal file

@ -0,0 +1,8 @@
import dts from "bun-plugin-dts";
await Bun.build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
minify: true,
plugins: [dts()],
});

BIN
Lib/bun.lockb Normal file

Binary file not shown.

46
Lib/dist/index.d.ts vendored Normal file

@ -0,0 +1,46 @@
// Generated by dts-bundle-generator v9.3.1
export type Player = {
/**
* The unique id of this player.
*/
uniqueId: string;
/**
* The username of this player.
*/
username: string;
/**
* The skin of this player.
*/
skin: Skin;
};
/**
* A skin for a {@link Player}.
*/
export type Skin = {
/**
* The texture URL of this skin.
*/
url: string;
/**
* The model of this skin.
*/
model: Model;
/**
* Is this skin legacy?
*/
legacy: boolean;
};
/**
* Possible models for a skin.
*/
export type Model = "default" | "slim";
/**
* Get a player by their username or UUID.
*
* @param query the query to search for the player by
* @returns the promised player
*/
export declare const getPlayer: (query: string) => Promise<Player>;
export {};

1
Lib/dist/index.js vendored Normal file

@ -0,0 +1 @@
var d=(a)=>{return new Promise((p,b)=>{p({uniqueId:"fc1d5fe7-f29b-430d-80bb-3b093a638b0f",username:"Rainnny",skin:{url:"",model:"default",legacy:!1}})})};export{d as getPlayer};

40
Lib/package.json Normal file

@ -0,0 +1,40 @@
{
"name": "restfulmc",
"version": "1.0.0",
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
"description": "A simple, yet useful RESTful API for Minecraft utilizing Springboot.",
"keywords": [
"java",
"minecraft",
"json",
"rest-api",
"restful",
"bedrock",
"springboot"
],
"homepage": "https://github.com/Rainnny7/RESTfulMC",
"repository": {
"type": "git",
"url": "git+https://github.com/Rainnny7/RESTfulMC.git"
},
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "bun run build.mjs",
"prepublishOnly": "bun run build"
},
"files": [
"dist"
],
"devDependencies": {
"@types/bun": "latest",
"bun-plugin-dts": "^0.2.2"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"axios": "^1.6.8"
}
}

1
Lib/src/index.d.ts vendored Normal file

@ -0,0 +1 @@
export * from "./types/player";

1
Lib/src/index.ts Normal file

@ -0,0 +1 @@
export * from "./lib/restfulmc";

21
Lib/src/lib/restfulmc.ts Normal file

@ -0,0 +1,21 @@
import type { Player } from "../types/player";
/**
* Get a player by their username or UUID.
*
* @param query the query to search for the player by
* @returns the promised player
*/
export const getPlayer = (query: string): Promise<Player> => {
return new Promise((resolve, reject) => {
resolve({
uniqueId: "fc1d5fe7-f29b-430d-80bb-3b093a638b0f",
username: "Rainnny",
skin: {
url: "",
model: "default",
legacy: false,
},
});
});
};

41
Lib/src/types/player.d.ts vendored Normal file

@ -0,0 +1,41 @@
export type Player = {
/**
* The unique id of this player.
*/
uniqueId: string;
/**
* The username of this player.
*/
username: string;
/**
* The skin of this player.
*/
skin: Skin;
}
/**
* A skin for a {@link Player}.
*/
type Skin = {
/**
* The texture URL of this skin.
*/
url: string;
/**
* The model of this skin.
*/
model: Model;
/**
* Is this skin legacy?
*/
legacy: boolean;
}
/**
* Possible models for a skin.
*/
type Model = "default" | "slim";

16
Lib/tsconfig.json Normal file

@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es2020",
"module": "esnext",
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"skipLibCheck": true,
"noUnusedLocals": true,
"noImplicitAny": true,
"allowJs": true,
"noEmit": true,
"outDir": "dist",
"resolveJsonModule": true
}
}