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.
Files changed (113) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +152 -140
  3. package/dist/cjs/_shared/meocord.app-CHjdCAA_.cjs +496 -0
  4. package/dist/cjs/_shared/theme-BdtbtMZX.cjs +176 -0
  5. package/dist/cjs/common/index.cjs +16 -0
  6. package/dist/cjs/core/index.cjs +35 -0
  7. package/dist/cjs/decorator/index.cjs +360 -0
  8. package/dist/cjs/enum/index.cjs +20 -0
  9. package/dist/cjs/interface/index.cjs +2 -0
  10. package/dist/esm/bin/generator.js +92 -0
  11. package/dist/esm/bin/helper/controller-generator.helper.js +105 -0
  12. package/dist/esm/bin/helper/guard-generator.helper.js +33 -0
  13. package/dist/esm/bin/helper/service-generator.helper.js +33 -0
  14. package/dist/esm/bin/meocord.js +333 -0
  15. package/dist/esm/common/index.js +2 -0
  16. package/dist/esm/common/logger.js +72 -0
  17. package/dist/{core/index.d.ts → esm/common/theme.js} +8 -2
  18. package/dist/esm/core/index.js +1 -0
  19. package/dist/esm/core/meocord-factory.js +28 -0
  20. package/dist/esm/core/meocord.app.js +267 -0
  21. package/dist/esm/decorator/app.decorator.js +99 -0
  22. package/dist/esm/decorator/command-builder.decorator.js +32 -0
  23. package/dist/esm/decorator/container.js +6 -0
  24. package/dist/esm/decorator/controller.decorator.js +218 -0
  25. package/dist/esm/decorator/guard.decorator.js +165 -0
  26. package/dist/esm/decorator/index.js +6 -0
  27. package/dist/esm/decorator/service.decorator.js +58 -0
  28. package/dist/esm/enum/controller.enum.js +43 -0
  29. package/dist/esm/enum/index.js +1 -0
  30. package/dist/esm/interface/index.js +1 -0
  31. package/dist/esm/package.json.js +5 -0
  32. package/dist/esm/util/common.util.js +68 -0
  33. package/dist/esm/util/embed.util.js +13 -0
  34. package/dist/esm/util/generator-cli.util.js +107 -0
  35. package/dist/{util → esm/util}/json.util.js +10 -6
  36. package/dist/esm/util/meocord-cli.util.js +172 -0
  37. package/dist/esm/util/meocord-config-loader.util.js +48 -0
  38. package/dist/esm/util/tsconfig.util.js +83 -0
  39. package/dist/{util → esm/util}/wait.util.js +5 -1
  40. package/dist/{common/logger.d.ts → types/common/index.d.ts} +30 -1
  41. package/dist/{core/meocord.app.d.ts → types/core/index.d.ts} +30 -2
  42. package/dist/types/decorator/index.d.ts +425 -0
  43. package/dist/types/enum/index.d.ts +18 -0
  44. package/dist/{interface → types/interface}/index.d.ts +11 -7
  45. package/package.json +64 -48
  46. package/webpack.config.js +2 -2
  47. package/dist/bin/generator.d.ts +0 -29
  48. package/dist/bin/generator.js +0 -17
  49. package/dist/bin/helper/controller-generator.helper.d.ts +0 -67
  50. package/dist/bin/helper/controller-generator.helper.js +0 -50
  51. package/dist/bin/helper/guard-generator.helper.d.ts +0 -32
  52. package/dist/bin/helper/guard-generator.helper.js +0 -25
  53. package/dist/bin/helper/service-generator.helper.d.ts +0 -32
  54. package/dist/bin/helper/service-generator.helper.js +0 -25
  55. package/dist/bin/meocord.d.ts +0 -19
  56. package/dist/bin/meocord.js +0 -34
  57. package/dist/common/index.d.ts +0 -19
  58. package/dist/common/index.js +0 -17
  59. package/dist/common/logger.js +0 -17
  60. package/dist/common/theme.d.ts +0 -24
  61. package/dist/common/theme.js +0 -17
  62. package/dist/core/index.js +0 -17
  63. package/dist/core/meocord-factory.d.ts +0 -24
  64. package/dist/core/meocord-factory.js +0 -17
  65. package/dist/core/meocord.app.js +0 -17
  66. package/dist/decorator/app.decorator.d.ts +0 -59
  67. package/dist/decorator/app.decorator.js +0 -61
  68. package/dist/decorator/command-builder.decorator.d.ts +0 -39
  69. package/dist/decorator/command-builder.decorator.js +0 -35
  70. package/dist/decorator/container.d.ts +0 -20
  71. package/dist/decorator/container.js +0 -17
  72. package/dist/decorator/controller.decorator.d.ts +0 -125
  73. package/dist/decorator/controller.decorator.js +0 -113
  74. package/dist/decorator/guard.decorator.d.ts +0 -101
  75. package/dist/decorator/guard.decorator.js +0 -94
  76. package/dist/decorator/index.d.ts +0 -23
  77. package/dist/decorator/index.js +0 -17
  78. package/dist/decorator/service.decorator.d.ts +0 -36
  79. package/dist/decorator/service.decorator.js +0 -36
  80. package/dist/enum/controller.enum.d.ts +0 -42
  81. package/dist/enum/controller.enum.js +0 -19
  82. package/dist/enum/index.d.ts +0 -18
  83. package/dist/enum/index.js +0 -17
  84. package/dist/interface/command-decorator.interface.d.ts +0 -43
  85. package/dist/interface/command-decorator.interface.js +0 -1
  86. package/dist/interface/index.js +0 -1
  87. package/dist/util/common.util.d.ts +0 -40
  88. package/dist/util/common.util.js +0 -38
  89. package/dist/util/embed.util.d.ts +0 -19
  90. package/dist/util/embed.util.js +0 -17
  91. package/dist/util/generator-cli.util.d.ts +0 -65
  92. package/dist/util/generator-cli.util.js +0 -49
  93. package/dist/util/index.d.ts +0 -18
  94. package/dist/util/index.js +0 -17
  95. package/dist/util/json.util.d.ts +0 -27
  96. package/dist/util/meocord-cli.util.d.ts +0 -62
  97. package/dist/util/meocord-cli.util.js +0 -50
  98. package/dist/util/meocord-config-loader.util.d.ts +0 -32
  99. package/dist/util/meocord-config-loader.util.js +0 -34
  100. package/dist/util/tsconfig.util.d.ts +0 -29
  101. package/dist/util/tsconfig.util.js +0 -32
  102. package/dist/util/wait.util.d.ts +0 -18
  103. /package/dist/{bin → esm/bin}/builder-template/builder/context-menu.builder.template +0 -0
  104. /package/dist/{bin → esm/bin}/builder-template/builder/slash.builder.template +0 -0
  105. /package/dist/{bin → esm/bin}/builder-template/controller/button.controller.template +0 -0
  106. /package/dist/{bin → esm/bin}/builder-template/controller/context-menu.controller.template +0 -0
  107. /package/dist/{bin → esm/bin}/builder-template/controller/message.controller.template +0 -0
  108. /package/dist/{bin → esm/bin}/builder-template/controller/modal-submit.controller.template +0 -0
  109. /package/dist/{bin → esm/bin}/builder-template/controller/reaction.controller.template +0 -0
  110. /package/dist/{bin → esm/bin}/builder-template/controller/select-menu.controller.template +0 -0
  111. /package/dist/{bin → esm/bin}/builder-template/controller/slash.controller.template +0 -0
  112. /package/dist/{bin → esm/bin}/builder-template/guard.template +0 -0
  113. /package/dist/{bin → esm/bin}/builder-template/service.template +0 -0
@@ -1,3 +1,7 @@
1
+ import { User, PartialUser, BaseInteraction, Message, MessageReaction } from 'discord.js';
2
+ import { Configuration } from 'webpack';
3
+ import { ReactionHandlerAction } from '../enum/index.js';
4
+
1
5
  /**
2
6
  * MeoCord Framework
3
7
  * Copyright (C) 2025 Ukasyah Rahmatullah Zada
@@ -15,16 +19,14 @@
15
19
  * You should have received a copy of the GNU General Public License
16
20
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
21
  */
18
- import { BaseInteraction, Message, MessageReaction, type PartialUser, User } from 'discord.js';
19
- import { type Configuration } from 'webpack';
20
- import { ReactionHandlerAction } from '../enum/controller.enum.js';
22
+
21
23
  /**
22
24
  * Interface for Guard classes.
23
25
  * Guards are used to handle permission checks before executing a method.
24
26
  * Each guard must implement the `canActivate` method, which is responsible for determining
25
27
  * whether the method should be allowed to execute based on the provided context (Interaction, Message, or Reaction) and arguments.
26
28
  */
27
- export interface GuardInterface {
29
+ interface GuardInterface {
28
30
  /**
29
31
  * Determines if the method should be allowed to execute based on the context (Interaction, Message, or Reaction) and additional arguments.
30
32
  * @param context - The context object, typically representing a user action in Discord (Interaction, Message, or Reaction).
@@ -37,7 +39,7 @@ export interface GuardInterface {
37
39
  /**
38
40
  * Interface for handling reactions in a Discord message.
39
41
  */
40
- export interface ReactionHandlerOptions {
42
+ interface ReactionHandlerOptions {
41
43
  /** The user object, which can be either a full or partial user. */
42
44
  user: User | PartialUser;
43
45
  /** The action performed on the reaction, such as adding or removing it. */
@@ -48,7 +50,7 @@ export interface ReactionHandlerOptions {
48
50
  * This interface extends the base Webpack Configuration and provides stricter type definitions
49
51
  * with additional required properties to ensure a complete and valid Webpack setup.
50
52
  */
51
- export interface MeoCordWebpackConfig extends Omit<Configuration, 'externals'> {
53
+ interface MeoCordWebpackConfig extends Omit<Configuration, 'externals'> {
52
54
  /** Defines the mode of the Webpack build process (e.g., 'development' or 'production'). */
53
55
  mode: NonNullable<Configuration['mode']>;
54
56
  /** The entry point file path(s) for the application. Represents the starting point(s) of the build. */
@@ -83,7 +85,7 @@ export interface MeoCordWebpackConfig extends Omit<Configuration, 'externals'> {
83
85
  * This interface defines optional configurations for the application, including
84
86
  * metadata, authentication tokens, and Webpack configuration overrides.
85
87
  */
86
- export interface MeoCordConfig {
88
+ interface MeoCordConfig {
87
89
  /**
88
90
  * The name of the application.
89
91
  * If not specified, it defaults to 'MeoCord'.
@@ -101,3 +103,5 @@ export interface MeoCordConfig {
101
103
  */
102
104
  webpack?: (config: MeoCordWebpackConfig) => MeoCordWebpackConfig | undefined;
103
105
  }
106
+
107
+ export type { GuardInterface, MeoCordConfig, MeoCordWebpackConfig, ReactionHandlerOptions };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "meocord",
3
3
  "description": "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.",
4
- "version": "1.2.1",
4
+ "version": "1.2.2",
5
5
  "packageManager": "yarn@4.12.0",
6
6
  "type": "module",
7
7
  "scripts": {
8
- "lint": "eslint --fix . && tsc",
9
- "build": "rm -rf ./dist && babel src --out-dir dist --extensions \".ts,.js\" && tsc && tsc-alias && copyfiles -u 1 \"src/**/*.template\" dist",
8
+ "lint": "eslint --fix . && tsc --noEmit",
9
+ "build": "rm -rf ./dist && rollup -c",
10
10
  "publish:prerelease": "./prepublish.sh && yarn build && yarn version -i prerelease && yarn npm publish --tag next",
11
11
  "publish:patch": "./prepublish.sh && yarn build && yarn version -i patch && yarn npm publish --tag latest",
12
12
  "publish:minor": "./prepublish.sh && yarn build && yarn version -i minor && yarn npm publish --tag latest",
@@ -14,7 +14,7 @@
14
14
  "publish:major": "./prepublish.sh && yarn build && yarn version -i major && yarn npm publish --tag latest",
15
15
  "prepare": "husky"
16
16
  },
17
- "bin": "./dist/bin/meocord.js",
17
+ "bin": "./dist/esm/bin/meocord.js",
18
18
  "repository": {
19
19
  "type": "git",
20
20
  "url": "git+https://github.com/l7aromeo/meocord.git"
@@ -26,29 +26,29 @@
26
26
  "license": "GPL-3.0-or-later",
27
27
  "exports": {
28
28
  "./core": {
29
- "import": "./dist/core/index.js",
30
- "require": "./dist/core/index.js",
31
- "types": "./dist/core/index.d.ts"
29
+ "types": "./dist/types/core/index.d.ts",
30
+ "import": "./dist/esm/core/index.js",
31
+ "require": "./dist/cjs/core/index.cjs"
32
32
  },
33
33
  "./decorator": {
34
- "import": "./dist/decorator/index.js",
35
- "require": "./dist/decorator/index.js",
36
- "types": "./dist/decorator/index.d.ts"
34
+ "types": "./dist/types/decorator/index.d.ts",
35
+ "import": "./dist/esm/decorator/index.js",
36
+ "require": "./dist/cjs/decorator/index.cjs"
37
37
  },
38
38
  "./common": {
39
- "import": "./dist/common/index.js",
40
- "require": "./dist/common/index.js",
41
- "types": "./dist/common/index.d.ts"
39
+ "types": "./dist/types/common/index.d.ts",
40
+ "import": "./dist/esm/common/index.js",
41
+ "require": "./dist/cjs/common/index.cjs"
42
42
  },
43
43
  "./interface": {
44
- "import": "./dist/interface/index.js",
45
- "require": "./dist/interface/index.js",
46
- "types": "./dist/interface/index.d.ts"
44
+ "types": "./dist/types/interface/index.d.ts",
45
+ "import": "./dist/esm/interface/index.js",
46
+ "require": "./dist/cjs/interface/index.cjs"
47
47
  },
48
48
  "./enum": {
49
- "import": "./dist/enum/index.js",
50
- "require": "./dist/enum/index.js",
51
- "types": "./dist/enum/index.d.ts"
49
+ "types": "./dist/types/enum/index.d.ts",
50
+ "import": "./dist/esm/enum/index.js",
51
+ "require": "./dist/cjs/enum/index.cjs"
52
52
  },
53
53
  "./eslint": "./meocord.eslint.mjs"
54
54
  },
@@ -62,38 +62,29 @@
62
62
  "README.md"
63
63
  ],
64
64
  "dependencies": {
65
- "@swc/core": "1.15.18",
65
+ "@swc/core": "1.15.24",
66
66
  "chalk": "^5.6.2",
67
67
  "cli-table3": "^0.6.5",
68
68
  "commander": "^14.0.3",
69
- "dayjs": "^1.11.19",
70
- "discord.js": "^14.25.1",
71
- "dotenv": "^17.3.1",
72
- "esbuild-plugin-tsc": "^0.5.0",
73
- "inversify": "^7.11.0",
74
- "lodash-es": "^4.17.23",
69
+ "dayjs": "^1.11.20",
70
+ "dotenv": "^17.4.1",
71
+ "inversify": "^8.1.0",
72
+ "jiti": "^2.6.1",
73
+ "lodash-es": "^4.18.1",
75
74
  "nodemon": "^3.1.14",
76
75
  "reflect-metadata": "^0.2.2",
77
- "simple-git": "^3.33.0",
78
- "swc-loader": "^0.2.7",
79
- "terser-webpack-plugin": "^5.4.0",
80
- "tsconfig-paths-webpack-plugin": "^4.2.0",
81
- "webpack": "^5.105.4",
82
- "webpack-node-externals": "^3.0.0"
76
+ "simple-git": "^3.35.2"
83
77
  },
84
78
  "devDependencies": {
85
- "@babel/cli": "^7.28.6",
86
- "@babel/core": "^7.29.0",
87
- "@babel/preset-env": "^7.29.0",
88
- "@babel/preset-typescript": "^7.28.5",
89
79
  "@eslint/js": "^9.39.4",
90
- "@types/copyfiles": "^2.4.4",
80
+ "@rollup/plugin-alias": "^6.0.0",
81
+ "@rollup/plugin-json": "^6.1.0",
82
+ "@rollup/plugin-node-resolve": "^16.0.3",
83
+ "@rollup/plugin-swc": "^0.4.0",
91
84
  "@types/lodash-es": "^4.17.12",
92
85
  "@types/webpack-node-externals": "^3.0.4",
93
- "@typescript-eslint/parser": "^8.57.0",
94
- "babel-plugin-module-resolver": "^5.0.2",
95
- "babel-preset-minify": "^0.5.2",
96
- "copyfiles": "^2.4.1",
86
+ "@typescript-eslint/parser": "^8.58.1",
87
+ "discord.js": "^14.26.2",
97
88
  "eslint": "^9.39.4",
98
89
  "eslint-config-prettier": "^10.1.8",
99
90
  "eslint-plugin-headers": "^1.3.4",
@@ -103,16 +94,41 @@
103
94
  "globals": "^17.4.0",
104
95
  "husky": "^9.1.7",
105
96
  "prettier": "^3.8.1",
106
- "tsc-alias": "^1.8.16",
107
- "typescript": "^5.9.3",
108
- "typescript-eslint": "^8.57.0"
97
+ "rollup": "^4.60.1",
98
+ "rollup-plugin-copy": "^3.5.0",
99
+ "rollup-plugin-dts": "^6.4.1",
100
+ "terser-webpack-plugin": "^5.4.0",
101
+ "tsconfig-paths-webpack-plugin": "^4.2.0",
102
+ "typescript": "^6.0.2",
103
+ "typescript-eslint": "^8.58.1",
104
+ "webpack": "^5.106.0",
105
+ "webpack-node-externals": "^3.0.0"
109
106
  },
110
107
  "peerDependencies": {
111
- "discord.js": "^14.17.3",
112
- "dotenv": "^16.4.7"
108
+ "discord.js": "^14.25.1",
109
+ "dotenv": "^16.4.7",
110
+ "swc-loader": "^0.2.7",
111
+ "terser-webpack-plugin": "^5.4.0",
112
+ "tsconfig-paths-webpack-plugin": "^4.2.0",
113
+ "webpack": "^5.106.0",
114
+ "webpack-node-externals": "^3.0.0"
113
115
  },
114
- "_moduleAliases": {
115
- "@src": "./dist"
116
+ "peerDependenciesMeta": {
117
+ "swc-loader": {
118
+ "optional": false
119
+ },
120
+ "terser-webpack-plugin": {
121
+ "optional": false
122
+ },
123
+ "tsconfig-paths-webpack-plugin": {
124
+ "optional": false
125
+ },
126
+ "webpack": {
127
+ "optional": false
128
+ },
129
+ "webpack-node-externals": {
130
+ "optional": false
131
+ }
116
132
  },
117
133
  "keywords": [
118
134
  "discord",
package/webpack.config.js CHANGED
@@ -19,8 +19,8 @@
19
19
  import path from 'path'
20
20
  import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'
21
21
  import TerserPlugin from 'terser-webpack-plugin'
22
- import { loadMeoCordConfig } from './dist/util/meocord-config-loader.util.js'
23
- import { prepareModifiedTsConfig } from './dist/util/tsconfig.util.js'
22
+ import { loadMeoCordConfig } from './dist/esm/util/meocord-config-loader.util.js'
23
+ import { prepareModifiedTsConfig } from './dist/esm/util/tsconfig.util.js'
24
24
  import nodeExternals from 'webpack-node-externals'
25
25
 
26
26
  const CWD = process.cwd()
@@ -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
- import { Command } from 'commander';
19
- export declare class GeneratorCLI {
20
- private appName;
21
- private logger;
22
- private controllerGeneratorHelper;
23
- private serviceGeneratorHelper;
24
- private guardGeneratorHelper;
25
- constructor(appName: string);
26
- register(program: Command): Command;
27
- private handleGenerateComponent;
28
- private handleGenerateController;
29
- }
@@ -1,17 +0,0 @@
1
- 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)}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 _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(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{Argument}from"commander";import{ControllerGeneratorHelper}from"./helper/controller-generator.helper.js";import{Logger}from"../common/index.js";import{ServiceGeneratorHelper}from"./helper/service-generator.helper.js";import{GuardGeneratorHelper}from"./helper/guard-generator.helper.js";import wait from"../util/wait.util.js";export var GeneratorCLI=/*#__PURE__*/function(){function GeneratorCLI(a){_classCallCheck(this,GeneratorCLI),this.appName=a,this.logger=new Logger(this.appName),this.controllerGeneratorHelper=new ControllerGeneratorHelper,this.serviceGeneratorHelper=new ServiceGeneratorHelper(this.appName),this.guardGeneratorHelper=new GuardGeneratorHelper(this.appName)}return _createClass(GeneratorCLI,[{key:"register",value:function register(a){var b=this,c=a.command("generate").alias("g").description("Generate components");return c.command("controller").alias("co").description("Generate a controller component").addArgument(new Argument("<type>","Type of the controller (e.g., button, context-menu, etc.)").choices(["button","context-menu","message","modal-submit","reaction","select-menu","slash"])).addArgument(new Argument("<name>","Name of the controller")).action(/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(a,c){return _regenerator().w(function(d){for(;1;)switch(d.n){case 0:return d.n=1,b.handleGenerateComponent({component:"controller",type:a,name:c});case 1:return d.a(2)}},_callee)}));return function(b,c){return a.apply(this,arguments)}}()),c.command("service").alias("s").addArgument(new Argument("<name>","Name of the service.")).description("Generate a service component").action(/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(a){return _regenerator().w(function(c){for(;1;)switch(c.n){case 0:return c.n=1,b.handleGenerateComponent({component:"service",name:a});case 1:return c.a(2)}},_callee2)}));return function(b){return a.apply(this,arguments)}}()),c.command("guard").alias("gu").addArgument(new Argument("<name>","Name of the guard.")).description("Generate a guard component").action(/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(a){return _regenerator().w(function(c){for(;1;)switch(c.n){case 0:return c.n=1,b.handleGenerateComponent({component:"guard",name:a});case 1:return c.a(2)}},_callee3)}));return function(b){return a.apply(this,arguments)}}()),a}},{key:"handleGenerateComponent",value:function(){function handleGenerateComponent(b){return a.apply(this,arguments)}var a=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(a){var b,c,d,e;return _regenerator().w(function(f){for(;1;)switch(f.n){case 0:if(b=a.component,c=a.name,d=a.type,c){f.n=2;break}return this.logger.error("Name is required"),f.n=1,wait(100);case 1:process.exit(1);case 2:e=b,f.n="controller"===e?3:"service"===e?7:"guard"===e?8:9;break;case 3:if(d){f.n=5;break}return this.logger.error("Type is required for controllers"),f.n=4,wait(100);case 4:process.exit(1);case 5:return f.n=6,this.handleGenerateController({name:c,type:d});case 6:return f.a(3,11);case 7:return this.serviceGeneratorHelper.generateService(c),f.a(3,11);case 8:return this.guardGeneratorHelper.generateGuard(c),f.a(3,11);case 9:return this.logger.error("Unsupported component type: ".concat(b)),f.n=10,wait(100);case 10:process.exit(1);case 11:return f.a(2)}},_callee4,this)}));return handleGenerateComponent}()},{key:"handleGenerateController",value:function(){function handleGenerateController(b){return a.apply(this,arguments)}var a=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(a){var b;return _regenerator().w(function(c){for(;1;)switch(c.p=c.n){case 0:c.p=0,this.controllerGeneratorHelper.generateController({controllerName:a.name},a.type),c.n=3;break;case 1:return c.p=1,b=c.v,this.logger.error("Error generating controller: ".concat(b instanceof Error?b.message:b+"")),c.n=2,wait(100);case 2:process.exit(1);case 3:return c.a(2)}},_callee5,this,[[0,1]])}));return handleGenerateController}()}])}();
@@ -1,67 +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 { ControllerType } from '../../enum/controller.enum.js';
19
- export declare class ControllerGeneratorHelper {
20
- /**
21
- * Generates a new controller file and an associated structure based on the provided arguments and controller type.
22
- * @param args - The arguments for generating the controller, including the optional controller name.
23
- * @param type - The type of the controller to generate, defined in the `ControllerType` enum.
24
- * @throws Will throw an error if the controller name is invalid or if the controller type is unsupported.
25
- */
26
- generateController(args: {
27
- controllerName: string | undefined;
28
- }, type: ControllerType): void;
29
- /**
30
- * Builds the controller template content by populating a template with variables.
31
- * @param className - The name of the controller class.
32
- * @param type - The type of the controller, defined in the `ControllerType` enum.
33
- * @returns The populated template string for the controller.
34
- * @throws Will throw an error if the controller type is unsupported.
35
- */
36
- buildControllerTemplate(className: string, type: ControllerType): string;
37
- /**
38
- * Retrieves the template configuration for a specific controller type and class name.
39
- * @param type - The type of the controller, defined in the `ControllerType` enum.
40
- * @param className - The name of the controller class.
41
- * @returns An object containing the template path and variables, or `undefined` if not found.
42
- */
43
- private getTemplateConfig;
44
- /**
45
- * Generates the controller file and its associated structure (e.g., builder files, directories).
46
- * @param controllerDir - The absolute path to the controller directory.
47
- * @param kebabCaseName - The kebab-case name of the controller file.
48
- * @param className - The name of the controller class.
49
- * @param type - The type of the controller, defined in the `ControllerType` enum.
50
- * @param controllerTemplate - The populated template string for the controller file.
51
- */
52
- private generateControllerStructure;
53
- /**
54
- * Generates a builder file for the specified controller type and stores it in the controller directory.
55
- * @param className - The name of the controller class.
56
- * @param type - The type of the controller, defined in the `ControllerType` enum.
57
- * @param controllerDir - The absolute path to the controller directory.
58
- */
59
- private generateBuilderFile;
60
- /**
61
- * Retrieves the configuration for generating a builder file based on the controller type and class name.
62
- * @param type - The type of the controller, defined in the `ControllerType` enum.
63
- * @param className - The name of the controller class.
64
- * @returns An object containing the builder template path and variables, or `undefined` if not found.
65
- */
66
- private getBuilderConfig;
67
- }
@@ -1,50 +0,0 @@
1
- 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)}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread 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 _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}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 _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(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 path from"path";import{ControllerType}from"../../enum/controller.enum.js";import{createDirectoryIfNotExists,generateFile,populateTemplate,validateAndFormatName}from"../../util/generator-cli.util.js";import{fileURLToPath}from"url";var __filename=fileURLToPath(import.meta.url),__dirname=path.dirname(__filename);export var ControllerGeneratorHelper=/*#__PURE__*/function(){function ControllerGeneratorHelper(){_classCallCheck(this,ControllerGeneratorHelper)}return _createClass(ControllerGeneratorHelper,[{key:"generateController",value:/**
18
- * Generates a new controller file and an associated structure based on the provided arguments and controller type.
19
- * @param args - The arguments for generating the controller, including the optional controller name.
20
- * @param type - The type of the controller to generate, defined in the `ControllerType` enum.
21
- * @throws Will throw an error if the controller name is invalid or if the controller type is unsupported.
22
- */function generateController(a,b){var c=validateAndFormatName(a.controllerName),d=c.parts,e=c.kebabCaseName,f=c.className,g=path.join.apply(path,[process.cwd(),"src","controllers",b].concat(_toConsumableArray(d))),h=this.buildControllerTemplate(f,b);this.generateControllerStructure(g,e,f,b,h)}/**
23
- * Builds the controller template content by populating a template with variables.
24
- * @param className - The name of the controller class.
25
- * @param type - The type of the controller, defined in the `ControllerType` enum.
26
- * @returns The populated template string for the controller.
27
- * @throws Will throw an error if the controller type is unsupported.
28
- */},{key:"buildControllerTemplate",value:function buildControllerTemplate(a,b){var c=this.getTemplateConfig(b,a);if(!c)throw new Error("Unsupported controller type: ".concat(b));return populateTemplate(c.template,c.variables)}/**
29
- * Retrieves the template configuration for a specific controller type and class name.
30
- * @param type - The type of the controller, defined in the `ControllerType` enum.
31
- * @param className - The name of the controller class.
32
- * @returns An object containing the template path and variables, or `undefined` if not found.
33
- */},{key:"getTemplateConfig",value:function getTemplateConfig(a,b){var c=path.resolve(__dirname,"..","builder-template","controller"),d=_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},ControllerType.BUTTON,"button.controller.template"),ControllerType.MODAL_SUBMIT,"modal-submit.controller.template"),ControllerType.SELECT_MENU,"select-menu.controller.template"),ControllerType.REACTION,"reaction.controller.template"),ControllerType.MESSAGE,"message.controller.template"),ControllerType.CONTEXT_MENU,"context-menu.controller.template"),ControllerType.SLASH,"slash.controller.template"),e=d[a]?path.resolve(c,d[a]):void 0;return e?{template:e,variables:{className:b}}:void 0}/**
34
- * Generates the controller file and its associated structure (e.g., builder files, directories).
35
- * @param controllerDir - The absolute path to the controller directory.
36
- * @param kebabCaseName - The kebab-case name of the controller file.
37
- * @param className - The name of the controller class.
38
- * @param type - The type of the controller, defined in the `ControllerType` enum.
39
- * @param controllerTemplate - The populated template string for the controller file.
40
- */},{key:"generateControllerStructure",value:function generateControllerStructure(a,b,c,d,e){this.generateBuilderFile(c,d,a),createDirectoryIfNotExists(a);var f=path.join(a,"".concat(b,".").concat(d,".controller.ts"));generateFile(f,e)}/**
41
- * Generates a builder file for the specified controller type and stores it in the controller directory.
42
- * @param className - The name of the controller class.
43
- * @param type - The type of the controller, defined in the `ControllerType` enum.
44
- * @param controllerDir - The absolute path to the controller directory.
45
- */},{key:"generateBuilderFile",value:function generateBuilderFile(a,b,c){var d=this.getBuilderConfig(b,a);if(d){var e=populateTemplate(d.template,d.variables),f=path.join(c,"builders");createDirectoryIfNotExists(f);var g=path.join(f,"sample.builder.ts");generateFile(g,e)}}/**
46
- * Retrieves the configuration for generating a builder file based on the controller type and class name.
47
- * @param type - The type of the controller, defined in the `ControllerType` enum.
48
- * @param className - The name of the controller class.
49
- * @returns An object containing the builder template path and variables, or `undefined` if not found.
50
- */},{key:"getBuilderConfig",value:function getBuilderConfig(a,b){var c=path.resolve(__dirname,"..","builder-template","builder"),d=_defineProperty(_defineProperty({},ControllerType.CONTEXT_MENU,"context-menu.builder.template"),ControllerType.SLASH,"slash.builder.template"),e=d[a]?path.resolve(c,d[a]):void 0;return e?{template:e,variables:{className:b}}:void 0}}])}();
@@ -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
- export declare class GuardGeneratorHelper {
19
- private readonly appName;
20
- private readonly logger;
21
- constructor(appName: string);
22
- /**
23
- * Generates a guard file based on the provided guard name.
24
- * Validates and formats the guard name, creates the necessary directories,
25
- * and generates the guard file using a predefined template.
26
- *
27
- * @param guardName - The name of the guard to generate.
28
- * It can include slashes for nested paths.
29
- * @throws Exits the process if the guard name is not provided or invalid.
30
- */
31
- generateGuard(guardName?: string): void;
32
- }
@@ -1,25 +0,0 @@
1
- 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)}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread 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 _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}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 _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(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 path from"path";import{Logger}from"../../common/index.js";import{buildTemplate,createDirectoryIfNotExists,generateFile,validateAndFormatName}from"../../util/generator-cli.util.js";export var GuardGeneratorHelper=/*#__PURE__*/function(){function GuardGeneratorHelper(a){_classCallCheck(this,GuardGeneratorHelper),this.appName=a,this.logger=new Logger(this.appName)}/**
18
- * Generates a guard file based on the provided guard name.
19
- * Validates and formats the guard name, creates the necessary directories,
20
- * and generates the guard file using a predefined template.
21
- *
22
- * @param guardName - The name of the guard to generate.
23
- * It can include slashes for nested paths.
24
- * @throws Exits the process if the guard name is not provided or invalid.
25
- */return _createClass(GuardGeneratorHelper,[{key:"generateGuard",value:function generateGuard(a){a||(this.logger.error("Guard name is required."),process.exit(1));var b=validateAndFormatName(a),c=b.parts,d=b.kebabCaseName,e=b.className,f=path.join.apply(path,[process.cwd(),"src","guards"].concat(_toConsumableArray(c))),g=path.join(f,"".concat(d,".guard.ts")),h=buildTemplate(e,"guard.template");createDirectoryIfNotExists(f),generateFile(g,h)}}])}();
@@ -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
- export declare class ServiceGeneratorHelper {
19
- private readonly appName;
20
- private readonly logger;
21
- constructor(appName: string);
22
- /**
23
- * Generates a service file based on the provided service name.
24
- * Validates and formats the service name, creates the necessary directories,
25
- * and generates the service file using a predefined template.
26
- *
27
- * @param serviceName - The name of the service to generate.
28
- * It can include slashes for nested paths.
29
- * @throws Exits the process if the service name is not provided or invalid.
30
- */
31
- generateService(serviceName?: string): void;
32
- }
@@ -1,25 +0,0 @@
1
- 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)}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread 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 _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}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 _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(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 path from"path";import{Logger}from"../../common/index.js";import{buildTemplate,createDirectoryIfNotExists,generateFile,validateAndFormatName}from"../../util/generator-cli.util.js";export var ServiceGeneratorHelper=/*#__PURE__*/function(){function ServiceGeneratorHelper(a){_classCallCheck(this,ServiceGeneratorHelper),this.appName=a,this.logger=new Logger(this.appName)}/**
18
- * Generates a service file based on the provided service name.
19
- * Validates and formats the service name, creates the necessary directories,
20
- * and generates the service file using a predefined template.
21
- *
22
- * @param serviceName - The name of the service to generate.
23
- * It can include slashes for nested paths.
24
- * @throws Exits the process if the service name is not provided or invalid.
25
- */return _createClass(ServiceGeneratorHelper,[{key:"generateService",value:function generateService(a){a||(this.logger.error("Service name is required."),process.exit(1));var b=validateAndFormatName(a),c=b.parts,d=b.kebabCaseName,e=b.className,f=path.join.apply(path,[process.cwd(),"src","services"].concat(_toConsumableArray(c))),g=path.join(f,"".concat(d,".service.ts")),h=buildTemplate(e,"service.template");createDirectoryIfNotExists(f),generateFile(g,h)}}])}();
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * MeoCord Framework
4
- * Copyright (C) 2025 Ukasyah Rahmatullah Zada
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
18
- */
19
- export {};