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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,41 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.2.2] - 2026-04-09
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **Breaking:** Migrate build system from Babel to Rollup. Output structure changed from `dist/` to `dist/{esm,cjs,types}/`. Package exports updated accordingly.
|
|
13
|
+
- Replace Babel with Rollup for faster ESM, CJS, and declaration builds.
|
|
14
|
+
- Move `discord.js` from dependencies to peer dependencies only, preventing duplicate package installs in consumer projects.
|
|
15
|
+
- Replace webpack-based TypeScript config compilation with jiti runtime loader for faster startup and no temp file generation.
|
|
16
|
+
- Update tsconfig.json for Rollup compatibility with `NodeNext` module resolution.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Resolve webpack config path in CLI after dist structure change.
|
|
21
|
+
- Resolve circular dependency between `core/meocord.app.ts` and `decorator/app.decorator.ts`.
|
|
22
|
+
- Extract context validation in `@UseGuard` to a type predicate function to eliminate redundant `instanceof` check warnings.
|
|
23
|
+
|
|
24
|
+
### Documentation
|
|
25
|
+
|
|
26
|
+
- Update README to reflect dual ESM/CJS module support.
|
|
27
|
+
|
|
28
|
+
## [1.2.2-0] - 2026-04-09
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- **Breaking:** Migrate build system from Babel to Rollup. Output structure changed from `dist/` to `dist/{esm,cjs,types}/`. Package exports updated accordingly. ([33d77b4](https://github.com/l7aromeo/meocord/commit/33d77b4))
|
|
33
|
+
- Replace Babel with Rollup for faster ESM, CJS, and declaration builds. ([33d77b4](https://github.com/l7aromeo/meocord/commit/33d77b4))
|
|
34
|
+
- Move `discord.js` from dependencies to peer dependencies only, preventing duplicate package installs in consumer projects. ([33d77b4](https://github.com/l7aromeo/meocord/commit/33d77b4))
|
|
35
|
+
- Replace webpack-based TypeScript config compilation with jiti runtime loader for faster startup and no temp file generation. ([923e01f](https://github.com/l7aromeo/meocord/commit/923e01f))
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- Resolve webpack config path in CLI after dist structure change. ([b80f770](https://github.com/l7aromeo/meocord/commit/b80f770))
|
|
40
|
+
- Resolve circular dependency between `core/meocord.app.ts` and `decorator/app.decorator.ts`. ([ac01d34](https://github.com/l7aromeo/meocord/commit/ac01d34))
|
|
41
|
+
- Extract context validation in `@UseGuard` to a type predicate function to eliminate redundant `instanceof` check warnings. ([fa3b18c](https://github.com/l7aromeo/meocord/commit/fa3b18c))
|
|
42
|
+
|
|
8
43
|
## [1.2.1] - 2026-03-18
|
|
9
44
|
|
|
10
45
|
### Fixed
|
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@ While still growing, MeoCord provides a solid foundation for developers to creat
|
|
|
11
11
|
- [Features](#features)
|
|
12
12
|
- [Getting Started](#getting-started)
|
|
13
13
|
- [Project Structure](#project-structure)
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
- [Example Structure](#example-structure)
|
|
15
|
+
- [Key Components](#key-components)
|
|
16
16
|
- [Configuration](#configuration)
|
|
17
17
|
- [Getting Started](#getting-started)
|
|
18
18
|
- [Prerequisites](#prerequisites)
|
|
@@ -27,36 +27,29 @@ While still growing, MeoCord provides a solid foundation for developers to creat
|
|
|
27
27
|
|
|
28
28
|
## Features
|
|
29
29
|
|
|
30
|
-
- **Powerful CLI Tools**
|
|
30
|
+
- **Powerful CLI Tools**
|
|
31
31
|
Easily manage, build, and run projects using an intuitive CLI. Simplify tasks such as scaffolding components, building
|
|
32
32
|
applications, and starting bots in development/production modes.
|
|
33
|
-
|
|
34
|
-
- **Modular Design**
|
|
33
|
+
- **Modular Design**
|
|
35
34
|
Embrace modularity by organizing application logic into distinct components like controllers and services. This
|
|
36
35
|
approach enhances scalability, improves maintainability, and simplifies future development.
|
|
37
|
-
|
|
38
|
-
- **Built-in Decorators**
|
|
36
|
+
- **Built-in Decorators**
|
|
39
37
|
Simplify and extend bot behavior through a robust decorator system. Leverage built-in decorators for streamlined
|
|
40
38
|
functionality.
|
|
41
|
-
|
|
42
|
-
- **Specialized Services**
|
|
39
|
+
- **Specialized Services**
|
|
43
40
|
Register specialized services using the `@MeoCord` decorator. For example, add a RabbitMQ service to listen for events
|
|
44
41
|
and trigger actions, such as sending Discord messages. This promotes modularity, flexibility, and seamless integration
|
|
45
42
|
of custom services.
|
|
46
|
-
|
|
47
|
-
- **Seamless Discord.js Integration**
|
|
43
|
+
- **Seamless Discord.js Integration**
|
|
48
44
|
Built on top of Discord.js to provide full support for the Discord API, with added features like activity management,
|
|
49
45
|
intents, partials, and custom client options.
|
|
50
|
-
|
|
51
|
-
- **TypeScript-First Approach**
|
|
46
|
+
- **TypeScript-First Approach**
|
|
52
47
|
Designed with TypeScript in mind, offering strict type safety, interfaces, and decorators to empower modern
|
|
53
48
|
development workflows.
|
|
54
|
-
|
|
55
|
-
- **Extensible Webpack Integration**
|
|
49
|
+
- **Extensible Webpack Integration**
|
|
56
50
|
Easily customize your build process using an exposed Webpack configuration hook. Add rules, plugins, or modify setups
|
|
57
51
|
to match your project's requirements.
|
|
58
|
-
|
|
59
|
-
- **Dynamic Activity Support**
|
|
52
|
+
- **Dynamic Activity Support**
|
|
60
53
|
Manage bot presence dynamically, such as setting activities (e.g., "Playing X with Y") or linking bot status to
|
|
61
54
|
real-time events.
|
|
62
55
|
|
|
@@ -70,67 +63,75 @@ While still growing, MeoCord provides a solid foundation for developers to creat
|
|
|
70
63
|
- **TypeScript**: Version **5.7** or above is required for compatibility with modern features.
|
|
71
64
|
- **Yarn**: Version stable **4.7** (`corepack enable && yarn set version stable`) or above is strongly recommended for managing dependencies and smooth builds.
|
|
72
65
|
|
|
73
|
-
###
|
|
66
|
+
### Module Support
|
|
74
67
|
|
|
75
|
-
**MeoCord**
|
|
68
|
+
**MeoCord** supports both **ESM** (`import`) and **CommonJS** (`require`) consumption:
|
|
76
69
|
|
|
70
|
+
- The package exports dual module formats via `dist/esm/` (ESM) and `dist/cjs/` (CommonJS), with type declarations in `dist/types/`.
|
|
77
71
|
- New projects generated with the `meocord create` CLI are already configured for ESM, so no additional setup is required.
|
|
78
|
-
- **If you are migrating an existing CommonJS-based project
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
- **If you are migrating an existing CommonJS-based project**, you can still use MeoCord with your existing setup. If you prefer ESM:
|
|
73
|
+
1. Add `"type": "module"` to your `package.json`:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"name": "your-project",
|
|
78
|
+
"version": "1.0.0",
|
|
79
|
+
"type": "module",
|
|
80
|
+
"dependencies": {
|
|
81
|
+
"meocord": "^x.x.x"
|
|
88
82
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
2. If your codebase uses `require()` statements, replace them with `import` statements to ensure compatibility with
|
|
86
|
+
ESM:
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
// Before (CommonJS)
|
|
90
|
+
const Package = require('any-package');
|
|
91
|
+
|
|
92
|
+
// After (ESM)
|
|
93
|
+
import Package from 'any-package';
|
|
94
|
+
```
|
|
95
|
+
3. Update your `tsconfig.json` file to ensure compatibility with ESM:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"compilerOptions": {
|
|
100
|
+
"module": "ESNext",
|
|
101
|
+
"target": "ESNext",
|
|
102
|
+
"moduleResolution": "Bundler",
|
|
103
|
+
"strict": true,
|
|
104
|
+
"strictNullChecks": true,
|
|
105
|
+
"strictBindCallApply": true,
|
|
106
|
+
"strictPropertyInitialization": false,
|
|
107
|
+
"forceConsistentCasingInFileNames": true,
|
|
108
|
+
"noFallthroughCasesInSwitch": true,
|
|
109
|
+
"emitDecoratorMetadata": true,
|
|
110
|
+
"experimentalDecorators": true,
|
|
111
|
+
"resolveJsonModule": true,
|
|
112
|
+
"verbatimModuleSyntax": true,
|
|
113
|
+
"noUnusedLocals": true,
|
|
114
|
+
"noUnusedParameters": true,
|
|
115
|
+
"skipLibCheck": true,
|
|
116
|
+
"noImplicitAny": false,
|
|
117
|
+
"noEmit": true,
|
|
118
|
+
"outDir": "./dist",
|
|
119
|
+
"rootDir": "./src",
|
|
120
|
+
"paths": {
|
|
121
|
+
"@src/*": ["./src/*"]
|
|
122
122
|
},
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
"types": ["node"]
|
|
124
|
+
},
|
|
125
|
+
"include": ["src/**/*.ts"],
|
|
126
|
+
"exclude": [
|
|
127
|
+
"meocord.config.ts",
|
|
128
|
+
"dist",
|
|
129
|
+
"jest.config.ts",
|
|
130
|
+
"node_modules"
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
4. Rename files to use `.mjs` if necessary, or adapt them to ESM-compatible `.js` while ensuring that `"type": "module"` is set in your `package.json`.
|
|
134
135
|
|
|
135
136
|
For more migration details, refer to the [Node.js ESM documentation](https://nodejs.org/api/esm.html).
|
|
136
137
|
|
|
@@ -146,7 +147,7 @@ Follow these steps to create and run a **MeoCord** application:
|
|
|
146
147
|
|
|
147
148
|
Use the CLI to generate your application.
|
|
148
149
|
|
|
149
|
-
```shell
|
|
150
|
+
```shell
|
|
150
151
|
npx meocord create <your-app-name>
|
|
151
152
|
```
|
|
152
153
|
|
|
@@ -173,13 +174,15 @@ Use the CLI to start your application.
|
|
|
173
174
|
|
|
174
175
|
- **Development Mode**:
|
|
175
176
|
Run in development mode:
|
|
176
|
-
|
|
177
|
+
|
|
178
|
+
```shell
|
|
177
179
|
yarn start:dev
|
|
178
180
|
```
|
|
179
181
|
|
|
180
182
|
- **Production Mode**:
|
|
181
183
|
Run in production mode with fresh production build:
|
|
182
|
-
|
|
184
|
+
|
|
185
|
+
```shell
|
|
183
186
|
yarn start:prod --build # use arg `--build` if not built yet or use `yarn build:prod` first
|
|
184
187
|
```
|
|
185
188
|
|
|
@@ -190,6 +193,7 @@ yarn start:prod --build # use arg `--build` if not built yet or use `yarn buil
|
|
|
190
193
|
When using MeoCord, the expected project structure is as follows:
|
|
191
194
|
|
|
192
195
|
### Example Structure
|
|
196
|
+
|
|
193
197
|
```
|
|
194
198
|
.
|
|
195
199
|
.
|
|
@@ -225,23 +229,24 @@ This structure ensures clear separation of concerns and scalable project archite
|
|
|
225
229
|
### Key Components
|
|
226
230
|
|
|
227
231
|
1. **Entry Point** (`src/main.ts`):
|
|
228
|
-
- The main application logic, where you initialize and run the app.
|
|
229
232
|
|
|
233
|
+
- The main application logic, where you initialize and run the app.
|
|
230
234
|
2. **Application Configuration** (`src/app.ts`):
|
|
231
|
-
- Acts as the central configuration point, where controllers, services, client options, and other metadata are defined.
|
|
232
|
-
- Ties all modular components (controllers, specialized services, activities, etc.) together to define the core structure of the app.
|
|
233
235
|
|
|
236
|
+
- Acts as the central configuration point, where controllers, services, client options, and other metadata are defined.
|
|
237
|
+
- Ties all modular components (controllers, specialized services, activities, etc.) together to define the core structure of the app.
|
|
234
238
|
3. **Controllers** (`src/controllers`):
|
|
235
|
-
- Build feature-specific logic (e.g., context menus, message handling in bots).
|
|
236
239
|
|
|
240
|
+
- Build feature-specific logic (e.g., context menus, message handling in bots).
|
|
237
241
|
4. **Services** (`src/services`):
|
|
238
|
-
- Core business logic and reusable service definitions.
|
|
239
242
|
|
|
243
|
+
- Core business logic and reusable service definitions.
|
|
240
244
|
5. **Guards** (`src/guards`):
|
|
241
|
-
- Middleware-like services for pre-execution logic (e.g., rate-limiting, authorization).
|
|
242
245
|
|
|
246
|
+
- Middleware-like services for pre-execution logic (e.g., rate-limiting, authorization).
|
|
243
247
|
6. **Assets** (`src/assets`):
|
|
244
|
-
|
|
248
|
+
|
|
249
|
+
- Fonts, images, and other static files for your application.
|
|
245
250
|
|
|
246
251
|
---
|
|
247
252
|
|
|
@@ -306,56 +311,55 @@ export default {
|
|
|
306
311
|
```
|
|
307
312
|
|
|
308
313
|
- **Line-by-Line Explanation**:
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
6. **Return Configuration**:
|
|
349
|
-
Ensures the final configuration satisfies the `MeoCordConfig` type, guaranteeing that all required properties are
|
|
350
|
-
correctly defined.
|
|
314
|
+
1. **Environment Variable Loading**:
|
|
315
|
+
The `load-env.util` ensures that environment variables from `.env` files are loaded before executing the app. *(This utility internally uses the `dotenv` package to load variables from `.env` files. For example, a `.env`
|
|
316
|
+
file containing `TOKEN=your-discord-bot-token` makes `process.env.TOKEN` accessible in the application).*
|
|
317
|
+
**Example of `load-env.util`:**
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
import { config } from 'dotenv';
|
|
321
|
+
import path from 'path';
|
|
322
|
+
|
|
323
|
+
const getEnvFilePath = (): string => {
|
|
324
|
+
switch (process.env.NODE_ENV) {
|
|
325
|
+
case 'production':
|
|
326
|
+
return '.env.prod';
|
|
327
|
+
default:
|
|
328
|
+
return '.env.dev';
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
const envFilePath = path.resolve(process.cwd(), getEnvFilePath());
|
|
333
|
+
|
|
334
|
+
config({
|
|
335
|
+
path: envFilePath,
|
|
336
|
+
encoding: 'utf8',
|
|
337
|
+
});
|
|
338
|
+
```
|
|
339
|
+
2. **Import Configuration Interface**:
|
|
340
|
+
Imports the `MeoCordConfig` interface to enforce type safety on the configuration object.
|
|
341
|
+
3. **Application Name**:
|
|
342
|
+
The `appName` defines the name of the bot or application.
|
|
343
|
+
4. **Discord Token**:
|
|
344
|
+
The `discordToken` property retrieves the bot's token from the environment variables, ensuring security and
|
|
345
|
+
flexibility.
|
|
346
|
+
5. **Custom Webpack Configuration**:
|
|
347
|
+
Adds an optional function to modify and extend the default Webpack configuration, including custom module rules
|
|
348
|
+
or plugins.
|
|
349
|
+
6. **Return Configuration**:
|
|
350
|
+
Ensures the final configuration satisfies the `MeoCordConfig` type, guaranteeing that all required properties are
|
|
351
|
+
correctly defined.
|
|
351
352
|
|
|
352
353
|
---
|
|
353
354
|
|
|
354
355
|
## CLI Usage
|
|
356
|
+
|
|
355
357
|
### Overview
|
|
358
|
+
|
|
356
359
|
The **MeoCord CLI** is designed to help you manage, build, and run your application seamlessly. It provides essential commands and options to streamline your workflow.
|
|
357
360
|
|
|
358
361
|
#### Viewing All Commands and Options
|
|
362
|
+
|
|
359
363
|
To ensure you see the most accurate and complete list of commands and options, always refer to the help menu by running:
|
|
360
364
|
|
|
361
365
|
```shell
|
|
@@ -399,43 +403,53 @@ Available Commands:
|
|
|
399
403
|
```
|
|
400
404
|
|
|
401
405
|
### Key Commands Overview
|
|
406
|
+
|
|
402
407
|
The following section provides details for frequently used commands, but note that **additional commands** may be available by running `meocord --help`.
|
|
403
408
|
|
|
404
409
|
#### `meocord build`
|
|
410
|
+
|
|
405
411
|
Builds the application in **production** or **development** mode.
|
|
406
412
|
|
|
407
413
|
**Usage:**
|
|
414
|
+
|
|
408
415
|
```shell
|
|
409
416
|
yarn meocord build --prod # Build for production
|
|
410
417
|
yarn meocord build --dev # Build for development
|
|
411
418
|
```
|
|
412
419
|
|
|
413
420
|
#### `meocord start`
|
|
421
|
+
|
|
414
422
|
Starts the application with options for either a **production** or **development** environment. The application can also build automatically before starting.
|
|
415
423
|
|
|
416
424
|
**Usage:**
|
|
425
|
+
|
|
417
426
|
```shell
|
|
418
427
|
yarn meocord start --build --prod # Start in production mode with fresh production build
|
|
419
428
|
yarn meocord start --dev # Start in development mode (will always fresh build)
|
|
420
429
|
```
|
|
421
430
|
|
|
422
431
|
#### `meocord generate` (Alias: `meocord g`)
|
|
432
|
+
|
|
423
433
|
Scaffolds application components such as controllers, services, and other elements.
|
|
424
434
|
|
|
425
435
|
**Usage:**
|
|
436
|
+
|
|
426
437
|
```text
|
|
427
438
|
yarn meocord generate|g [options] [command]
|
|
428
439
|
```
|
|
429
440
|
|
|
430
441
|
**Example:**
|
|
442
|
+
|
|
431
443
|
```shell
|
|
432
444
|
yarn meocord g co slash "user"
|
|
433
445
|
```
|
|
446
|
+
|
|
434
447
|
This command will generate a `user` slash controller.
|
|
435
448
|
|
|
436
449
|
---
|
|
437
450
|
|
|
438
451
|
For detailed usage of any particular command, append the `--help` flag to it. For instance:
|
|
452
|
+
|
|
439
453
|
```shell
|
|
440
454
|
yarn meocord g --help
|
|
441
455
|
```
|
|
@@ -511,41 +525,38 @@ yarn meocord start --prod
|
|
|
511
525
|
|
|
512
526
|
We welcome contributions to improve **MeoCord**. Here's how you can get started:
|
|
513
527
|
|
|
514
|
-
1. **Fork the Repository**:
|
|
528
|
+
1. **Fork the Repository**:
|
|
515
529
|
Click the "Fork" button in the top-right corner of the repository page to create your copy of the project.
|
|
516
|
-
|
|
517
|
-
2. **Create a Feature Branch**:
|
|
530
|
+
2. **Create a Feature Branch**:
|
|
518
531
|
Use the following command to create a branch for your changes:
|
|
519
532
|
|
|
520
533
|
```textmate
|
|
521
534
|
git checkout -b feature/your-feature-name
|
|
522
535
|
```
|
|
523
|
-
|
|
524
|
-
3. **Make Meaningful Commits**:
|
|
536
|
+
3. **Make Meaningful Commits**:
|
|
525
537
|
Commit your changes with clear, descriptive, and concise messages that explain what your changes do:
|
|
526
538
|
|
|
527
539
|
```textmate
|
|
528
540
|
git commit -m "feat: add [brief description of your feature or fix]"
|
|
529
541
|
```
|
|
530
|
-
|
|
531
|
-
4. **Push Your Changes**:
|
|
542
|
+
4. **Push Your Changes**:
|
|
532
543
|
Push your branch to your forked repository with this command:
|
|
533
544
|
|
|
534
545
|
```textmate
|
|
535
546
|
git push origin feature/your-feature-name
|
|
536
547
|
```
|
|
537
|
-
|
|
538
548
|
5. **Open a Pull Request (PR)**:
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
549
|
+
|
|
550
|
+
- Navigate to the original **MeoCord** repository.
|
|
551
|
+
- Click "Compare & Pull Request."
|
|
552
|
+
- Provide a descriptive title and a detailed description of your changes.
|
|
542
553
|
|
|
543
554
|
Be sure to include:
|
|
544
|
-
- The purpose of your changes.
|
|
545
|
-
- Any relevant details or links.
|
|
546
|
-
- Steps to reproduce/test the changes, if applicable.
|
|
547
555
|
|
|
548
|
-
|
|
556
|
+
- The purpose of your changes.
|
|
557
|
+
- Any relevant details or links.
|
|
558
|
+
- Steps to reproduce/test the changes, if applicable.
|
|
559
|
+
6. **Engage in Reviews**:
|
|
549
560
|
Work with maintainers to address any feedback or changes they request.
|
|
550
561
|
|
|
551
562
|
Thank you for helping make **MeoCord** better!
|
|
@@ -557,6 +568,7 @@ Thank you for helping make **MeoCord** better!
|
|
|
557
568
|
**MeoCord Framework** is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.txt).
|
|
558
569
|
|
|
559
570
|
**Key conditions:**
|
|
571
|
+
|
|
560
572
|
- You can freely use, modify, and distribute the framework under the terms of GPL v3.
|
|
561
573
|
- If you distribute derivatives of this software, the source code must also remain freely available under the same GPL v3 terms.
|
|
562
574
|
|