meocord
Version:
MeoCord is a lightweight and modular framework for building scalable Discord bots using TypeScript and Discord.js. It simplifies bot development with an extensible architecture, TypeScript-first approach, and powerful CLI tools.
66 lines (65 loc) • 3.18 kB
TypeScript
/**
* MeoCord Framework
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Converts a given name to a properly formatted class name.
* @param originalName - The original name to be converted to a class name.
* @returns The formatted class name.
* @throws Will exit the process if the generated class name is invalid.
*/
export declare function toClassName(originalName: string): string;
/**
* Validates and formats a given name, splitting it into parts,
* converting it to kebab-case, and generating a class name.
* @param originalName - The name to validate and format. It can include slashes for nested paths.
* @returns An object containing the name parts, kebab-case name, and class name.
* @throws Will exit the process if the name is undefined, invalid,
* or the generated class name is invalid.
*/
export declare function validateAndFormatName(originalName?: string): {
parts: string[];
kebabCaseName: string;
className: string;
};
/**
* Ensures that a given directory exists. Creates the directory and any necessary parent directories if they do not exist.
* @param directory - The absolute path of the directory to create.
*/
export declare function createDirectoryIfNotExists(directory: string): void;
/**
* Writes the provided content to a file and runs ESLint on the file for formatting.
* @param filePath - The absolute path of the file to create or overwrite.
* @param content - The content to write to the file.
* @throws Logs an error if the file creation or ESLint command fails.
*/
export declare function generateFile(filePath: string, content: string): void;
/**
* Builds and returns a template string for a given class name using a specific template file.
* @param className - The name of the class to insert into the template.
* @param templateFileName - The name of the template file to use.
* @returns The populated template string.
* @throws Will throw an error if the template file cannot be read.
*/
export declare function buildTemplate(className: string, templateFileName: string): string;
/**
* Populates a template file with the provided variables by replacing placeholders in the template.
* @param filePath - The path to the template file.
* @param variables - An object containing variable names and their replacement values.
* @returns The populated template string.
* @throws Will throw an error if the template file cannot be read.
*/
export declare function populateTemplate(filePath: string, variables: Record<string, string>): string;