Skip to content
3 changes: 2 additions & 1 deletion scripts/fetch-schema.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'node:url'

const SCHEMA_URL = 'https://esi.evetech.net/meta/openapi.json'
const __dirname = path.dirname(new URL(import.meta.url).pathname)
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const SCHEMA_FILE = path.join(__dirname, './static/openapi.json')

async function fetchSchema(): Promise<void> {
Expand Down
7 changes: 4 additions & 3 deletions scripts/generate-readme.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import fs from 'fs'
import path from 'path'
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const __dirname = path.dirname(new URL(import.meta.url).pathname)
const __dirname = path.dirname(fileURLToPath(import.meta.url))

export interface MethodInfo {
name: string
Expand Down
9 changes: 5 additions & 4 deletions scripts/generate.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
import camelcase from 'camelcase'
import assert from 'assert'
import { generateReadme, type MethodInfo } from './generate-readme.ts'

const __dirname = path.dirname(new URL(import.meta.url).pathname)
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const SCHEMA_FILE = path.join(__dirname, './static/openapi.json')
const TYPES_FILE = path.join(__dirname, '../src/types.ts')
const CLIENT_FILE = path.join(__dirname, '../src/client.ts')
Expand Down Expand Up @@ -92,7 +93,7 @@ interface ResponseHeader {
}

function loadSchema(): OpenAPISchema {
console.log('Loading OpenAPI schema from local file...')
console.log('Loading OpenAPI schema from ' + SCHEMA_FILE + '...')

if (!fs.existsSync(SCHEMA_FILE)) {
console.error('Schema file not found. Run "yarn fetch-schema" first.')
Expand Down Expand Up @@ -361,7 +362,7 @@ function getTypeScriptType(schema: Schema): string {
return 'boolean'
case 'array':
assert(schema.items)
return `${getTypeScriptType(schema.items)}[]`
return `(${getTypeScriptType(schema.items)})[]`
case 'object':
if (schema.properties) {
const props = Object.entries(schema.properties)
Expand Down Expand Up @@ -501,7 +502,7 @@ function generateClient(schema: OpenAPISchema): {

let client = `// Auto-generated API client for EVE ESI API
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as Types from './types';
import * as Types from './types.js';

const COMPATIBILITY_DATE = '${new Date().toISOString().slice(0, 10)}';

Expand Down
4 changes: 2 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Auto-generated API client for EVE ESI API
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as Types from './types'
import * as Types from './types.js'

const COMPATIBILITY_DATE = '2026-01-27'
const COMPATIBILITY_DATE = '2026-02-03'

export class EsiClient {
private readonly baseUrl: string = 'https://esi.evetech.net'
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { EsiClient } from './client'
export * from './types'
export { EsiClient } from './client.js'
export * from './types.js'
Loading
Loading