Skip to content

Commit

Permalink
Improve imports
Browse files Browse the repository at this point in the history
  • Loading branch information
egorprnn committed Mar 29, 2021
1 parent 8076a89 commit 1e2e449
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 31 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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/**/*",
Expand Down
24 changes: 0 additions & 24 deletions scripts/fixImports.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion src/DataParser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cheerio from "cheerio";
import * as cheerio from "cheerio";

import { WrapperError } from "./WrapperError";

Expand Down
7 changes: 5 additions & 2 deletions src/NameMC.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosInstance, AxiosResponse } from "axios";
import * as axios from "axios";

import { API } from "./API";
import { DataParser } from "./DataParser";
Expand All @@ -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 {

Expand Down Expand Up @@ -36,6 +38,7 @@ export class NameMC extends DataParser {
...options
};

// @ts-ignore
this.client = axios.create({
baseURL: this.getEndpoint()
});
Expand Down Expand Up @@ -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}`;
}
}

Expand Down

0 comments on commit 1e2e449

Please sign in to comment.