fix(build): 🐛 Modify CLI to properly bundle

This commit is contained in:
Jesse Wierzbinski 2024-05-08 00:24:21 +00:00
parent 0d278e4fa9
commit 6b17b91235
No known key found for this signature in database
9 changed files with 13 additions and 90 deletions

View file

@ -1,14 +1,11 @@
import { Command } from "@oclif/core";
import { setupDatabase } from "~drizzle/db";
import { consoleLogger } from "@loggers";
export abstract class BaseCommand<T extends typeof Command> extends Command {
protected async init(): Promise<void> {
await super.init();
const { setupDatabase } = await import("~drizzle/db");
const { consoleLogger } = await import("@loggers");
(async () => {
await setupDatabase(consoleLogger, false);
})();
await setupDatabase(consoleLogger, false);
}
}

View file

@ -2,7 +2,7 @@ import { Args, type Command, Flags, type Interfaces } from "@oclif/core";
import chalk from "chalk";
import { and, eq, like } from "drizzle-orm";
import { Users } from "~drizzle/schema";
import type { User } from "~packages/database-interface/user";
import { User } from "~packages/database-interface/user";
import { BaseCommand } from "./base";
export type FlagsType<T extends typeof Command> = Interfaces.InferredFlags<
@ -81,8 +81,6 @@ export abstract class UserFinderCommand<
? this.args.identifier.replace(/\*/g, "%")
: this.args.identifier;
const { User } = await import("~packages/database-interface/user");
return await User.manyFromSql(
and(
this.flags.type === "id"

View file

@ -1,13 +1,15 @@
import { execute } from "@oclif/core";
import EmojiAdd from "./commands/emoji/add";
import UserCreate from "./commands/user/create";
import UserDelete from "./commands/user/delete";
import UserList from "./commands/user/list";
import UserReset from "./commands/user/reset";
// Use "explicit" oclif strategy to avoid issues with oclif's module resolver and bundling
export const commands = {
"user list": UserList,
"user delete": UserDelete,
"user create": UserCreate,
"user reset": UserReset,
"emoji add": EmojiAdd,
"user:list": UserList,
"user:delete": UserDelete,
"user:create": UserCreate,
"user:reset": UserReset,
"emoji:add": EmojiAdd,
};

View file

@ -5,7 +5,7 @@
"dollarSign": "white",
"flag": "white",
"flagDefaultValue": "blue",
"flagOptions": "white",
"flagOptions": "green",
"flagRequired": "red",
"flagSeparator": "white",
"sectionDescription": "white",