diff --git a/.changeset/README.md b/.changeset/README.md index 3e2b26f7..3121de30 100644 --- a/.changeset/README.md +++ b/.changeset/README.md @@ -12,5 +12,5 @@ We have a quick list of common questions to get you started engaging with this p The release steps follows this: - "bun run prerelease" -- "bun install -r" +- "bun install" - "bun run publish" diff --git a/.changeset/config.json b/.changeset/config.json index cd11835c..294b24a0 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,5 +1,5 @@ { - "$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json", + "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", "changelog": "@changesets/cli/changelog", "commit": false, "fixed": [], diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6b599330..e4f612c9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -9,7 +9,7 @@ If you wish to contribute to the codebase or documentation, feel free to fork th To get ready to work on the codebase, please do the following: - Fork & clone the repository, and make sure you're on the main branch -- Run bun install -r +- Run bun install - Code your heart out! - Run bun run test to run Biome and ensure any JSDoc changes are valid - Submit a pull request (Make sure you follow the conventional commit format) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6545b42c..dc36a5d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1 - name: Install dependencies diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 29c05f15..af132f2f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,32 +8,28 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.API_TOKEN_GITHUB }} - - name: Install PNPM - uses: pnpm/action-setup@6e1964dde3397a825e79e4607ad57f3f7ca2c7cb - with: - version: 8.6.3 - - name: Set up Node v18 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: "18" - registry-url: " https://registry.npmjs.org" + + - uses: oven-sh/setup-bun@v1 - name: Install dependencies - run: pnpm install -r + run: bun install - name: Install turbo globally - run: pnpm install -g turbo + run: bun install -g turbo - name: Build packages - run: mv bun.lockb bun.inert && pnpm turbo run build ; mv bun.inert bun.lockb + run: bun turbo run build - name: Apply version changes to packages - run: pnpm run changeset:version + run: bun run changeset:version - name: Commit package.json changes uses: EndBug/add-and-commit@v9 @@ -44,7 +40,7 @@ jobs: push: true - name: Release - run: pnpm recursive publish + run: bun publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 926730d4..a7ab7a98 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1 - name: Install dependencies diff --git a/.husky/pre-commit b/.husky/pre-commit index 86625e2c..4dfead07 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -bun run check:fix \ No newline at end of file +bun test diff --git a/README.md b/README.md index 941cdece..21f172dc 100644 --- a/README.md +++ b/README.md @@ -73,9 +73,9 @@ client.login(); Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. -We make use of [PNPM](https://pnpm.io/) and [Changeset](https://github.com/changesets/changesets) to manage our monorepo. It's recommended that if you plan on contributing, you use these tools. +We make use of [Bun](https://bun.sh/) and [Changeset](https://github.com/changesets/changesets) to manage our monorepo. It's recommended that if you plan on contributing, you use these tools. -Please run `pnpm install -r` in your local environment to properly locally symlink all the packages that depend on each other. +Please run `bun install` in your local environment to properly locally symlink all the packages that depend on each other. Please ensure your commits pass the test, lint, and build scripts. diff --git a/apps/docs/package.json b/apps/docs/package.json index 8c65f58a..7ba15724 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -1,30 +1,37 @@ { - "name": "@guildedjs/docs", - "version": "0.1.0", - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start" - }, - "devDependencies": { - "@types/node": "18.16.12", - "@types/react": "18.2.6", - "@types/react-dom": "18.2.4", - "autoprefixer": "^10.4.14", - "postcss": "^8.4.23", - "tailwindcss": "^3.3.2", - "typedoc": "0.23.24", - "typescript": "5.0.4" - }, - "dependencies": { - "@fortawesome/fontawesome-svg-core": "^6.4.0", - "@fortawesome/free-solid-svg-icons": "^6.4.0", - "@fortawesome/react-fontawesome": "^0.2.0", - "@next/font": "^13.4.2", - "next": "13.4.2", - "react": "18.2.0", - "react-code-blocks": "0.0.9-0", - "react-dom": "18.2.0" - } + "name": "@guildedjs/docs", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start" + }, + "devDependencies": { + "@types/node": "18.19.33", + "@types/react": "18.3.1", + "@types/react-dom": "18.3.0", + "autoprefixer": "^10.4.14", + "postcss": "^8.4.23", + "tailwindcss": "^3.3.2", + "typedoc": "0.25.13", + "typescript": "5.4.5" + }, + "dependencies": { + "@fortawesome/fontawesome-svg-core": "^6.4.0", + "@fortawesome/free-solid-svg-icons": "^6.4.0", + "@fortawesome/react-fontawesome": "^0.2.0", + "next": "14.2.3", + "react": "18.3.1", + "react-code-blocks": "0.1.6", + "react-dom": "18.3.1" + }, + "trustedDependencies": [ + "@biomejs/biome", + "@fortawesome/fontawesome-common-types", + "@fortawesome/fontawesome-svg-core", + "@fortawesome/free-solid-svg-icons", + "core-js", + "es5-ext" + ] } \ No newline at end of file diff --git a/apps/docs/src/components/Footer.tsx b/apps/docs/src/components/Footer.tsx index b6ab85af..a1670bf4 100644 --- a/apps/docs/src/components/Footer.tsx +++ b/apps/docs/src/components/Footer.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import type React from "react"; const HoverableLink = ({ link, children }: { children: React.ReactNode[] | React.ReactNode; link: string }) => ( diff --git a/apps/docs/src/components/LayoutWrapper.tsx b/apps/docs/src/components/LayoutWrapper.tsx index 4d0e5c18..744c0d7e 100644 --- a/apps/docs/src/components/LayoutWrapper.tsx +++ b/apps/docs/src/components/LayoutWrapper.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import type React from "react"; import { Breadcrumb } from "./Breadcrumb"; import { Footer } from "./Footer"; import { Navbar } from "./Navbar"; diff --git a/apps/docs/src/components/Navbar.tsx b/apps/docs/src/components/Navbar.tsx index 72739b7b..7f6c1aac 100644 --- a/apps/docs/src/components/Navbar.tsx +++ b/apps/docs/src/components/Navbar.tsx @@ -3,7 +3,7 @@ import { useState } from "react"; const topBars = { Docs: "/docs", - Guide: "/guide", + Guide: "https://guilded-js.gitbook.io/api-docs", Github: "https://github.com/zaida04/guilded.js", "Support Server": "https://guilded.gg/guildedjs", "Legacy Docs": "https://guildedjs.github.io/", diff --git a/apps/docs/src/pages/_app.tsx b/apps/docs/src/pages/_app.tsx index 94846a88..a36ea736 100644 --- a/apps/docs/src/pages/_app.tsx +++ b/apps/docs/src/pages/_app.tsx @@ -1,6 +1,6 @@ import "@fortawesome/fontawesome-svg-core/styles.css"; -import localFont from "@next/font/local"; import type { AppProps } from "next/app"; +import localFont from "next/font/local"; import "../styles/globals.css"; const Mono = localFont({ diff --git a/apps/docs/src/pages/index.tsx b/apps/docs/src/pages/index.tsx index 134ceeb6..60affb31 100644 --- a/apps/docs/src/pages/index.tsx +++ b/apps/docs/src/pages/index.tsx @@ -55,7 +55,7 @@ export default function Home({ buildDate }: InferGetStaticPropsType
- {["npm install guilded.js", "yarn add guilded.js", "pnpm add guilded.js"].map((click) => ( + {["npm install guilded.js", "yarn add guilded.js", "pnpm add guilded.js", "bun add guilded.js"].map((click) => ( ))}
diff --git a/biome.json b/biome.json index 7d5f322b..3760c542 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.4.1/schema.json", + "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", "organizeImports": { "enabled": true }, diff --git a/bun.lockb b/bun.lockb index a072fa30..3c84ef2c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index a1313e45..18b1f0e9 100644 --- a/package.json +++ b/package.json @@ -7,27 +7,27 @@ "scripts": { "build": "turbo run build", "build:typecheck": "turbo run build:typecheck", - "check": "biome check apps packages services", - "check:fix": "biome check --apply-unsafe apps packages services", + "check": "biome check apps packages", + "check:fix": "biome check --apply-unsafe apps packages", "changeset": "changeset", "changeset:version": "changeset version", "docs": "typedoc && cd docs && find . -type f -name \"*.html\" -exec sed -i'' -e 's/__namedParameters/options/g' {} +", "prepublishOnly": "turbo run prepublishOnly", - "prepare": "husky install" + "prepare": "husky init" }, "devDependencies": { - "@biomejs/biome": "1.5.2", + "@biomejs/biome": "1.7.3", "@changesets/cli": "^2.26.1", - "@types/node": "18.16.12", - "dotenv": "16.0.3", + "@types/node": "18.19.33", + "dotenv": "16.4.5", "gen-esm-wrapper": "1.1.3", - "husky": "7.0.4", - "lint-staged": "13.2.2", - "nodemon": "^2.0.22", - "rimraf": "5.0.1", + "husky": "9.0.11", + "lint-staged": "15.2.2", + "nodemon": "^3.1.0", + "rimraf": "5.0.6", "turbo": "^1.11.2", - "typedoc": "0.24.7", - "typescript": "5.0.4" + "typedoc": "0.25.13", + "typescript": "5.4.5" }, "contributors": [ { @@ -54,5 +54,8 @@ "workspaces": [ "packages/*", "apps/*" + ], + "trustedDependencies": [ + "better-sqlite3" ] -} \ No newline at end of file +} diff --git a/packages/api/lib/rest/util/message.ts b/packages/api/lib/rest/util/message.ts index f6b12a74..a76cbc9f 100644 --- a/packages/api/lib/rest/util/message.ts +++ b/packages/api/lib/rest/util/message.ts @@ -78,7 +78,7 @@ export function parseMessage(data: APIContent): parsedMessage { x.data as { embeds: APIEmbed[]; } - ).embeds.length > 0 + ).embeds.length > 0 : true, ); diff --git a/packages/api/lib/rest/webhook/WebhookClient.ts b/packages/api/lib/rest/webhook/WebhookClient.ts index 416af898..fbfd2550 100644 --- a/packages/api/lib/rest/webhook/WebhookClient.ts +++ b/packages/api/lib/rest/webhook/WebhookClient.ts @@ -78,13 +78,13 @@ export class WebhookClient { ? { ...content, embeds: resEmbeds, - } + } : { content, embeds: resEmbeds, username: options?.username ?? this.username ?? undefined, avatar_url: options?.avatarURL ?? this.avatarURL ?? undefined, - }; + }; let body: FormData | RESTPostWebhookBody = baseBody; const formData = new FormData(); diff --git a/packages/api/lib/rest/webhook/WebhookEmbed.ts b/packages/api/lib/rest/webhook/WebhookEmbed.ts index 6365d49e..4e47095f 100644 --- a/packages/api/lib/rest/webhook/WebhookEmbed.ts +++ b/packages/api/lib/rest/webhook/WebhookEmbed.ts @@ -160,7 +160,7 @@ export class WebhookEmbed { iconURL: iconURL ?? null, proxyIconURL: proxyIconURL ?? null, text, - } + } : null; return this; } @@ -172,7 +172,7 @@ export class WebhookEmbed { proxyURL: proxyURL ?? null, url, width: width ?? null, - } + } : null; return this; } @@ -184,7 +184,7 @@ export class WebhookEmbed { proxyURL: proxyURL ?? null, url, width: width ?? null, - } + } : null; return this; } @@ -196,7 +196,7 @@ export class WebhookEmbed { proxyURL: proxyURL ?? null, url, width: width ?? null, - } + } : null; return this; } @@ -207,7 +207,7 @@ export class WebhookEmbed { ? { name: name ?? null, url: url ?? null, - } + } : null; return this; } @@ -219,7 +219,7 @@ export class WebhookEmbed { name: name ?? null, proxyIconURL: proxyIconURL ?? null, url: url ?? null, - } + } : null; return this; } @@ -265,7 +265,7 @@ export class WebhookEmbed { name: this.author.name, proxy_icon_url: this.author.proxyIconURL ?? undefined, url: this.author.url ?? undefined, - } + } : undefined, color: this.color ?? undefined, description: this.description ?? undefined, @@ -280,7 +280,7 @@ export class WebhookEmbed { icon_url: this.footer.iconURL ?? undefined, proxy_icon_url: this.footer.proxyIconURL ?? undefined, text: this.footer.text ?? undefined, - } + } : undefined, image: this.image ? { @@ -288,13 +288,13 @@ export class WebhookEmbed { proxy_url: this.image.proxyURL ?? undefined, url: this.image.url ?? undefined, width: this.image.width ?? undefined, - } + } : undefined, provider: this.provider ? { name: this.provider.name ?? undefined, url: this.provider.url ?? undefined, - } + } : undefined, thumbnail: this.thumbnail ? { @@ -302,7 +302,7 @@ export class WebhookEmbed { proxy_url: this.thumbnail.proxyURL ?? undefined, url: this.thumbnail.url ?? undefined, width: this.thumbnail.width ?? undefined, - } + } : undefined, timestamp: this.timestampString ?? undefined, title: this.title ?? undefined, @@ -313,7 +313,7 @@ export class WebhookEmbed { proxy_url: this.video.proxyURL ?? undefined, url: this.video.url ?? undefined, width: this.video.width ?? undefined, - } + } : undefined, }; } diff --git a/packages/api/package.json b/packages/api/package.json index b328a4ec..67821d3f 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -9,32 +9,31 @@ "scripts": { "build": "tsc && gen-esm-wrapper . ./dist/index.mjs", "build:typecheck": "tsc --noEmit", - "prepublishOnly": "rimraf dist/ && rimraf types/ && pnpm run build", + "prepublishOnly": "rimraf dist/ && rimraf types/ && bun run build", "release": "npm publish", "router:preserve": "ts-node scripts/pre-gen-router.ts", "router:restore": "ts-node scripts/post-gen-router.ts", "generate:ws": "openapi-typescript \"https://www.guilded.gg/api/v1/socket-open-api-schema.json\" --output lib/generated/api-typings/v1/ws.ts", - "generate:long:router": "pnpx openapi-typescript-codegen --input \"https://www.guilded.gg/api/v1/open-api-schema.json\" --output lib/generated/router --name GuildedRouter --useOptions --postfixModels Payload --useUnionTypes", + "generate:long:router": "pnpx @hey-api/openapi-ts --input \"https://www.guilded.gg/api/v1/open-api-schema.json\" --output lib/generated/router --name GuildedRouter --useOptions --postfixModels Payload --useUnionTypes", "generate:router": "bun run router:preserve && bun run generate:long:router && biome check --apply-unsafe lib/generated/router/**/*.ts && pnpm router:restore" }, "devDependencies": { "@types/fs-extra": "^11.0.1", - "@types/node-fetch": "2.6.4", + "@types/node-fetch": "2.6.11", "@types/qs": "^6.9.7", - "@types/ws": "8.5.4", + "@types/ws": "8.5.10", "fs-extra": "^11.1.1", "openapi-typescript": "^6.2.4", - "openapi-typescript-codegen": "^0.24.0", - "ts-node": "10.9.1", - "typescript": "5.0.4" + "@hey-api/openapi-ts": "^0.43.2", + "ts-node": "10.9.2", + "typescript": "5.4.5" }, "dependencies": { - "@types/ws": "8.5.4", "form-data": "^4.0.0", - "node-fetch": "2.6.11", + "node-fetch": "2.6.13", "qs": "^6.11.2", "typed-emitter": "2.1.0", - "ws": "8.13.0" + "ws": "8.17.0" }, "contributors": [ { diff --git a/packages/create-guilded-app/package.json b/packages/create-guilded-app/package.json index 284ce354..c8a733c8 100644 --- a/packages/create-guilded-app/package.json +++ b/packages/create-guilded-app/package.json @@ -12,12 +12,12 @@ "scripts": { "build": "tsc", "build:typecheck": "tsc --noEmit", - "prepublishOnly": "rimraf dist/ && rimraf types/ && pnpm run build", + "prepublishOnly": "rimraf dist/ && rimraf types/ && bun run build", "release": "npm publish" }, "devDependencies": { - "@types/node": "18.16.12", - "typescript": "5.0.4" + "@types/node": "18.19.33", + "typescript": "5.4.5" }, "dependencies": { "create-create-app": "^7.3.0" diff --git a/packages/create-guilded-app/templates/bot-starter-js/package.json b/packages/create-guilded-app/templates/bot-starter-js/package.json index ff4b5600..1b1d38e8 100644 --- a/packages/create-guilded-app/templates/bot-starter-js/package.json +++ b/packages/create-guilded-app/templates/bot-starter-js/package.json @@ -9,8 +9,8 @@ "start": "node src/index.js" }, "dependencies": { - "dotenv": "^16.0.3", - "guilded.js": "0.22.2" + "dotenv": "^16.4.5", + "guilded.js": "0.24.2" }, "repository": "https://github.com/guildedjs/guilded.js" } diff --git a/packages/create-guilded-app/templates/command-handler-starter-js/package.json b/packages/create-guilded-app/templates/command-handler-starter-js/package.json index e9277f50..0f460817 100644 --- a/packages/create-guilded-app/templates/command-handler-starter-js/package.json +++ b/packages/create-guilded-app/templates/command-handler-starter-js/package.json @@ -9,9 +9,9 @@ "start": "node src/index.js" }, "dependencies": { - "@discordjs/collection": "^1.5.1", - "dotenv": "^16.0.3", - "guilded.js": "0.22.2" + "@discordjs/collection": "^2.1.0", + "dotenv": "^16.4.5", + "guilded.js": "0.24.2" }, "repository": "https://github.com/guildedjs/guilded.js" } diff --git a/packages/create-guilded-app/templates/command-handler-starter-js/src/index.js b/packages/create-guilded-app/templates/command-handler-starter-js/src/index.js index e848e1d6..43bf50ca 100644 --- a/packages/create-guilded-app/templates/command-handler-starter-js/src/index.js +++ b/packages/create-guilded-app/templates/command-handler-starter-js/src/index.js @@ -2,8 +2,8 @@ require("dotenv/config"); if (!process.env.TOKEN) throw new Error("Please supply a Guilded API token in your .env file."); const { Collection } = require("@discordjs/collection"); -const { readdir } = require("fs/promises"); -const { join } = require("path"); +const { readdir } = require("node:fs/promises"); +const { join } = require("node:path"); const { Client } = require("guilded.js"); const client = new Client({ token: process.env.TOKEN }); diff --git a/packages/gil/__tests__/bot_mongo/db/Server.ts b/packages/gil/__tests__/bot_mongo/db/Server.ts index 05efdc46..461299ce 100644 --- a/packages/gil/__tests__/bot_mongo/db/Server.ts +++ b/packages/gil/__tests__/bot_mongo/db/Server.ts @@ -1,4 +1,4 @@ -import mongoose, { Schema, Document } from "mongoose"; +import mongoose, { Schema, type Document } from "mongoose"; // This is for typescript export interface IServer extends Document { diff --git a/packages/gil/__tests__/bot_mongo/index.ts b/packages/gil/__tests__/bot_mongo/index.ts index b0bcd55b..95a85d10 100644 --- a/packages/gil/__tests__/bot_mongo/index.ts +++ b/packages/gil/__tests__/bot_mongo/index.ts @@ -1,4 +1,4 @@ -import { join } from "path"; +import { join } from "node:path"; import "dotenv/config"; import { GilClient } from "../../lib/GilClient"; import { MongoAdapter } from "../../lib/adapters/db/MongoAdapter"; diff --git a/packages/gil/__tests__/bot_postgres/index.ts b/packages/gil/__tests__/bot_postgres/index.ts index 1ff88b6d..7ddc547c 100644 --- a/packages/gil/__tests__/bot_postgres/index.ts +++ b/packages/gil/__tests__/bot_postgres/index.ts @@ -1,4 +1,4 @@ -import { join } from "path"; +import { join } from "node:path"; import "dotenv/config"; import { GilClient } from "../../lib/GilClient"; diff --git a/packages/gil/__tests__/bot_sqlite/index.ts b/packages/gil/__tests__/bot_sqlite/index.ts index 7911871f..ff4dccf8 100644 --- a/packages/gil/__tests__/bot_sqlite/index.ts +++ b/packages/gil/__tests__/bot_sqlite/index.ts @@ -1,4 +1,4 @@ -import { join } from "path"; +import { join } from "node:path"; import "dotenv/config"; import { GilClient } from "../../lib/GilClient"; import { BetterSQLite3Adapter } from "../../lib/adapters/db/BetterSQLite3Adapter"; diff --git a/packages/gil/__tests__/shared/commands/Help.ts b/packages/gil/__tests__/shared/commands/Help.ts index 9d435634..5a3388ef 100644 --- a/packages/gil/__tests__/shared/commands/Help.ts +++ b/packages/gil/__tests__/shared/commands/Help.ts @@ -1,4 +1,4 @@ -import { Command, CommandExecuteContext, CommandOptions, GilClient } from "../../../lib"; +import { Command, type CommandExecuteContext, type CommandOptions, GilClient } from "../../../lib"; export default class Help extends Command { options = { diff --git a/packages/gil/__tests__/shared/commands/Ping.ts b/packages/gil/__tests__/shared/commands/Ping.ts index eba18842..aad9efbf 100644 --- a/packages/gil/__tests__/shared/commands/Ping.ts +++ b/packages/gil/__tests__/shared/commands/Ping.ts @@ -1,4 +1,4 @@ -import { Command, CommandOptions, StoredRoleType } from "../../../lib"; +import { Command, type CommandOptions, StoredRoleType } from "../../../lib"; export default class Ping extends Command { options = { diff --git a/packages/gil/lib/GilClient.ts b/packages/gil/lib/GilClient.ts index 59bf66d3..63c33abb 100644 --- a/packages/gil/lib/GilClient.ts +++ b/packages/gil/lib/GilClient.ts @@ -1,15 +1,15 @@ import EventEmitter from "node:events"; -import { Client, ClientOptions, Message } from "guilded.js"; -import TypedEmitter from "typed-emitter"; -import { DatabaseAdapter } from "./adapters/db/DatabaseAdapter"; +import { Client, type ClientOptions, type Message } from "guilded.js"; +import type TypedEmitter from "typed-emitter"; +import type { DatabaseAdapter } from "./adapters/db/DatabaseAdapter"; import { ConsoleAdapter } from "./adapters/logging/ConsoleAdapter"; -import { LoggerAdapter } from "./adapters/logging/LoggerAdapter"; -import { GilEvents } from "./events"; +import type { LoggerAdapter } from "./adapters/logging/LoggerAdapter"; +import type { GilEvents } from "./events"; import { CommandManager } from "./structures/Command"; import { ListenerManager } from "./structures/ListenerManager"; -import { DefaultResponseParams, defaultResponses } from "./structures/Responses"; +import { type DefaultResponseParams, defaultResponses } from "./structures/Responses"; import { TaskManager } from "./structures/Task"; -import { CommandCustomContextFn, CommandErrorHandler } from "./types"; +import type { CommandCustomContextFn, CommandErrorHandler } from "./types"; interface GilClientOptions { token: string; diff --git a/packages/gil/lib/adapters/db/BetterSQLite3Adapter.ts b/packages/gil/lib/adapters/db/BetterSQLite3Adapter.ts index 8f43e2d0..7304b7cc 100644 --- a/packages/gil/lib/adapters/db/BetterSQLite3Adapter.ts +++ b/packages/gil/lib/adapters/db/BetterSQLite3Adapter.ts @@ -1,5 +1,5 @@ -import sqlite from "better-sqlite3"; -import { DatabaseAdapter, StoredRole, StoredServer } from "./DatabaseAdapter"; +import type sqlite from "better-sqlite3"; +import { DatabaseAdapter, type StoredRole, type StoredServer } from "./DatabaseAdapter"; export class BetterSQLite3Adapter extends DatabaseAdapter { public constructor( diff --git a/packages/gil/lib/adapters/db/MongoAdapter.ts b/packages/gil/lib/adapters/db/MongoAdapter.ts index 786b2fbd..d99bce86 100644 --- a/packages/gil/lib/adapters/db/MongoAdapter.ts +++ b/packages/gil/lib/adapters/db/MongoAdapter.ts @@ -1,5 +1,5 @@ import type mongoose from "mongoose"; -import { DatabaseAdapter, StoredRole, StoredServer } from "./DatabaseAdapter"; +import { DatabaseAdapter, type StoredRole, type StoredServer } from "./DatabaseAdapter"; export class MongoAdapter extends DatabaseAdapter { public constructor( diff --git a/packages/gil/lib/adapters/db/PostgresAdapter.ts b/packages/gil/lib/adapters/db/PostgresAdapter.ts index 0f839fea..8f48ab0d 100644 --- a/packages/gil/lib/adapters/db/PostgresAdapter.ts +++ b/packages/gil/lib/adapters/db/PostgresAdapter.ts @@ -1,5 +1,5 @@ -import postgres from "postgres"; -import { DatabaseAdapter, StoredRole, StoredServer } from "./DatabaseAdapter"; +import type postgres from "postgres"; +import { DatabaseAdapter, type StoredRole, type StoredServer } from "./DatabaseAdapter"; export class PostgresAdapter extends DatabaseAdapter { private pg: postgres.Sql; diff --git a/packages/gil/lib/arguments/ArgumentParser.ts b/packages/gil/lib/arguments/ArgumentParser.ts index 4938ff7c..b566ddc2 100644 --- a/packages/gil/lib/arguments/ArgumentParser.ts +++ b/packages/gil/lib/arguments/ArgumentParser.ts @@ -1,5 +1,5 @@ import type { Channel, Message, PartialMember, Role } from "guilded.js"; -import { Command } from "../structures/Command"; +import type { Command } from "../structures/Command"; import boolean from "./args/boolean"; import channel from "./args/channel"; diff --git a/packages/gil/lib/arguments/args/member.ts b/packages/gil/lib/arguments/args/member.ts index 65d15bf0..4341f293 100644 --- a/packages/gil/lib/arguments/args/member.ts +++ b/packages/gil/lib/arguments/args/member.ts @@ -1,4 +1,4 @@ -import { Member, PartialMember } from "guilded.js"; +import { type Member, PartialMember } from "guilded.js"; import { isHashId } from "../../utils/uuid"; import type { CommandArgumentValidator } from "../ArgumentParser"; diff --git a/packages/gil/lib/events.ts b/packages/gil/lib/events.ts index 490e6fa6..fb997082 100644 --- a/packages/gil/lib/events.ts +++ b/packages/gil/lib/events.ts @@ -1,6 +1,6 @@ -import { Member, Message } from "guilded.js"; -import { StoredServer } from "./adapters/db/DatabaseAdapter"; -import { Command } from "./structures/Command"; +import type { Member, Message } from "guilded.js"; +import type { StoredServer } from "./adapters/db/DatabaseAdapter"; +import type { Command } from "./structures/Command"; export interface NonCommandMessageParams { message: Message; diff --git a/packages/gil/lib/listeners/CommandMessageListener.ts b/packages/gil/lib/listeners/CommandMessageListener.ts index 651d648b..cac8d037 100644 --- a/packages/gil/lib/listeners/CommandMessageListener.ts +++ b/packages/gil/lib/listeners/CommandMessageListener.ts @@ -1,9 +1,9 @@ import * as lexure from "lexure"; -import { GilClient } from "../GilClient"; -import { StoredRole, StoredRoleType } from "../adapters/db/DatabaseAdapter"; +import type { GilClient } from "../GilClient"; +import { type StoredRole, StoredRoleType } from "../adapters/db/DatabaseAdapter"; import { convertArguments } from "../arguments/ArgumentParser"; -import { CommandMessageParams } from "../events"; -import { Listener, ListenerContext } from "../structures/Listener"; +import type { CommandMessageParams } from "../events"; +import { Listener, type ListenerContext } from "../structures/Listener"; export default class CommandMessageListener extends Listener { constructor(gil: GilClient) { @@ -86,7 +86,7 @@ export default class CommandMessageListener extends Listener { ? await this.gil.options.contexts.command({ server: params.server, message: params.message, - }) + }) : {}; this.gil.emitter.emit("commandRan", { diff --git a/packages/gil/lib/listeners/MessageListener.ts b/packages/gil/lib/listeners/MessageListener.ts index 0aa893c9..5e404f63 100644 --- a/packages/gil/lib/listeners/MessageListener.ts +++ b/packages/gil/lib/listeners/MessageListener.ts @@ -1,6 +1,6 @@ -import { Message, UserType } from "guilded.js"; -import { GilClient } from "../GilClient"; -import { Listener, ListenerContext } from "../structures/Listener"; +import { type Message, UserType } from "guilded.js"; +import type { GilClient } from "../GilClient"; +import { Listener, type ListenerContext } from "../structures/Listener"; import { getPrefix } from "../utils/prefix"; export default class MessageListener extends Listener { diff --git a/packages/gil/lib/listeners/ReadyListener.ts b/packages/gil/lib/listeners/ReadyListener.ts index cfec3df8..7fe225ee 100644 --- a/packages/gil/lib/listeners/ReadyListener.ts +++ b/packages/gil/lib/listeners/ReadyListener.ts @@ -1,5 +1,5 @@ -import { GilClient } from "../GilClient"; -import { Listener, ListenerContext } from "../structures/Listener"; +import type { GilClient } from "../GilClient"; +import { Listener, type ListenerContext } from "../structures/Listener"; export default class ReadyListener extends Listener { constructor(gil: GilClient) { diff --git a/packages/gil/lib/structures/Command.ts b/packages/gil/lib/structures/Command.ts index 3c8bf3b3..95f091a5 100644 --- a/packages/gil/lib/structures/Command.ts +++ b/packages/gil/lib/structures/Command.ts @@ -1,10 +1,10 @@ import { Collection } from "@discordjs/collection"; import glob from "fast-glob"; -import { Message } from "guilded.js"; -import { GilClient } from "../GilClient"; -import { StoredRoleType } from "../adapters/db/DatabaseAdapter"; -import { CommandArgument, CommandArgumentType } from "../arguments/ArgumentParser"; -import { CommandMessageParams } from "../events"; +import type { Message } from "guilded.js"; +import type { GilClient } from "../GilClient"; +import type { StoredRoleType } from "../adapters/db/DatabaseAdapter"; +import type { CommandArgument, CommandArgumentType } from "../arguments/ArgumentParser"; +import type { CommandMessageParams } from "../events"; import { Manager } from "./Manager"; export interface CommandOptions { diff --git a/packages/gil/lib/structures/Listener.ts b/packages/gil/lib/structures/Listener.ts index 99100f7d..8532c52a 100644 --- a/packages/gil/lib/structures/Listener.ts +++ b/packages/gil/lib/structures/Listener.ts @@ -1,4 +1,4 @@ -import { GilClient } from "../GilClient"; +import type { GilClient } from "../GilClient"; interface ListenerOptions { event: string; diff --git a/packages/gil/lib/structures/ListenerManager.ts b/packages/gil/lib/structures/ListenerManager.ts index fb4498bf..a1fd9589 100644 --- a/packages/gil/lib/structures/ListenerManager.ts +++ b/packages/gil/lib/structures/ListenerManager.ts @@ -1,10 +1,10 @@ import { Collection } from "@discordjs/collection"; import { glob } from "fast-glob"; -import { ClientEvents } from "guilded.js"; -import { Listener } from "./Listener"; +import type { ClientEvents } from "guilded.js"; +import type { Listener } from "./Listener"; import { Manager } from "./Manager"; -import { GilEvents } from "../events"; +import type { GilEvents } from "../events"; import CommandMessageListener from "../listeners/CommandMessageListener"; import MessageListener from "../listeners/MessageListener"; import ReadyListener from "../listeners/ReadyListener"; diff --git a/packages/gil/lib/structures/Manager.ts b/packages/gil/lib/structures/Manager.ts index 38f87ca0..625c397a 100644 --- a/packages/gil/lib/structures/Manager.ts +++ b/packages/gil/lib/structures/Manager.ts @@ -1,4 +1,4 @@ -import { GilClient } from "../GilClient"; +import type { GilClient } from "../GilClient"; export abstract class Manager { public constructor(public readonly gil: GilClient) {} diff --git a/packages/gil/lib/structures/Responses.ts b/packages/gil/lib/structures/Responses.ts index c2f6de3e..186d3c09 100644 --- a/packages/gil/lib/structures/Responses.ts +++ b/packages/gil/lib/structures/Responses.ts @@ -1,6 +1,6 @@ -import { Embed, MessageContent } from "guilded.js"; +import { Embed, type MessageContent } from "guilded.js"; import { strip } from "../utils/string"; -import { CommandArg } from "./Command"; +import type { CommandArg } from "./Command"; export type Response = (...args: any[]) => MessageContent; export type ParamsObject = T extends (...args: infer P) => any ? { [K in keyof P]: P[K] } : never; diff --git a/packages/gil/lib/structures/Task.ts b/packages/gil/lib/structures/Task.ts index e113191c..a0565d3b 100644 --- a/packages/gil/lib/structures/Task.ts +++ b/packages/gil/lib/structures/Task.ts @@ -1,6 +1,6 @@ import { Collection } from "@discordjs/collection"; import glob from "fast-glob"; -import { GilClient } from "../GilClient"; +import type { GilClient } from "../GilClient"; import { Manager } from "./Manager"; interface TaskOptions { diff --git a/packages/gil/lib/utils/prefix.ts b/packages/gil/lib/utils/prefix.ts index c552a51a..6cc678de 100644 --- a/packages/gil/lib/utils/prefix.ts +++ b/packages/gil/lib/utils/prefix.ts @@ -1,4 +1,4 @@ -import { StoredServer } from "../adapters/db/DatabaseAdapter"; +import type { StoredServer } from "../adapters/db/DatabaseAdapter"; export function getPrefix(server: StoredServer) { return server.prefix ?? process.env.DEFAULT_PREFIX ?? "!"; diff --git a/packages/gil/package.json b/packages/gil/package.json index 0d07fc00..5dba8d4b 100644 --- a/packages/gil/package.json +++ b/packages/gil/package.json @@ -10,22 +10,21 @@ "test": "ts-node test/index.ts", "build": "tsc && gen-esm-wrapper . ./dist/index.mjs", "build:typecheck": "tsc --noEmit", - "prepublishOnly": "rimraf dist/ && rimraf types/ && pnpm run build", + "prepublishOnly": "rimraf dist/ && rimraf types/ && bun run build", "release": "npm publish" }, "devDependencies": { "@types/better-sqlite3": "^7.6.9", - "@types/mongoose": "^5.11.97", + "@types/bun": "^1.0.12", "better-sqlite3": "^9.4.3", - "dotenv": "^16.0.3", + "dotenv": "^16.4.5", "mongoose": "^8.2.3", "pino": "^8.19.0", "postgres": "^3.4.4", - "typescript": "5.0.4" + "typescript": "5.4.5" }, "dependencies": { - "@discordjs/collection": "^1.5.1", - "@types/bun": "^1.0.12", + "@discordjs/collection": "^2.1.0", "colorette": "^2.0.20", "fast-glob": "^3.3.2", "guilded.js": "workspace:*", diff --git a/packages/gil/tsconfig.json b/packages/gil/tsconfig.json index ed9f3579..74d2c141 100644 --- a/packages/gil/tsconfig.json +++ b/packages/gil/tsconfig.json @@ -2,9 +2,6 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "./dist", - "types": [ - "@types/bun" - ], "declarationDir": "./types" }, "include": [ diff --git a/packages/guilded.js/lib/structures/Embed.ts b/packages/guilded.js/lib/structures/Embed.ts index 230faf9e..50f60d4a 100644 --- a/packages/guilded.js/lib/structures/Embed.ts +++ b/packages/guilded.js/lib/structures/Embed.ts @@ -113,7 +113,7 @@ export class Embed { ? { iconURL: iconURL ?? null, text, - } + } : null; return this; } @@ -122,7 +122,7 @@ export class Embed { this.image = url ? { url, - } + } : null; return this; } @@ -131,7 +131,7 @@ export class Embed { this.thumbnail = url ? { url, - } + } : null; return this; } @@ -142,7 +142,7 @@ export class Embed { iconURL: iconURL ?? null, name: name ?? null, url: url ?? null, - } + } : null; return this; } @@ -187,7 +187,7 @@ export class Embed { icon_url: this.author.iconURL ?? undefined, name: this.author.name, url: this.author.url ?? undefined, - } + } : undefined, color: this.color ?? undefined, description: this.description ?? undefined, @@ -201,17 +201,17 @@ export class Embed { ? { icon_url: this.footer.iconURL ?? undefined, text: this.footer.text ?? undefined, - } + } : undefined, image: this.image ? { url: this.image.url ?? undefined, - } + } : undefined, thumbnail: this.thumbnail ? { url: this.thumbnail.url ?? undefined, - } + } : undefined, timestamp: this.timestampString ?? undefined, title: this.title ?? undefined, diff --git a/packages/guilded.js/lib/structures/channels/ListChannel.ts b/packages/guilded.js/lib/structures/channels/ListChannel.ts index 07ab4c73..e6c027d1 100644 --- a/packages/guilded.js/lib/structures/channels/ListChannel.ts +++ b/packages/guilded.js/lib/structures/channels/ListChannel.ts @@ -26,7 +26,7 @@ export class ListChannel extends Channel { note: note ? { content: note, - } + } : undefined, }); } diff --git a/packages/guilded.js/package.json b/packages/guilded.js/package.json index ac1a70f8..813f9ebf 100644 --- a/packages/guilded.js/package.json +++ b/packages/guilded.js/package.json @@ -9,15 +9,15 @@ "scripts": { "build": "tsc && gen-esm-wrapper . ./dist/index.mjs", "build:typecheck": "tsc --noEmit", - "prepublishOnly": "rimraf dist/ && rimraf types/ && pnpm run build", + "prepublishOnly": "rimraf dist/ && rimraf types/ && bun run build", "release": "npm publish" }, "devDependencies": { - "@types/node": "18.16.12", - "typescript": "5.0.4" + "@types/node": "18.19.33", + "typescript": "5.4.5" }, "dependencies": { - "@discordjs/collection": "^1.5.1", + "@discordjs/collection": "^2.1.0", "@guildedjs/api": "workspace:*", "typed-emitter": "2.1.0" }, diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml deleted file mode 100644 index 92571cec..00000000 --- a/pnpm-workspace.yaml +++ /dev/null @@ -1,5 +0,0 @@ -packages: - - "packages/**" - - "services/**" - - "apps/**" - - "!packages/create-guilded-app/templates/**" \ No newline at end of file