Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Commit

Permalink
don't generate module code
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-1 committed Mar 27, 2022
1 parent 21f2e0a commit 8d26300
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 35 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -17,7 +17,6 @@
"typescript": "^4.6.3",
"undici": "^4.16.0"
},
"type": "module",
"devDependencies": {
"dotenv": "^16.0.0"
}
Expand Down
66 changes: 34 additions & 32 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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 :)')

})()
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 8d26300

Please sign in to comment.