44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import 'reflect-metadata';
|
|
import { EventEmitter } from 'node:events';
|
|
import { NestFactory } from '@nestjs/core';
|
|
import Logger from '@/logger.js';
|
|
import { CommandModule } from '@/cli/CommandModule.js';
|
|
import { NestLogger } from '@/NestLogger.js';
|
|
import { CommandService } from '@/cli/CommandService.js';
|
|
import { envOption } from '../env.js';
|
|
|
|
process.title = 'Misskey Cli';
|
|
|
|
Error.stackTraceLimit = Infinity;
|
|
EventEmitter.defaultMaxListeners = 128;
|
|
|
|
const logger = new Logger('core', 'cyan');
|
|
|
|
//#region Events
|
|
|
|
// Display detail of unhandled promise rejection
|
|
if (!envOption.quiet) {
|
|
process.on('unhandledRejection', console.dir);
|
|
}
|
|
|
|
// Display detail of uncaught exception
|
|
process.on('uncaughtException', err => {
|
|
try {
|
|
logger.error(err);
|
|
console.trace(err);
|
|
} catch { }
|
|
});
|
|
//#endregion
|
|
|
|
const app = await NestFactory.createApplicationContext(CommandModule, {
|
|
logger: new NestLogger(),
|
|
});
|
|
|
|
const commandService = app.get(CommandService);
|
|
commandService.ping();
|