From 04cd140f6dd48caae5ef500135086a454b497ec1 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Wed, 8 May 2024 00:30:45 +0000 Subject: [PATCH] fix(cli): :bug: Fix CLI not working in build Missing code in cli/index.ts does that to you --- cli/base.ts | 2 +- cli/index.ts | 4 ++++ package.json | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/base.ts b/cli/base.ts index f4b143c9..8269377c 100644 --- a/cli/base.ts +++ b/cli/base.ts @@ -1,6 +1,6 @@ +import { consoleLogger } from "@loggers"; import { Command } from "@oclif/core"; import { setupDatabase } from "~drizzle/db"; -import { consoleLogger } from "@loggers"; export abstract class BaseCommand extends Command { protected async init(): Promise { diff --git a/cli/index.ts b/cli/index.ts index ae5affd2..98dfce12 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -13,3 +13,7 @@ export const commands = { "user:reset": UserReset, "emoji:add": EmojiAdd, }; + +if (import.meta.path === Bun.main) { + await execute({ dir: import.meta.url }); +} diff --git a/package.json b/package.json index c3af4a7a..1344374f 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "build": "bun run build.ts", "cloc": "cloc . --exclude-dir node_modules,dist,.output,.nuxt,meta,logs,glitch,glitch-dev --exclude-ext sql,log,pem", "wc": "find server database *.ts docs packages types utils drizzle tests -type f -print0 | wc -m --files0-from=-", - "cli": "bun run cli/bin/run.ts", + "cli": "bun run cli/index.ts", "prune": "ts-prune | grep -v server/ | grep -v dist/ | grep -v '(used in module)'" }, "trustedDependencies": [