meocord 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +152 -140
- package/dist/cjs/_shared/meocord.app-CHjdCAA_.cjs +496 -0
- package/dist/cjs/_shared/theme-BdtbtMZX.cjs +176 -0
- package/dist/cjs/common/index.cjs +16 -0
- package/dist/cjs/core/index.cjs +35 -0
- package/dist/cjs/decorator/index.cjs +360 -0
- package/dist/cjs/enum/index.cjs +20 -0
- package/dist/cjs/interface/index.cjs +2 -0
- package/dist/esm/bin/generator.js +92 -0
- package/dist/esm/bin/helper/controller-generator.helper.js +105 -0
- package/dist/esm/bin/helper/guard-generator.helper.js +33 -0
- package/dist/esm/bin/helper/service-generator.helper.js +33 -0
- package/dist/esm/bin/meocord.js +333 -0
- package/dist/esm/common/index.js +2 -0
- package/dist/esm/common/logger.js +72 -0
- package/dist/{core/index.d.ts → esm/common/theme.js} +8 -2
- package/dist/esm/core/index.js +1 -0
- package/dist/esm/core/meocord-factory.js +28 -0
- package/dist/esm/core/meocord.app.js +267 -0
- package/dist/esm/decorator/app.decorator.js +99 -0
- package/dist/esm/decorator/command-builder.decorator.js +32 -0
- package/dist/esm/decorator/container.js +6 -0
- package/dist/esm/decorator/controller.decorator.js +218 -0
- package/dist/esm/decorator/guard.decorator.js +165 -0
- package/dist/esm/decorator/index.js +6 -0
- package/dist/esm/decorator/service.decorator.js +58 -0
- package/dist/esm/enum/controller.enum.js +43 -0
- package/dist/esm/enum/index.js +1 -0
- package/dist/esm/interface/index.js +1 -0
- package/dist/esm/package.json.js +5 -0
- package/dist/esm/util/common.util.js +68 -0
- package/dist/esm/util/embed.util.js +13 -0
- package/dist/esm/util/generator-cli.util.js +107 -0
- package/dist/{util → esm/util}/json.util.js +10 -6
- package/dist/esm/util/meocord-cli.util.js +172 -0
- package/dist/esm/util/meocord-config-loader.util.js +48 -0
- package/dist/esm/util/tsconfig.util.js +83 -0
- package/dist/{util → esm/util}/wait.util.js +5 -1
- package/dist/{common/logger.d.ts → types/common/index.d.ts} +30 -1
- package/dist/{core/meocord.app.d.ts → types/core/index.d.ts} +30 -2
- package/dist/types/decorator/index.d.ts +425 -0
- package/dist/types/enum/index.d.ts +18 -0
- package/dist/{interface → types/interface}/index.d.ts +11 -7
- package/package.json +64 -48
- package/webpack.config.js +2 -2
- package/dist/bin/generator.d.ts +0 -29
- package/dist/bin/generator.js +0 -17
- package/dist/bin/helper/controller-generator.helper.d.ts +0 -67
- package/dist/bin/helper/controller-generator.helper.js +0 -50
- package/dist/bin/helper/guard-generator.helper.d.ts +0 -32
- package/dist/bin/helper/guard-generator.helper.js +0 -25
- package/dist/bin/helper/service-generator.helper.d.ts +0 -32
- package/dist/bin/helper/service-generator.helper.js +0 -25
- package/dist/bin/meocord.d.ts +0 -19
- package/dist/bin/meocord.js +0 -34
- package/dist/common/index.d.ts +0 -19
- package/dist/common/index.js +0 -17
- package/dist/common/logger.js +0 -17
- package/dist/common/theme.d.ts +0 -24
- package/dist/common/theme.js +0 -17
- package/dist/core/index.js +0 -17
- package/dist/core/meocord-factory.d.ts +0 -24
- package/dist/core/meocord-factory.js +0 -17
- package/dist/core/meocord.app.js +0 -17
- package/dist/decorator/app.decorator.d.ts +0 -59
- package/dist/decorator/app.decorator.js +0 -61
- package/dist/decorator/command-builder.decorator.d.ts +0 -39
- package/dist/decorator/command-builder.decorator.js +0 -35
- package/dist/decorator/container.d.ts +0 -20
- package/dist/decorator/container.js +0 -17
- package/dist/decorator/controller.decorator.d.ts +0 -125
- package/dist/decorator/controller.decorator.js +0 -113
- package/dist/decorator/guard.decorator.d.ts +0 -101
- package/dist/decorator/guard.decorator.js +0 -94
- package/dist/decorator/index.d.ts +0 -23
- package/dist/decorator/index.js +0 -17
- package/dist/decorator/service.decorator.d.ts +0 -36
- package/dist/decorator/service.decorator.js +0 -36
- package/dist/enum/controller.enum.d.ts +0 -42
- package/dist/enum/controller.enum.js +0 -19
- package/dist/enum/index.d.ts +0 -18
- package/dist/enum/index.js +0 -17
- package/dist/interface/command-decorator.interface.d.ts +0 -43
- package/dist/interface/command-decorator.interface.js +0 -1
- package/dist/interface/index.js +0 -1
- package/dist/util/common.util.d.ts +0 -40
- package/dist/util/common.util.js +0 -38
- package/dist/util/embed.util.d.ts +0 -19
- package/dist/util/embed.util.js +0 -17
- package/dist/util/generator-cli.util.d.ts +0 -65
- package/dist/util/generator-cli.util.js +0 -49
- package/dist/util/index.d.ts +0 -18
- package/dist/util/index.js +0 -17
- package/dist/util/json.util.d.ts +0 -27
- package/dist/util/meocord-cli.util.d.ts +0 -62
- package/dist/util/meocord-cli.util.js +0 -50
- package/dist/util/meocord-config-loader.util.d.ts +0 -32
- package/dist/util/meocord-config-loader.util.js +0 -34
- package/dist/util/tsconfig.util.d.ts +0 -29
- package/dist/util/tsconfig.util.js +0 -32
- package/dist/util/wait.util.d.ts +0 -18
- /package/dist/{bin → esm/bin}/builder-template/builder/context-menu.builder.template +0 -0
- /package/dist/{bin → esm/bin}/builder-template/builder/slash.builder.template +0 -0
- /package/dist/{bin → esm/bin}/builder-template/controller/button.controller.template +0 -0
- /package/dist/{bin → esm/bin}/builder-template/controller/context-menu.controller.template +0 -0
- /package/dist/{bin → esm/bin}/builder-template/controller/message.controller.template +0 -0
- /package/dist/{bin → esm/bin}/builder-template/controller/modal-submit.controller.template +0 -0
- /package/dist/{bin → esm/bin}/builder-template/controller/reaction.controller.template +0 -0
- /package/dist/{bin → esm/bin}/builder-template/controller/select-menu.controller.template +0 -0
- /package/dist/{bin → esm/bin}/builder-template/controller/slash.controller.template +0 -0
- /package/dist/{bin → esm/bin}/builder-template/guard.template +0 -0
- /package/dist/{bin → esm/bin}/builder-template/service.template +0 -0
package/dist/enum/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/export{CommandType,ReactionHandlerAction}from"./controller.enum.js";
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
import { ButtonInteraction, ChatInputCommandInteraction, ContextMenuCommandBuilder, MessageContextMenuCommandInteraction, ModalSubmitInteraction, SlashCommandBuilder, StringSelectMenuInteraction, UserContextMenuCommandInteraction, type SlashCommandSubcommandsOnlyBuilder } from 'discord.js';
|
|
19
|
-
import { CommandType } from '../enum/index.js';
|
|
20
|
-
/**
|
|
21
|
-
* Base interface for a command builder.
|
|
22
|
-
*/
|
|
23
|
-
export interface CommandBuilderBase<T extends CommandType.SLASH | CommandType.CONTEXT_MENU = CommandType.SLASH | CommandType.CONTEXT_MENU> {
|
|
24
|
-
/**
|
|
25
|
-
* Builds the command structure using the specified command name.
|
|
26
|
-
*
|
|
27
|
-
* @param commandName - The name of the command.
|
|
28
|
-
* @returns A SlashCommandBuilder or ContextMenuCommandBuilder instance.
|
|
29
|
-
*/
|
|
30
|
-
build: (commandName: string) => T extends CommandType.SLASH ? SlashCommandBuilder | SlashCommandSubcommandsOnlyBuilder : T extends CommandType.CONTEXT_MENU ? ContextMenuCommandBuilder : never;
|
|
31
|
-
}
|
|
32
|
-
export type CommandBuilderConstructor<T extends CommandType.SLASH | CommandType.CONTEXT_MENU> = new () => CommandBuilderBase<T>;
|
|
33
|
-
/**
|
|
34
|
-
* Command metadata describing a registered command method.
|
|
35
|
-
*/
|
|
36
|
-
export interface CommandMetadata<T extends string = string> {
|
|
37
|
-
methodName: string;
|
|
38
|
-
builder: ReturnType<CommandBuilderBase['build']> | undefined;
|
|
39
|
-
type: CommandType;
|
|
40
|
-
regex?: RegExp;
|
|
41
|
-
dynamicParams?: T[];
|
|
42
|
-
}
|
|
43
|
-
export type CommandInteractionType<CBC extends CommandType.SLASH | CommandType.CONTEXT_MENU, T extends CommandBuilderConstructor<CBC> | CommandType> = T extends CommandType.BUTTON ? ButtonInteraction : T extends CommandType.SELECT_MENU ? StringSelectMenuInteraction : T extends CommandBuilderConstructor<CommandType.SLASH> ? ChatInputCommandInteraction : T extends CommandBuilderConstructor<CommandType.CONTEXT_MENU> ? UserContextMenuCommandInteraction | MessageContextMenuCommandInteraction : T extends CommandType.MODAL_SUBMIT ? ModalSubmitInteraction : never;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{};
|
package/dist/interface/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Finds the package directory for the given module name
|
|
20
|
-
* @param {string} moduleName - The name of the module to find
|
|
21
|
-
* @param {string} baseDir - The starting directory to search from (defaults to process.cwd())
|
|
22
|
-
* @returns {string} - The directory path where the module's package.json is located
|
|
23
|
-
*/
|
|
24
|
-
export declare const findModulePackageDir: (moduleName: string, baseDir?: string) => string | null;
|
|
25
|
-
/**
|
|
26
|
-
* Compiles and validates the MeoCord configuration file.
|
|
27
|
-
* Ensures that `meocord.config.ts` exists, compiles it, and checks
|
|
28
|
-
* the presence of essential configuration properties like `discordToken`.
|
|
29
|
-
*
|
|
30
|
-
* @throws Will exit the process if the `meocord.config.ts` file is missing or
|
|
31
|
-
* if the `discordToken` property is not found in the configuration.
|
|
32
|
-
*/
|
|
33
|
-
export declare function compileAndValidateConfig(): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Sets the environment mode for the application.
|
|
36
|
-
* Assigns the provided mode to `process.env.NODE_ENV` if it hasn't been set already.
|
|
37
|
-
*
|
|
38
|
-
* @param {'production' | 'development'} mode - The desired environment mode.
|
|
39
|
-
*/
|
|
40
|
-
export declare function setEnvironment(mode: 'production' | 'development'): void;
|
package/dist/util/common.util.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
function _regenerator(){function i(a,d,f,g){var h=d&&d.prototype instanceof Generator?d:Generator,c=Object.create(h.prototype);return _regeneratorDefine2(c,"_invoke",function(a,g,h){function d(a,c){for(m=a,q=c,e=0;!v&&s&&!f&&e<t.length;e++){var f,g=t[e],h=p.p,k=g[2];3<a?(f=k===c)&&(q=g[(m=g[4])?5:(m=3,3)],g[4]=g[5]=b):g[0]<=h&&((f=2>a&&h<g[1])?(m=0,p.v=c,p.n=g[1]):h<k&&(f=3>a||g[0]>c||c>k)&&(g[4]=a,g[5]=c,p.n=k,m=0))}if(f||1<a)return j;throw v=!0,c}var k,m,q,s=0,t=h||[],v=!1,p={p:0,n:0,v:b,a:d,f:d.bind(b,4),d:function d(a,c){return k=a,m=0,q=b,p.n=c,j}};return function(c,f,h){if(1<s)throw TypeError("Generator is already running");for(v&&1===f&&d(f,h),m=f,q=h;(e=2>m?b:q)||!v;){k||(m?3>m?(1<m&&(p.n=-1),d(m,q)):p.n=q:p.v=q);try{if(s=2,k){if(m||(c="next"),e=k[c]){if(!(e=e.call(k,q)))throw TypeError("iterator result is not an object");if(!e.done)return e;q=e.value,2>m&&(m=0)}else 1===m&&(e=k["return"])&&e.call(k),2>m&&(q=TypeError("The iterator does not provide a '"+c+"' method"),m=1);k=b}else if((e=(v=0>p.n)?q:a.call(g,p))!==j)break}catch(a){k=b,m=1,q=a}finally{s=1}}return{value:e,done:v}}}(a,f,g),!0),c}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function f(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,GeneratorFunctionPrototype):(a.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(a,h,"GeneratorFunction")),a.prototype=Object.create(c),a}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var b,e,d="function"==typeof Symbol?Symbol:{},g=d.iterator||"@@iterator",h=d.toStringTag||"@@toStringTag",j={};e=Object.getPrototypeOf;var a=[][g]?e(e([][g]())):(_regeneratorDefine2(e={},g,function(){return this}),e),c=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(a);return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(c,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,h,"GeneratorFunction"),_regeneratorDefine2(c),_regeneratorDefine2(c,h,"Generator"),_regeneratorDefine2(c,g,function(){return this}),_regeneratorDefine2(c,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(a,b,c,d){var f=Object.defineProperty;try{f({},"",{})}catch(a){f=0}_regeneratorDefine2=function _regeneratorDefine(a,b,c,d){function o(b,c){_regeneratorDefine2(a,b,function(a){return this._invoke(b,c,a)})}b?f?f(a,b,{value:c,enumerable:!d,configurable:!d,writable:!d}):a[b]=c:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(a,b,c,d)}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function _next(a){asyncGeneratorStep(g,e,f,_next,_throw,"next",a)}function _throw(a){asyncGeneratorStep(g,e,f,_next,_throw,"throw",a)}var g=b.apply(c,d);_next(void 0)})}}/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/import fs from"fs";import path from"path";import{compileMeoCordConfig,loadMeoCordConfig}from"./meocord-config-loader.util.js";import wait from"./wait.util.js";import chalk from"chalk";/**
|
|
18
|
-
* Finds the package directory for the given module name
|
|
19
|
-
* @param {string} moduleName - The name of the module to find
|
|
20
|
-
* @param {string} baseDir - The starting directory to search from (defaults to process.cwd())
|
|
21
|
-
* @returns {string} - The directory path where the module's package.json is located
|
|
22
|
-
*/export var findModulePackageDir=function findModulePackageDir(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:process.cwd();try{// Resolve the node_modules directory from the base directory
|
|
23
|
-
// Traverse the node_modules directories upwards until the package is found
|
|
24
|
-
for(var c=b;c!==path.parse(c).root;){var d=path.join(c,"node_modules",a);if(fs.existsSync(d))return d;// Return the full path to the module directory
|
|
25
|
-
// Move up one level in the directory structure
|
|
26
|
-
c=path.join(c,"..")}throw new Error("Module ".concat(a," not found in node_modules."))}catch(b){return b instanceof Error?console.error(chalk.red("Error finding package directory for ".concat(a,":"),b.message)):console.error(chalk.red("Error finding package directory for ".concat(a,":"),b)),null}};/**
|
|
27
|
-
* Compiles and validates the MeoCord configuration file.
|
|
28
|
-
* Ensures that `meocord.config.ts` exists, compiles it, and checks
|
|
29
|
-
* the presence of essential configuration properties like `discordToken`.
|
|
30
|
-
*
|
|
31
|
-
* @throws Will exit the process if the `meocord.config.ts` file is missing or
|
|
32
|
-
* if the `discordToken` property is not found in the configuration.
|
|
33
|
-
*/export function compileAndValidateConfig(){return _compileAndValidateConfig.apply(this,arguments)}/**
|
|
34
|
-
* Sets the environment mode for the application.
|
|
35
|
-
* Assigns the provided mode to `process.env.NODE_ENV` if it hasn't been set already.
|
|
36
|
-
*
|
|
37
|
-
* @param {'production' | 'development'} mode - The desired environment mode.
|
|
38
|
-
*/function _compileAndValidateConfig(){return _compileAndValidateConfig=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(){var a,b;return _regenerator().w(function(c){for(;1;)switch(c.n){case 0:if(a=path.resolve(process.cwd(),"meocord.config.ts"),fs.existsSync(a)){c.n=2;break}return console.error(chalk.red("Configuration file \"meocord.config.ts\" is missing!")),c.n=1,wait(100);case 1:process.exit(1);case 2:return c.n=3,compileMeoCordConfig();case 3:if(b=loadMeoCordConfig(),null!==b&&void 0!==b&&b.discordToken){c.n=5;break}return console.error(chalk.red("Discord token is missing!")),c.n=4,wait(100);case 4:process.exit(1);case 5:return c.a(2)}},_callee)})),_compileAndValidateConfig.apply(this,arguments)}export function setEnvironment(a){process.env.NODE_ENV||(process.env.NODE_ENV=a)}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
import { EmbedBuilder } from 'discord.js';
|
|
19
|
-
export declare const createErrorEmbed: (description: string) => EmbedBuilder;
|
package/dist/util/embed.util.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/import{EmbedBuilder}from"discord.js";import{Theme}from"../common/index.js";export var createErrorEmbed=function createErrorEmbed(a){var b=new EmbedBuilder;return b.setColor(Theme.errorColor),b.setTitle("Oops!"),b.setDescription(a),b};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Converts a given name to a properly formatted class name.
|
|
20
|
-
* @param originalName - The original name to be converted to a class name.
|
|
21
|
-
* @returns The formatted class name.
|
|
22
|
-
* @throws Will exit the process if the generated class name is invalid.
|
|
23
|
-
*/
|
|
24
|
-
export declare function toClassName(originalName: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* Validates and formats a given name, splitting it into parts,
|
|
27
|
-
* converting it to kebab-case, and generating a class name.
|
|
28
|
-
* @param originalName - The name to validate and format. It can include slashes for nested paths.
|
|
29
|
-
* @returns An object containing the name parts, kebab-case name, and class name.
|
|
30
|
-
* @throws Will exit the process if the name is undefined, invalid,
|
|
31
|
-
* or the generated class name is invalid.
|
|
32
|
-
*/
|
|
33
|
-
export declare function validateAndFormatName(originalName?: string): {
|
|
34
|
-
parts: string[];
|
|
35
|
-
kebabCaseName: string;
|
|
36
|
-
className: string;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Ensures that a given directory exists. Creates the directory and any necessary parent directories if they do not exist.
|
|
40
|
-
* @param directory - The absolute path of the directory to create.
|
|
41
|
-
*/
|
|
42
|
-
export declare function createDirectoryIfNotExists(directory: string): void;
|
|
43
|
-
/**
|
|
44
|
-
* Writes the provided content to a file and runs ESLint on the file for formatting.
|
|
45
|
-
* @param filePath - The absolute path of the file to create or overwrite.
|
|
46
|
-
* @param content - The content to write to the file.
|
|
47
|
-
* @throws Logs an error if the file creation or ESLint command fails.
|
|
48
|
-
*/
|
|
49
|
-
export declare function generateFile(filePath: string, content: string): void;
|
|
50
|
-
/**
|
|
51
|
-
* Builds and returns a template string for a given class name using a specific template file.
|
|
52
|
-
* @param className - The name of the class to insert into the template.
|
|
53
|
-
* @param templateFileName - The name of the template file to use.
|
|
54
|
-
* @returns The populated template string.
|
|
55
|
-
* @throws Will throw an error if the template file cannot be read.
|
|
56
|
-
*/
|
|
57
|
-
export declare function buildTemplate(className: string, templateFileName: string): string;
|
|
58
|
-
/**
|
|
59
|
-
* Populates a template file with the provided variables by replacing placeholders in the template.
|
|
60
|
-
* @param filePath - The path to the template file.
|
|
61
|
-
* @param variables - An object containing variable names and their replacement values.
|
|
62
|
-
* @returns The populated template string.
|
|
63
|
-
* @throws Will throw an error if the template file cannot be read.
|
|
64
|
-
*/
|
|
65
|
-
export declare function populateTemplate(filePath: string, variables: Record<string, string>): string;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _iterableToArrayLimit(b,c){var d=null==b?null:"undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(null!=d){var g,h,j,k,l=[],a=!0,m=!1;try{if(j=(d=d.call(b)).next,0===c){if(Object(d)!==d)return;a=!1}else for(;!(a=(g=j.call(d)).done)&&(l.push(g.value),l.length!==c);a=!0);}catch(a){m=!0,h=a}finally{try{if(!a&&null!=d["return"]&&(k=d["return"](),Object(k)!==k))return}finally{if(m)throw h}}return l}}function _arrayWithHoles(a){if(Array.isArray(a))return a}/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/import fs from"fs";import path from"path";import{exec}from"child_process";import{Logger}from"../common/index.js";import{camelCase,kebabCase,startCase}from"lodash-es";import{fileURLToPath}from"url";var __filename=fileURLToPath(import.meta.url),__dirname=path.dirname(__filename),logger=new Logger("MeoCord");/**
|
|
18
|
-
* Converts a given name to a properly formatted class name.
|
|
19
|
-
* @param originalName - The original name to be converted to a class name.
|
|
20
|
-
* @returns The formatted class name.
|
|
21
|
-
* @throws Will exit the process if the generated class name is invalid.
|
|
22
|
-
*/export function toClassName(a){var b=startCase(camelCase(a)).replace(/\s/g,"");return /^[A-Z][A-Za-z0-9]*$/.test(b)||(logger.error("Invalid class name \"".concat(a,"\". Must start with a letter and contain alphanumeric characters.")),process.exit(1)),b}/**
|
|
23
|
-
* Validates and formats a given name, splitting it into parts,
|
|
24
|
-
* converting it to kebab-case, and generating a class name.
|
|
25
|
-
* @param originalName - The name to validate and format. It can include slashes for nested paths.
|
|
26
|
-
* @returns An object containing the name parts, kebab-case name, and class name.
|
|
27
|
-
* @throws Will exit the process if the name is undefined, invalid,
|
|
28
|
-
* or the generated class name is invalid.
|
|
29
|
-
*/export function validateAndFormatName(a){a||(logger.error("Guard name is required."),process.exit(1));var b=a.split("/"),c=b.pop();c||(logger.error("Invalid guard name."),process.exit(1));var d=kebabCase(c),e=toClassName(c);return{parts:b,kebabCaseName:d,className:e}}/**
|
|
30
|
-
* Ensures that a given directory exists. Creates the directory and any necessary parent directories if they do not exist.
|
|
31
|
-
* @param directory - The absolute path of the directory to create.
|
|
32
|
-
*/export function createDirectoryIfNotExists(a){fs.existsSync(a)||fs.mkdirSync(a,{recursive:!0})}/**
|
|
33
|
-
* Writes the provided content to a file and runs ESLint on the file for formatting.
|
|
34
|
-
* @param filePath - The absolute path of the file to create or overwrite.
|
|
35
|
-
* @param content - The content to write to the file.
|
|
36
|
-
* @throws Logs an error if the file creation or ESLint command fails.
|
|
37
|
-
*/export function generateFile(a,b){try{fs.writeFileSync(a,b),logger.log("Guard file created at: ".concat(path.relative(process.cwd(),a))),exec("npx eslint --fix ".concat(a))}catch(b){logger.error("Failed to create guard file at ".concat(a),b)}}/**
|
|
38
|
-
* Builds and returns a template string for a given class name using a specific template file.
|
|
39
|
-
* @param className - The name of the class to insert into the template.
|
|
40
|
-
* @param templateFileName - The name of the template file to use.
|
|
41
|
-
* @returns The populated template string.
|
|
42
|
-
* @throws Will throw an error if the template file cannot be read.
|
|
43
|
-
*/export function buildTemplate(a,b){for(var c=path.resolve(__dirname,"..","bin","builder-template",b),d=fs.readFileSync(c,"utf-8"),e={className:a},f=0,g=Object.entries(e);f<g.length;f++){var h=_slicedToArray(g[f],2),i=h[0],j=h[1];d=d.replaceAll("{{".concat(i,"}}"),j)}return d}/**
|
|
44
|
-
* Populates a template file with the provided variables by replacing placeholders in the template.
|
|
45
|
-
* @param filePath - The path to the template file.
|
|
46
|
-
* @param variables - An object containing variable names and their replacement values.
|
|
47
|
-
* @returns The populated template string.
|
|
48
|
-
* @throws Will throw an error if the template file cannot be read.
|
|
49
|
-
*/export function populateTemplate(a,b){for(var c=fs.readFileSync(a,"utf-8"),d=0,e=Object.entries(b);d<e.length;d++){var f=_slicedToArray(e[d],2),g=f[0],h=f[1];c=c.replaceAll("{{".concat(g,"}}"),h)}return c}
|
package/dist/util/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
export * as EmbedUtil from './embed.util.js';
|
package/dist/util/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/import*as _EmbedUtil from"./embed.util.js";export{_EmbedUtil as EmbedUtil};
|
package/dist/util/json.util.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Helper function to fix common JSON formatting issues in tsconfig.json, such as:
|
|
20
|
-
* - Removing single-line comments.
|
|
21
|
-
* - Removing trailing commas.
|
|
22
|
-
* - Stripping newlines.
|
|
23
|
-
*
|
|
24
|
-
* @param {string} jsonString - The raw JSON string to fix.
|
|
25
|
-
* @returns {string} The corrected JSON string.
|
|
26
|
-
*/
|
|
27
|
-
export declare function fixJSON(jsonString: string): string;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*
|
|
18
|
-
* @param command - The command for which to configure help.
|
|
19
|
-
*/
|
|
20
|
-
import { Argument, Command, Help, Option } from 'commander';
|
|
21
|
-
export declare function configureCommandHelp(command: Command): void;
|
|
22
|
-
/**
|
|
23
|
-
* Formats the help output for a command.
|
|
24
|
-
*
|
|
25
|
-
* @param cmd - The command for which to format help.
|
|
26
|
-
* @param helper - The helper object for formatting.
|
|
27
|
-
* @param options - The options available for the command.
|
|
28
|
-
* @returns The formatted help text.
|
|
29
|
-
*/
|
|
30
|
-
export declare function formatHelp(cmd: Command, helper: Help, options: readonly Option[]): string;
|
|
31
|
-
/**
|
|
32
|
-
* Generates a table of commands with their aliases and descriptions.
|
|
33
|
-
*
|
|
34
|
-
* @param cmd - The command for which to generate the table.
|
|
35
|
-
* @returns The formatted table of commands.
|
|
36
|
-
*/
|
|
37
|
-
export declare function generateCommandsTable(cmd: Command): string;
|
|
38
|
-
/**
|
|
39
|
-
* Generates a table of commands with their aliases and descriptions.
|
|
40
|
-
*
|
|
41
|
-
* @param options
|
|
42
|
-
* @param helper
|
|
43
|
-
* @returns The formatted table of commands.
|
|
44
|
-
*/
|
|
45
|
-
export declare function generateOptionsTable(options: readonly Option[], helper: Help): string;
|
|
46
|
-
/**
|
|
47
|
-
* Generates a formatted table of arguments for the specified command.
|
|
48
|
-
*
|
|
49
|
-
* This method creates two tables:
|
|
50
|
-
* 1. A table displaying argument names and their descriptions.
|
|
51
|
-
* 2. (If applicable) A table showing available choices for arguments with predefined choices.
|
|
52
|
-
*
|
|
53
|
-
* @param args - The list of arguments for the command.
|
|
54
|
-
* @returns A string representation of the formatted tables, including available arguments and their choices.
|
|
55
|
-
*/
|
|
56
|
-
export declare function generateArgumentsTable(args: readonly Argument[]): string;
|
|
57
|
-
/**
|
|
58
|
-
* Ensures that the script is being run from the root directory of the project.
|
|
59
|
-
* Validates the existence of required files, dependencies, and configuration.
|
|
60
|
-
* If validation fails, it logs an error message and terminates the process.
|
|
61
|
-
*/
|
|
62
|
-
export declare function ensureReady(): Promise<void>;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
function _regenerator(){function i(a,d,f,g){var h=d&&d.prototype instanceof Generator?d:Generator,c=Object.create(h.prototype);return _regeneratorDefine2(c,"_invoke",function(a,g,h){function d(a,c){for(m=a,q=c,e=0;!v&&s&&!f&&e<t.length;e++){var f,g=t[e],h=p.p,k=g[2];3<a?(f=k===c)&&(q=g[(m=g[4])?5:(m=3,3)],g[4]=g[5]=b):g[0]<=h&&((f=2>a&&h<g[1])?(m=0,p.v=c,p.n=g[1]):h<k&&(f=3>a||g[0]>c||c>k)&&(g[4]=a,g[5]=c,p.n=k,m=0))}if(f||1<a)return j;throw v=!0,c}var k,m,q,s=0,t=h||[],v=!1,p={p:0,n:0,v:b,a:d,f:d.bind(b,4),d:function d(a,c){return k=a,m=0,q=b,p.n=c,j}};return function(c,f,h){if(1<s)throw TypeError("Generator is already running");for(v&&1===f&&d(f,h),m=f,q=h;(e=2>m?b:q)||!v;){k||(m?3>m?(1<m&&(p.n=-1),d(m,q)):p.n=q:p.v=q);try{if(s=2,k){if(m||(c="next"),e=k[c]){if(!(e=e.call(k,q)))throw TypeError("iterator result is not an object");if(!e.done)return e;q=e.value,2>m&&(m=0)}else 1===m&&(e=k["return"])&&e.call(k),2>m&&(q=TypeError("The iterator does not provide a '"+c+"' method"),m=1);k=b}else if((e=(v=0>p.n)?q:a.call(g,p))!==j)break}catch(a){k=b,m=1,q=a}finally{s=1}}return{value:e,done:v}}}(a,f,g),!0),c}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function f(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,GeneratorFunctionPrototype):(a.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(a,h,"GeneratorFunction")),a.prototype=Object.create(c),a}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var b,e,d="function"==typeof Symbol?Symbol:{},g=d.iterator||"@@iterator",h=d.toStringTag||"@@toStringTag",j={};e=Object.getPrototypeOf;var a=[][g]?e(e([][g]())):(_regeneratorDefine2(e={},g,function(){return this}),e),c=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(a);return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(c,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,h,"GeneratorFunction"),_regeneratorDefine2(c),_regeneratorDefine2(c,h,"Generator"),_regeneratorDefine2(c,g,function(){return this}),_regeneratorDefine2(c,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(a,b,c,d){var f=Object.defineProperty;try{f({},"",{})}catch(a){f=0}_regeneratorDefine2=function _regeneratorDefine(a,b,c,d){function o(b,c){_regeneratorDefine2(a,b,function(a){return this._invoke(b,c,a)})}b?f?f(a,b,{value:c,enumerable:!d,configurable:!d,writable:!d}):a[b]=c:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(a,b,c,d)}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function _next(a){asyncGeneratorStep(g,e,f,_next,_throw,"next",a)}function _throw(a){asyncGeneratorStep(g,e,f,_next,_throw,"throw",a)}var g=b.apply(c,d);_next(void 0)})}}/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*
|
|
18
|
-
* @param command - The command for which to configure help.
|
|
19
|
-
*/import CliTable3 from"cli-table3";import{findModulePackageDir}from"./common.util.js";import path from"node:path";import fs from"node:fs";import wait from"./wait.util.js";import chalk from"chalk";export function configureCommandHelp(a){a.configureHelp({formatHelp:function formatHelp(b,c){return _formatHelp(b,c,a.options)}}),a.commands.forEach(function(a){configureCommandHelp(a)})}/**
|
|
20
|
-
* Formats the help output for a command.
|
|
21
|
-
*
|
|
22
|
-
* @param cmd - The command for which to format help.
|
|
23
|
-
* @param helper - The helper object for formatting.
|
|
24
|
-
* @param options - The options available for the command.
|
|
25
|
-
* @returns The formatted help text.
|
|
26
|
-
*/function _formatHelp(a,b,c){var d="MeoCord Copyright (C) 2025 Ukasyah Rahmatullah Zada\n This program comes with ABSOLUTELY NO WARRANTY; for details type `meocord show -w'.\n This is free software, and you are welcome to redistribute it\n under certain conditions; type `meocord show -c' for details.\n\n";return d+="".concat(b.commandUsage(a),"\n\n"),d+="".concat(b.commandDescription(a),"\n\n"),0<a.registeredArguments.length&&(d+=generateArgumentsTable(a.registeredArguments),d+="\n\n"),0<c.length&&(d+="Available Options:\n",d+=generateOptionsTable(c,b),d+="\n\n"),0<a.commands.length&&(d+="Available Commands:\n",d+=generateCommandsTable(a),d+="\n"),d}/**
|
|
27
|
-
* Generates a table of commands with their aliases and descriptions.
|
|
28
|
-
*
|
|
29
|
-
* @param cmd - The command for which to generate the table.
|
|
30
|
-
* @returns The formatted table of commands.
|
|
31
|
-
*/export{_formatHelp as formatHelp};export function generateCommandsTable(a){var b=new CliTable3({head:["Command","Alias","Description"]});return a.commands.forEach(function(a){var c=0<a.aliases().length?a.aliases().join(", "):"\u2014",d=a.description()||"No description provided";b.push([a.name(),c,d])}),b.toString()}/**
|
|
32
|
-
* Generates a table of commands with their aliases and descriptions.
|
|
33
|
-
*
|
|
34
|
-
* @param options
|
|
35
|
-
* @param helper
|
|
36
|
-
* @returns The formatted table of commands.
|
|
37
|
-
*/export function generateOptionsTable(a,b){var c=new CliTable3({head:["Option","Description"]});return a.forEach(function(a){return c.push([b.optionTerm(a),b.optionDescription(a)])}),c.toString()}/**
|
|
38
|
-
* Generates a formatted table of arguments for the specified command.
|
|
39
|
-
*
|
|
40
|
-
* This method creates two tables:
|
|
41
|
-
* 1. A table displaying argument names and their descriptions.
|
|
42
|
-
* 2. (If applicable) A table showing available choices for arguments with predefined choices.
|
|
43
|
-
*
|
|
44
|
-
* @param args - The list of arguments for the command.
|
|
45
|
-
* @returns A string representation of the formatted tables, including available arguments and their choices.
|
|
46
|
-
*/export function generateArgumentsTable(a){var b=new CliTable3({head:["Argument","Description"]}),c=new CliTable3({head:["Choice"]}),d=!1;a.forEach(function(a){a.argChoices&&(d=!0,a.argChoices.forEach(function(a){c.push([a])})),b.push([a.name(),a.description||"No description provided"])});var e="";return d?(e+="Available Choices:\n",e+=c.toString(),e+="\n\n"):e+="No available choices.\n\n",e+="Available Arguments:\n",e+=b.toString(),e}/**
|
|
47
|
-
* Ensures that the script is being run from the root directory of the project.
|
|
48
|
-
* Validates the existence of required files, dependencies, and configuration.
|
|
49
|
-
* If validation fails, it logs an error message and terminates the process.
|
|
50
|
-
*/export function ensureReady(){return _ensureReady.apply(this,arguments)}function _ensureReady(){return _ensureReady=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(){var a,b,c,d,e,f,g,h;return _regenerator().w(function(i){for(;1;)switch(i.p=i.n){case 0:if(a=findModulePackageDir("meocord"),b=path.resolve(process.cwd(),"package.json"),i.p=1,fs.existsSync(b)){i.n=2;break}throw new Error("package.json not found. This script must be run from the root directory of the project.");case 2:if(a){i.n=3;break}throw new Error("Cannot locate the \"MeoCord\" package directory.");case 3:if(c=JSON.parse(fs.readFileSync(b,"utf-8")),d=c.dependencies,e=path.join(a,"package.json"),f=JSON.parse(fs.readFileSync(e,"utf-8")),g=f.name,null!==d&&void 0!==d&&d[g]){i.n=4;break}throw new Error("The package.json does not list \"MeoCord\" as a dependency. Ensure you are in the root directory.");case 4:i.n=7;break;case 5:return i.p=5,h=i.v,console.error(chalk.red(h instanceof Error?h.message:"An unknown error occurred during validation.")),i.n=6,wait(100);case 6:process.exit(1);case 7:return i.a(2)}},_callee,null,[[1,5]])})),_ensureReady.apply(this,arguments)}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
import { type MeoCordConfig } from '../interface/index.js';
|
|
19
|
-
/**
|
|
20
|
-
* Compiles the TypeScript configuration file (meocord.config.ts) to JavaScript
|
|
21
|
-
* and stores it in the temporary directory.
|
|
22
|
-
*
|
|
23
|
-
* @returns {boolean} Whether the TypeScript compilation was successful.
|
|
24
|
-
*/
|
|
25
|
-
export declare function compileMeoCordConfig(): Promise<boolean>;
|
|
26
|
-
/**
|
|
27
|
-
* Loads the MeoCord configuration file (meocord.config.js) from the temporary directory
|
|
28
|
-
* and returns it as a JavaScript object.
|
|
29
|
-
*
|
|
30
|
-
* @returns {MeoCordConfig | undefined} The loaded configuration object, or undefined if loading fails.
|
|
31
|
-
*/
|
|
32
|
-
export declare function loadMeoCordConfig(): MeoCordConfig | undefined;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
function _regenerator(){function i(a,d,f,g){var h=d&&d.prototype instanceof Generator?d:Generator,c=Object.create(h.prototype);return _regeneratorDefine2(c,"_invoke",function(a,g,h){function d(a,c){for(m=a,q=c,e=0;!v&&s&&!f&&e<t.length;e++){var f,g=t[e],h=p.p,k=g[2];3<a?(f=k===c)&&(q=g[(m=g[4])?5:(m=3,3)],g[4]=g[5]=b):g[0]<=h&&((f=2>a&&h<g[1])?(m=0,p.v=c,p.n=g[1]):h<k&&(f=3>a||g[0]>c||c>k)&&(g[4]=a,g[5]=c,p.n=k,m=0))}if(f||1<a)return j;throw v=!0,c}var k,m,q,s=0,t=h||[],v=!1,p={p:0,n:0,v:b,a:d,f:d.bind(b,4),d:function d(a,c){return k=a,m=0,q=b,p.n=c,j}};return function(c,f,h){if(1<s)throw TypeError("Generator is already running");for(v&&1===f&&d(f,h),m=f,q=h;(e=2>m?b:q)||!v;){k||(m?3>m?(1<m&&(p.n=-1),d(m,q)):p.n=q:p.v=q);try{if(s=2,k){if(m||(c="next"),e=k[c]){if(!(e=e.call(k,q)))throw TypeError("iterator result is not an object");if(!e.done)return e;q=e.value,2>m&&(m=0)}else 1===m&&(e=k["return"])&&e.call(k),2>m&&(q=TypeError("The iterator does not provide a '"+c+"' method"),m=1);k=b}else if((e=(v=0>p.n)?q:a.call(g,p))!==j)break}catch(a){k=b,m=1,q=a}finally{s=1}}return{value:e,done:v}}}(a,f,g),!0),c}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function f(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,GeneratorFunctionPrototype):(a.__proto__=GeneratorFunctionPrototype,_regeneratorDefine2(a,h,"GeneratorFunction")),a.prototype=Object.create(c),a}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var b,e,d="function"==typeof Symbol?Symbol:{},g=d.iterator||"@@iterator",h=d.toStringTag||"@@toStringTag",j={};e=Object.getPrototypeOf;var a=[][g]?e(e([][g]())):(_regeneratorDefine2(e={},g,function(){return this}),e),c=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(a);return GeneratorFunction.prototype=GeneratorFunctionPrototype,_regeneratorDefine2(c,"constructor",GeneratorFunctionPrototype),_regeneratorDefine2(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",_regeneratorDefine2(GeneratorFunctionPrototype,h,"GeneratorFunction"),_regeneratorDefine2(c),_regeneratorDefine2(c,h,"Generator"),_regeneratorDefine2(c,g,function(){return this}),_regeneratorDefine2(c,"toString",function(){return"[object Generator]"}),(_regenerator=function _regenerator(){return{w:i,m:f}})()}function _regeneratorDefine2(a,b,c,d){var f=Object.defineProperty;try{f({},"",{})}catch(a){f=0}_regeneratorDefine2=function _regeneratorDefine(a,b,c,d){function o(b,c){_regeneratorDefine2(a,b,function(a){return this._invoke(b,c,a)})}b?f?f(a,b,{value:c,enumerable:!d,configurable:!d,writable:!d}):a[b]=c:(o("next",0),o("throw",1),o("return",2))},_regeneratorDefine2(a,b,c,d)}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function _next(a){asyncGeneratorStep(g,e,f,_next,_throw,"next",a)}function _throw(a){asyncGeneratorStep(g,e,f,_next,_throw,"throw",a)}var g=b.apply(c,d);_next(void 0)})}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/import webpack from"webpack";import{TsconfigPathsPlugin}from"tsconfig-paths-webpack-plugin";import path from"path";import{createRequire}from"module";import{existsSync,mkdirSync,readFileSync,rmSync,writeFileSync}from"fs";import{findModulePackageDir}from"./common.util.js";import{fixJSON}from"./json.util.js";import nodeExternals from"webpack-node-externals";var require=createRequire(import.meta.url),TEMP_OUTPUT_DIR=path.resolve(process.cwd(),"dist",".meocord-temp"),_removeUndefinedKeys=function removeUndefinedKeys(a){Object.keys(a).forEach(function(b){a[b]===void 0?delete a[b]:"object"===_typeof(a[b])&&null!==a[b]&&_removeUndefinedKeys(a[b])})},createBuildTsConfig=function createBuildTsConfig(a){var b;return{compilerOptions:{tsBuildInfoFile:null,strict:!0,module:"NodeNext",target:"ESNext",moduleResolution:"NodeNext",esModuleInterop:!0,resolveJsonModule:!0,allowSyntheticDefaultImports:!0,sourceMap:!1,baseUrl:".",rootDir:".",outDir:TEMP_OUTPUT_DIR,paths:null===a||void 0===a||null===(b=a.compilerOptions)||void 0===b?void 0:b.paths,skipLibCheck:!0,noImplicitAny:!1,forceConsistentCasingInFileNames:!0},include:["meocord.config.ts"]}},createWebpackConfig=function createWebpackConfig(a){return{mode:"production"===process.env.NODE_ENV?"production":"development",entry:"meocord.config.ts",target:"node",externals:[nodeExternals({importType:"module"})],experiments:{outputModule:!0},module:{rules:[{test:/\.ts$/,use:{loader:"swc-loader",options:{jsc:{parser:{syntax:"typescript",tsx:!1,decorators:!0},transform:{decoratorMetadata:!0,legacyDecorator:!0}}}},exclude:/node_modules/}]},resolve:{plugins:[new TsconfigPathsPlugin({configFile:a})],extensions:[".ts",".js"]},output:{filename:"meocord.config.js",path:TEMP_OUTPUT_DIR,publicPath:TEMP_OUTPUT_DIR,library:{type:"module"}}}};/**
|
|
18
|
-
* Recursively removes undefined keys from an object
|
|
19
|
-
*//**
|
|
20
|
-
* Creates the build TypeScript configuration
|
|
21
|
-
*//**
|
|
22
|
-
* Creates webpack configuration for compiling the config
|
|
23
|
-
*//**
|
|
24
|
-
* Compiles the TypeScript configuration file (meocord.config.ts) to JavaScript
|
|
25
|
-
* and stores it in the temporary directory.
|
|
26
|
-
*
|
|
27
|
-
* @returns {boolean} Whether the TypeScript compilation was successful.
|
|
28
|
-
*/export function compileMeoCordConfig(){return _compileMeoCordConfig.apply(this,arguments)}/**
|
|
29
|
-
* Loads the MeoCord configuration file (meocord.config.js) from the temporary directory
|
|
30
|
-
* and returns it as a JavaScript object.
|
|
31
|
-
*
|
|
32
|
-
* @returns {MeoCordConfig | undefined} The loaded configuration object, or undefined if loading fails.
|
|
33
|
-
*/function _compileMeoCordConfig(){return _compileMeoCordConfig=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(){var a,b,c,d,e,f,g,h,i,j;return _regenerator().w(function(k){for(;1;)switch(k.p=k.n){case 0:if(a=findModulePackageDir("meocord"),a){k.n=1;break}return k.a(2,!1);case 1:if(b=path.resolve(process.cwd(),"tsconfig.build.json"),c=path.resolve(process.cwd(),"tsconfig.json"),existsSync(c)){k.n=2;break}throw new Error("tsconfig.json not found in: ".concat(process.cwd()));case 2:if(d=JSON.parse(fixJSON(readFileSync(c,"utf-8"))),e=createBuildTsConfig(d),_removeUndefinedKeys(e),writeFileSync(b,fixJSON(JSON.stringify(e))),existsSync(b)){k.n=3;break}return console.error("[MeoCord] tsconfig.build.json file not found: ".concat(b)),k.a(2,!1);case 3:if(existsSync(TEMP_OUTPUT_DIR)||mkdirSync(TEMP_OUTPUT_DIR,{recursive:!0}),f=createWebpackConfig(b),g=webpack(f),g){k.n=4;break}return console.error("[MeoCord] Failed to create webpack compiler instance."),k.a(2,!1);case 4:return k.p=4,h=null,i=function runCompiler(){return new Promise(function(a,b){h=setInterval(function(){// Keeps event loop active
|
|
34
|
-
},100),g.run(function(c,d){return h&&(clearInterval(h),h=null),c?(console.error("[MeoCord] Build error: ".concat(c.message)),void b(c)):null!==d&&void 0!==d&&d.hasErrors()?(console.error("[MeoCord] Compilation errors:",d.compilation.errors),void b(new Error("Compilation failed"))):void g.close(function(c){return c?(console.error("[MeoCord] Close error: ".concat(c.message)),void b(c)):void a(!0)})})})},k.n=5,i();case 5:return k.a(2,k.v);case 6:return k.p=6,j=k.v,j instanceof Error?console.error("[MeoCord] Failed to transpile config: ".concat(j.message)):console.error("[MeoCord] Failed to transpile config: Unknown error"),k.a(2,!1);case 7:return k.p=7,rmSync(b,{force:!0}),k.f(7);case 8:return k.a(2)}},_callee,null,[[4,6,7,8]])})),_compileMeoCordConfig.apply(this,arguments)}export function loadMeoCordConfig(){var a=findModulePackageDir("meocord");if(a){var b=path.join(TEMP_OUTPUT_DIR,"meocord.config.js");if(existsSync(b))try{return delete require.cache[require.resolve(b)],require(b)["default"]}catch(a){return void(a instanceof Error?console.error("[MeoCord] Failed to load config: ".concat(a.message)):console.error("[MeoCord] Failed to load config: Unknown error"))}}}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MeoCord Framework
|
|
3
|
-
* Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Prepares and modifies the project's `tsconfig.json` file for usage with tools like Webpack.
|
|
20
|
-
* - Verifies the existence of `tsconfig.json`.
|
|
21
|
-
* - Fixes invalid JSON if necessary by correcting formatting issues like comments or trailing commas.
|
|
22
|
-
* - Updates paths in `compilerOptions` and other sections to absolute paths.
|
|
23
|
-
* - Removes the `noEmit` option if present in `compilerOptions`.
|
|
24
|
-
* - Writes the modified `tsconfig.json` to a temporary location.
|
|
25
|
-
*
|
|
26
|
-
* @returns {string} The absolute path to the generated temporary `tsconfig.json`.
|
|
27
|
-
* @throws {Error} When `tsconfig.json` is missing or cannot be fixed/parsing fails.
|
|
28
|
-
*/
|
|
29
|
-
export declare function prepareModifiedTsConfig(): string;
|