Presence namespaced types removed

This commit is contained in:
Jacob Nguyen
2024-04-28 23:37:58 -05:00
parent 071d5eac49
commit e6fba9d8b5
11 changed files with 114 additions and 113 deletions

View File

@@ -1,9 +1,6 @@
import path from 'node:path';
import assert from 'assert';
import { createRequire } from 'node:module';
import type { Wrapper } from '../types/core';
import { existsSync } from 'fs';
import type { Logging } from './interfaces';
export const parseCallsite = (fpath: string) => {
@@ -54,32 +51,3 @@ export const fmtFileName = (fileName: string) => path.parse(fileName).name;
export const filename = (p: string) => fmtFileName(path.basename(p));
const requir = createRequire(import.meta.url);
export function loadConfig(wrapper: Wrapper | 'file', log: Logging | undefined): Wrapper {
if (wrapper !== 'file') {
return wrapper;
}
log?.info({ message: 'Experimental loading of sern.config.json'});
const config = requir(path.resolve('sern.config.json'));
const makePath = (dir: PropertyKey) =>
config.language === 'typescript'
? path.join('dist', config.paths[dir]!)
: path.join(config.paths[dir]!);
log?.info({ message: 'Loading config: ' + JSON.stringify(config, null, 4) });
const commandsPath = makePath('commands');
log?.info({ message: `Commands path is set to ${commandsPath}` });
let eventsPath: string | undefined;
if (config.paths.events) {
eventsPath = makePath('events');
log?.info({ message: `Events path is set to ${eventsPath} `});
}
return { defaultPrefix: config.defaultPrefix,
commands: commandsPath,
events: eventsPath };
}