diff --git a/package-lock.json b/package-lock.json index 32db5fe..c97ea25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "namemcwrapper", - "version": "1.8.7", + "version": "1.8.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "namemcwrapper", - "version": "1.8.7", + "version": "1.8.8", "license": "MIT", "dependencies": { "axios": "^0.21.1", diff --git a/package.json b/package.json index 27a354d..d6e343a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "namemcwrapper", - "version": "1.8.7", + "version": "1.8.8", "description": "ES6 Promise based wrapper for NameMC.com", "main": "./dist/NameMC.js", "exports": { @@ -16,7 +16,7 @@ "types": "./dist/interfaces.d.ts", "scripts": { "tsc": "tsc && node --experimental-modules --es-module-specifier-resolution=node ./scripts/removeEmptyFiles.mjs", - "build": "npm run-script tsc && babel build --out-dir dist --copy-files && node --experimental-modules --es-module-specifier-resolution=node ./scripts/fixImports.mjs", + "build": "npm run-script tsc && babel build --out-dir dist --copy-files", "pretest": "npm run-script build", "test": "mocha --reporter spec --timeout 180000", "eslint:check": "eslint ./src/**/*", diff --git a/scripts/fixImports.mjs b/scripts/fixImports.mjs deleted file mode 100644 index d3d58fc..0000000 --- a/scripts/fixImports.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import { promises as fs } from "fs"; - -const DIST_DIR = "./dist"; - -await fs.readdir(DIST_DIR) - .then((files) => { - files.forEach(async (file) => { - if (file.endsWith(".js")) { - const filePath = `${DIST_DIR}/${file}`; - - fs.readFile(filePath) - .then((file) => { - file = file.toString(); - - file = file.replace(/\.default/gm, "") - .replace(/mjs/gm, "js"); - - fs.writeFile(filePath, file); - }); - } - }) - }); - -await fs.rmdir("./build", { recursive: true }); diff --git a/src/DataParser.ts b/src/DataParser.ts index c0b3c68..d7aa2b7 100644 --- a/src/DataParser.ts +++ b/src/DataParser.ts @@ -1,4 +1,4 @@ -import cheerio from "cheerio"; +import * as cheerio from "cheerio"; import { WrapperError } from "./WrapperError"; diff --git a/src/NameMC.ts b/src/NameMC.ts index e6c89dc..f6c4eae 100644 --- a/src/NameMC.ts +++ b/src/NameMC.ts @@ -1,4 +1,4 @@ -import axios, { AxiosInstance, AxiosResponse } from "axios"; +import * as axios from "axios"; import { API } from "./API"; import { DataParser } from "./DataParser"; @@ -7,6 +7,8 @@ import { WrapperError } from "./WrapperError"; import { nameRegExp, profileRegExp, skinRegExp, capes, getUUID } from "./utils"; import { IRender, IOptions, ISkin, IExtendedSkin, ICape, ICapeInfo, Transformation, ITransformSkinOptions, ICheckServerLikeOptions, IFriend, IGetSkinsOptions, IServerPreview, IGetEndpointOptions, IPlayer, IGetSkinHistoryOptions, IGetRendersOptions, IServer, Tab, Section, Nickname, CapeHash, BasePlayerInfo, INamedSkin } from "./interfaces"; +import AxiosInstance = axios.AxiosInstance; +import AxiosResponse = axios.AxiosResponse; export class NameMC extends DataParser { @@ -36,6 +38,7 @@ export class NameMC extends DataParser { ...options }; + // @ts-ignore this.client = axios.create({ baseURL: this.getEndpoint() }); @@ -384,7 +387,7 @@ export class NameMC extends DataParser { protected getEndpoint({ subdomain = "", domain = "" }: IGetEndpointOptions = {}): string { const { proxy, endpoint, rendersIgnoreProxy }: IOptions = this.options; - return `${rendersIgnoreProxy && subdomain === "render" ? "" : `${proxy}/`}https://${subdomain ? `${subdomain}.` : ""}${domain || endpoint}`; + return `${rendersIgnoreProxy && subdomain === "render" ? "" : proxy ? `${proxy}/` : ""}https://${subdomain ? `${subdomain}.` : ""}${domain || endpoint}`; } }