chore: setup script

This commit is contained in:
ghost2023
2026-07-01 12:26:37 +03:00
parent 50b6b7c3ee
commit c88c5ee450
5 changed files with 972 additions and 98 deletions

View File

@@ -0,0 +1,7 @@
import type Vorpal from "vorpal";
import type { CommandContext } from "./types";
export function registerCommands(_vorpal: Vorpal, _ctx: CommandContext): void {
// Add more command registrations here:
// registerMyNewCommand(vorpal, ctx);
}

View File

@@ -0,0 +1,6 @@
import type Vorpal from "vorpal";
import type { INestApplicationContext } from "@nestjs/common";
export type CommandContext = {
app: INestApplicationContext;
};

View File

@@ -0,0 +1,30 @@
import "reflect-metadata";
import { config } from "dotenv";
config();
import Vorpal from "vorpal";
import { registerCommands } from "./cmds/index";
import { NestFactory } from "@nestjs/core";
import { AppModule } from "../app.module";
const vorpal = new Vorpal();
async function main() {
const app = await NestFactory.createApplicationContext(AppModule, {
logger: false,
});
try {
registerCommands(vorpal, { app });
vorpal.parse(process.argv);
} finally {
await app.close();
}
}
main().catch((err) => {
console.error("Script failed:", err);
process.exit(1);
});