From 5f038026d31c851986d27220c552e0b3323ad507 Mon Sep 17 00:00:00 2001 From: Jaron Date: Wed, 18 Dec 2024 13:32:15 -0600 Subject: [PATCH] Some build process stuff --- package.json | 8 ++++++-- src/services/connectors/gateway.ts | 1 - src/services/processor.ts | 1 + src/types/embed.ts | 4 ++-- src/types/message.ts | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index e7a1a27..9172700 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "discord.ts", + "version": "0.0.1", "module": "src/index.ts", "type": "module", "main": "out/index.js", @@ -7,8 +8,11 @@ "test": "bun run testing/demo.test.ts", "test:inspect": "bun --inspect testing/demo.test.ts", "build": "bun run build:types && bun build src/index.ts --outdir out", - "build:types": "tsc --emitDeclarationOnly --project tsconfig.json --noCheck", - "build:watch": "concurrently \"tsc --emitDeclarationOnly --project tsconfig.json --noCheck --watch\" \"bun build src/index.ts --outdir out --watch\"" + "build:packages": "bun run build:types && bun build src/index.ts --packages external --outdir out", + "build:nocheck": "bun run build:types:nocheck && bun build src/index.ts --outdir out --noCheck", + "build:types": "tsc --emitDeclarationOnly --project tsconfig.json", + "build:types:nocheck": "tsc --emitDeclarationOnly --project tsconfig.json --noCheck", + "build:watch": "concurrently \"tsc --emitDeclarationOnly --project tsconfig.json --watch\" \"bun build src/index.ts --outdir out --watch\"" }, "devDependencies": { "@types/bun": "latest", diff --git a/src/services/connectors/gateway.ts b/src/services/connectors/gateway.ts index a25a31b..8c7997f 100644 --- a/src/services/connectors/gateway.ts +++ b/src/services/connectors/gateway.ts @@ -8,7 +8,6 @@ import { Context } from '../../types/context'; import { type DiscordMessage, Message } from '../../types/message'; import { DiscordUser, User } from '../../types/user'; import { Guild } from '../../types/guild'; -import { Channel } from '../../types/channel'; import type { Emitter } from '../bus'; export class Gateway { diff --git a/src/services/processor.ts b/src/services/processor.ts index 65766c1..ba58212 100644 --- a/src/services/processor.ts +++ b/src/services/processor.ts @@ -66,6 +66,7 @@ export class Processor { await Promise.resolve(handler[Trait.execute](context!, resolvedArgs)); } else { // TODO: Fix ts error + // @ts-ignore - Haven't figured out how to type narrow this yet await Promise.resolve(handler(context, argsOrPayload)); } } diff --git a/src/types/embed.ts b/src/types/embed.ts index 5d33d65..e771c25 100644 --- a/src/types/embed.ts +++ b/src/types/embed.ts @@ -1,4 +1,4 @@ -import type { Message } from './message'; +import { Message } from './message'; type EmbedFooter = { text: string; @@ -42,7 +42,7 @@ export class Embed { author?: EmbedImage & { name?: string; }; - fields?: EmbedField[]; + fields: EmbedField[]; constructor() { this.fields = []; diff --git a/src/types/message.ts b/src/types/message.ts index 5958890..878bb97 100644 --- a/src/types/message.ts +++ b/src/types/message.ts @@ -1,9 +1,9 @@ import { exists, isNil } from '../utils'; import { GatewayObject } from './base'; import { fromDiscord, Trait, type Expectation, type Expects } from './common'; -import { Embed } from './embed'; +import type { Embed } from './embed'; import type { Guild } from './guild'; -import { DiscordUser, User } from './user'; +import { type DiscordUser, User } from './user'; export type Component = Partial