From 8d263000277c7c996e43c5f75e2bfcc1951ffcc8 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 27 Mar 2022 12:06:11 -0500 Subject: [PATCH] don't generate module code --- package.json | 3 +-- test/index.js | 66 ++++++++++++++++++++++++++------------------------- tsconfig.json | 2 +- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index 7ba1784..032e69a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typed-hypixel-api", - "version": "0.3.1", + "version": "0.3.2", "main": "build/index.js", "types": "build/index.d.js", "repository": "https://github.com/skyblockstats/typed-hypixel-api.git", @@ -17,7 +17,6 @@ "typescript": "^4.6.3", "undici": "^4.16.0" }, - "type": "module", "devDependencies": { "dotenv": "^16.0.0" } diff --git a/test/index.js b/test/index.js index d612f1e..c1731f3 100644 --- a/test/index.js +++ b/test/index.js @@ -1,12 +1,12 @@ -import util from 'util' -import { promises as fs } from 'fs' -import { request } from '../build/index.js' +const util = require('util') +const { promises: fs } = require('fs') +const { request } = require('../build/index.js') -const exec = util.promisify((await import('child_process')).exec) +const exec = util.promisify(require('child_process').exec) if (!process.env.API_KEY) // if there's no hypixel keys in env, run dotenv - (await import('dotenv')).config() + require('dotenv').config() if (!process.env.API_KEY) throw new Error('No API key found in env') @@ -29,30 +29,32 @@ async function testData(typeName, data) { } } -console.log('ok doing tsc') - -await testData('SkyBlockProfilesResponse', await request('skyblock/profiles', { - uuid: '26398ec782e5440cbcbb94c58b8b60a2', - key: process.env.API_KEY -}, true)) -await testData('SkyBlockProfilesResponse', await request('skyblock/profiles', { - uuid: '16751f79c0b14e53a0b590d31fc1d80d', - key: process.env.API_KEY -}, true)) -await testData('SkyBlockProfilesResponse', await request('skyblock/profiles', { - uuid: '974b2a9e0d6d41819dd18a05fb228965', - key: process.env.API_KEY -}, true)) - -await testData('SkyBlockProfileResponse', await request('skyblock/profile', { - profile: '64722047f9b34e69b67b76a62351eb05', - key: process.env.API_KEY -}, true)) - -await testData('PlayerDataResponse', await request('player', { - uuid: '16751f79c0b14e53a0b590d31fc1d80d', - key: process.env.API_KEY -}, true)) - -console.log('Passed :)') - +console.log('ok doing tsc'); + +(async () => { + await testData('SkyBlockProfilesResponse', await request('skyblock/profiles', { + uuid: '26398ec782e5440cbcbb94c58b8b60a2', + key: process.env.API_KEY + }, true)) + await testData('SkyBlockProfilesResponse', await request('skyblock/profiles', { + uuid: '16751f79c0b14e53a0b590d31fc1d80d', + key: process.env.API_KEY + }, true)) + await testData('SkyBlockProfilesResponse', await request('skyblock/profiles', { + uuid: '974b2a9e0d6d41819dd18a05fb228965', + key: process.env.API_KEY + }, true)) + + await testData('SkyBlockProfileResponse', await request('skyblock/profile', { + profile: '64722047f9b34e69b67b76a62351eb05', + key: process.env.API_KEY + }, true)) + + await testData('PlayerDataResponse', await request('player', { + uuid: '16751f79c0b14e53a0b590d31fc1d80d', + key: process.env.API_KEY + }, true)) + + console.log('Passed :)') + +})() diff --git a/tsconfig.json b/tsconfig.json index 78f0367..940f48c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,7 +24,7 @@ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ /* Modules */ - "module": "esnext", /* Specify what module code is generated. */ + "module": "CommonJS", /* Specify what module code is generated. */ // "rootDir": "./", /* Specify the root folder within your source files. */ "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */