refactor: cleanup (#348)

* some wip code

Co-authored-by: Jacob Nguyen <jacoobes@users.noreply.github.com>

* general idea

* style

* making shrimple truly optional

* got optional localizer working

* proposing api notation?

* prepare for localization map

* add localsFor

* merge some internals

* boss call

* add test for init functionality

* add documentation

* inline and cleanup

* feat: logging for experimental json loading

* loosen typings

* dev workflow and cleaning up comments

* cleaning up a bit more

* rename Localizer -> Localization

* more documentation, change dir for default localizer

* some tests

* "

* move stuff, refactor, deprecate

* yarnb

* Update index.ts

---------

Co-authored-by: Jacob Nguyen <jacoobes@users.noreply.github.com>
Co-authored-by: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com>
Co-authored-by: jacob <jacoobes@sern.dev>
This commit is contained in:
2024-02-10 00:46:16 +01:00
committed by GitHub
parent 5cad432589
commit 45cbda7b42
36 changed files with 311 additions and 272 deletions

View File

@@ -20,7 +20,6 @@ import { AnyCommandPlugin, AnyEventPlugin, ControlPlugin, InitPlugin } from './c
import { Awaitable, Args, SlashOptions, SernEventsMapping } from './utility';
export interface CommandMeta {
fullPath: string;
id: string;

View File

@@ -33,9 +33,9 @@ import type {
TextCommand,
UserSelectCommand,
} from './core-modules';
import { Args, Awaitable, Payload, SlashOptions } from './utility';
import { CommandType, Context, EventType, PluginType } from '../core';
import {
import type { Args, Awaitable, Payload, SlashOptions } from './utility';
import type { CommandType, Context, EventType, PluginType } from '../core';
import type {
ButtonInteraction,
ChannelSelectMenuInteraction,
ClientEvents,

View File

@@ -26,11 +26,15 @@ export type DependencyList = [
export interface CoreDependencies {
'@sern/client': () => Contracts.Emitter;
'@sern/logger'?: () => Contracts.Logging;
'@sern/emitter': () => Contracts.Emitter;
/**
* @deprecated
* Will be removed and turned internal
*/
'@sern/store': () => Contracts.CoreModuleStore;
'@sern/modules': () => Contracts.ModuleManager;
'@sern/errors': () => Contracts.ErrorHandling;
'@sern/logger'?: () => Contracts.Logging;
}
export type DependencyFromKey<T extends keyof Dependencies> = Dependencies[T];
@@ -39,8 +43,13 @@ export type IntoDependencies<Tuple extends [...any[]]> = {
[Index in keyof Tuple]: UnpackFunction<NonNullable<DependencyFromKey<Tuple[Index]>>>; //Unpack and make NonNullable
} & { length: Tuple['length'] };
/**
* @deprecated This old signature will be incompatible with future versions of sern.
*/
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'>, {}>,

View File

@@ -29,5 +29,4 @@ export type Payload =
| { type: PayloadType.Warning; reason: string };
export type ReplyOptions = string | Omit<InteractionReplyOptions, 'fetchReply'> | MessageReplyOptions;