Skip to content

Commit

Permalink
cleaning up a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoobes committed Feb 4, 2024
1 parent d2054f2 commit 99aa7bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
9 changes: 3 additions & 6 deletions src/core/ioc/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function disposeAll(logger: Logging|undefined) {
.then(() => logger?.info({ message: 'Cleaning container and crashing' }));
}

const dependencyBuilder = (container: any, excluded: string[], included: string[]) => {
const dependencyBuilder = (container: any, excluded: string[] ) => {
type Insertable =
| ((container: CoreContainer<Dependencies>) => unknown )
| object
Expand All @@ -51,9 +51,7 @@ const dependencyBuilder = (container: any, excluded: string[], included: string[
exclude(...keys: (keyof Dependencies)[]) {
keys.forEach(key => excluded.push(key));
},
include(...keys: string[]) {
included.push(...keys);
},

/**
* @param key the key of the dependency
* @param v The dependency to swap out.
Expand Down Expand Up @@ -126,8 +124,7 @@ export async function makeDependencies<const T extends Dependencies>
containerSubject = new CoreContainer();
if(typeof conf === 'function') {
const excluded: string[] = [];
const included: string[] = [];
conf(dependencyBuilder(containerSubject, excluded, included));
conf(dependencyBuilder(containerSubject, excluded));

const includeLogger =
!excluded.includes('@sern/logger')
Expand Down
2 changes: 1 addition & 1 deletion src/core/structures/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
BaseInteraction,
ChatInputCommandInteraction,
Client,
Expand Down
4 changes: 3 additions & 1 deletion src/types/ioc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export type IntoDependencies<Tuple extends [...any[]]> = {
} & { length: Tuple['length'] };

export interface DependencyConfiguration {
//@deprecated. Loggers will always be included in the future
/*
* @deprecated. Loggers will be opt-in the future
*/
exclude?: Set<'@sern/logger'>;
build: (
root: Container<Omit<CoreDependencies, '@sern/client'>, {}>,
Expand Down

0 comments on commit 99aa7bc

Please sign in to comment.