Remove unnecessary description and whitespace from nexumi.mdc file
This commit is contained in:
16
packages/shared/package.json
Normal file
16
packages/shared/package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "@nexumi/shared",
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"lint": "eslint src --ext .ts",
|
||||
"test": "vitest run",
|
||||
"typecheck": "tsc --noEmit -p tsconfig.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"zod": "^3.24.1"
|
||||
}
|
||||
}
|
||||
50
packages/shared/src/index.ts
Normal file
50
packages/shared/src/index.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const LocaleSchema = z.enum(['de', 'en']);
|
||||
export type Locale = z.infer<typeof LocaleSchema>;
|
||||
|
||||
export const GuildSettingsSchema = z.object({
|
||||
guildId: z.string(),
|
||||
locale: LocaleSchema.default('de'),
|
||||
moderationEnabled: z.boolean().default(true)
|
||||
});
|
||||
|
||||
export const ModerationActionSchema = z.enum([
|
||||
'BAN',
|
||||
'UNBAN',
|
||||
'KICK',
|
||||
'TIMEOUT',
|
||||
'UN_TIMEOUT',
|
||||
'WARN_ADD',
|
||||
'WARN_REMOVE',
|
||||
'WARN_CLEAR',
|
||||
'PURGE',
|
||||
'LOCK',
|
||||
'UNLOCK',
|
||||
'SLOWMODE',
|
||||
'NICK_SET',
|
||||
'NICK_RESET',
|
||||
'CASE_EDIT',
|
||||
'CASE_DELETE',
|
||||
'MODNOTE_ADD'
|
||||
]);
|
||||
|
||||
export type ModerationAction = z.infer<typeof ModerationActionSchema>;
|
||||
|
||||
type Dictionary = Record<string, string>;
|
||||
const de: Dictionary = {
|
||||
'generic.noPermission': 'Du hast keine Berechtigung für diese Aktion.',
|
||||
'moderation.success': 'Aktion erfolgreich ausgeführt.',
|
||||
'moderation.reason.none': 'Kein Grund angegeben'
|
||||
};
|
||||
const en: Dictionary = {
|
||||
'generic.noPermission': 'You do not have permission for this action.',
|
||||
'moderation.success': 'Action executed successfully.',
|
||||
'moderation.reason.none': 'No reason provided'
|
||||
};
|
||||
|
||||
const locales: Record<Locale, Dictionary> = { de, en };
|
||||
|
||||
export function t(locale: Locale, key: string): string {
|
||||
return locales[locale][key] ?? key;
|
||||
}
|
||||
8
packages/shared/tsconfig.json
Normal file
8
packages/shared/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user