meocord 1.2.5 → 1.3.0
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/README.md +20 -23
- package/dist/cjs/_shared/{meocord.app-q-erWOUy.cjs → meocord.app-Bt4fq4mq.cjs} +15 -12
- package/dist/cjs/core/index.cjs +2 -1
- package/dist/cjs/decorator/index.cjs +2 -1
- package/dist/esm/bin/meocord.js +82 -30
- package/dist/esm/core/meocord.app.js +15 -12
- package/dist/esm/package.json.js +1 -1
- package/dist/esm/util/package-manager.util.js +25 -0
- package/meocord.eslint.mjs +4 -5
- package/package.json +14 -11
- package/CHANGELOG.md +0 -255
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ While still growing, MeoCord provides a solid foundation for developers to creat
|
|
|
61
61
|
|
|
62
62
|
- **Node.js**: Ensure you have version **22.14.0** or higher, as it’s the current LTS release.
|
|
63
63
|
- **TypeScript**: Version **5.7** or above is required for compatibility with modern features.
|
|
64
|
-
- **
|
|
64
|
+
- **Bun**: Version **1.x** or above is required as the package manager.
|
|
65
65
|
|
|
66
66
|
### Module Support
|
|
67
67
|
|
|
@@ -176,14 +176,14 @@ Use the CLI to start your application.
|
|
|
176
176
|
Run in development mode:
|
|
177
177
|
|
|
178
178
|
```shell
|
|
179
|
-
|
|
179
|
+
bun start:dev
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
- **Production Mode**:
|
|
183
183
|
Run in production mode with fresh production build:
|
|
184
184
|
|
|
185
185
|
```shell
|
|
186
|
-
|
|
186
|
+
bun start:prod --build # use arg `--build` if not built yet or use `bun build:prod` first
|
|
187
187
|
```
|
|
188
188
|
|
|
189
189
|
---
|
|
@@ -199,7 +199,6 @@ When using MeoCord, the expected project structure is as follows:
|
|
|
199
199
|
.
|
|
200
200
|
├── .gitignore
|
|
201
201
|
├── .prettierrc.mjs
|
|
202
|
-
├── .yarnrc.yml
|
|
203
202
|
├── eslint.config.mjs
|
|
204
203
|
├── meocord.config.ts
|
|
205
204
|
├── package.json
|
|
@@ -219,7 +218,7 @@ When using MeoCord, the expected project structure is as follows:
|
|
|
219
218
|
│ └── services
|
|
220
219
|
│ └── sample.service.ts
|
|
221
220
|
├── tsconfig.json
|
|
222
|
-
└──
|
|
221
|
+
└── bun.lock
|
|
223
222
|
```
|
|
224
223
|
|
|
225
224
|
This structure ensures clear separation of concerns and scalable project architecture.
|
|
@@ -363,13 +362,13 @@ The **MeoCord CLI** is designed to help you manage, build, and run your applicat
|
|
|
363
362
|
To ensure you see the most accurate and complete list of commands and options, always refer to the help menu by running:
|
|
364
363
|
|
|
365
364
|
```shell
|
|
366
|
-
|
|
365
|
+
bun meocord --help
|
|
367
366
|
```
|
|
368
367
|
|
|
369
368
|
Below is an example of the help display output:
|
|
370
369
|
|
|
371
370
|
```textmate
|
|
372
|
-
❯
|
|
371
|
+
❯ bun meocord --help
|
|
373
372
|
MeoCord Copyright (C) 2025 Ukasyah Rahmatullah Zada
|
|
374
373
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `meocord show -w'.
|
|
375
374
|
This is free software, and you are welcome to redistribute it
|
|
@@ -413,8 +412,8 @@ Builds the application in **production** or **development** mode.
|
|
|
413
412
|
**Usage:**
|
|
414
413
|
|
|
415
414
|
```shell
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
bun meocord build --prod # Build for production
|
|
416
|
+
bun meocord build --dev # Build for development
|
|
418
417
|
```
|
|
419
418
|
|
|
420
419
|
#### `meocord start`
|
|
@@ -424,8 +423,8 @@ Starts the application with options for either a **production** or **development
|
|
|
424
423
|
**Usage:**
|
|
425
424
|
|
|
426
425
|
```shell
|
|
427
|
-
|
|
428
|
-
|
|
426
|
+
bun meocord start --build --prod # Start in production mode with fresh production build
|
|
427
|
+
bun meocord start --dev # Start in development mode (will always fresh build)
|
|
429
428
|
```
|
|
430
429
|
|
|
431
430
|
#### `meocord generate` (Alias: `meocord g`)
|
|
@@ -435,13 +434,13 @@ Scaffolds application components such as controllers, services, and other elemen
|
|
|
435
434
|
**Usage:**
|
|
436
435
|
|
|
437
436
|
```text
|
|
438
|
-
|
|
437
|
+
bun meocord generate|g [options] [command]
|
|
439
438
|
```
|
|
440
439
|
|
|
441
440
|
**Example:**
|
|
442
441
|
|
|
443
442
|
```shell
|
|
444
|
-
|
|
443
|
+
bun meocord g co slash "user"
|
|
445
444
|
```
|
|
446
445
|
|
|
447
446
|
This command will generate a `user` slash controller.
|
|
@@ -451,7 +450,7 @@ This command will generate a `user` slash controller.
|
|
|
451
450
|
For detailed usage of any particular command, append the `--help` flag to it. For instance:
|
|
452
451
|
|
|
453
452
|
```shell
|
|
454
|
-
|
|
453
|
+
bun meocord g --help
|
|
455
454
|
```
|
|
456
455
|
|
|
457
456
|
This will provide command-specific help and options.
|
|
@@ -465,7 +464,7 @@ This will provide command-specific help and options.
|
|
|
465
464
|
Run the application in development mode with live-reload for a seamless coding experience:
|
|
466
465
|
|
|
467
466
|
```shell
|
|
468
|
-
|
|
467
|
+
bun meocord start --dev
|
|
469
468
|
```
|
|
470
469
|
|
|
471
470
|
### Building for Production
|
|
@@ -473,7 +472,7 @@ yarn meocord start --dev
|
|
|
473
472
|
Generate an optimized and compiled production build with:
|
|
474
473
|
|
|
475
474
|
```shell
|
|
476
|
-
|
|
475
|
+
bun meocord build --prod
|
|
477
476
|
```
|
|
478
477
|
|
|
479
478
|
Once built, you can deploy or run the application efficiently.
|
|
@@ -485,19 +484,19 @@ Once built, you can deploy or run the application efficiently.
|
|
|
485
484
|
Install all necessary dependencies, including development dependencies, before building:
|
|
486
485
|
|
|
487
486
|
```shell
|
|
488
|
-
|
|
487
|
+
bun install --frozen-lockfile
|
|
489
488
|
```
|
|
490
489
|
|
|
491
490
|
Generate an optimized and compiled production build:
|
|
492
491
|
|
|
493
492
|
```shell
|
|
494
|
-
|
|
493
|
+
bun meocord build --prod
|
|
495
494
|
```
|
|
496
495
|
|
|
497
496
|
Clean up and focus on production-only dependencies:
|
|
498
497
|
|
|
499
498
|
```shell
|
|
500
|
-
|
|
499
|
+
bun install --production
|
|
501
500
|
```
|
|
502
501
|
|
|
503
502
|
Ensure the following essential files and folders are prepared for deployment on the server:
|
|
@@ -507,16 +506,14 @@ Ensure the following essential files and folders are prepared for deployment on
|
|
|
507
506
|
├── dist
|
|
508
507
|
├── node_modules (production dependencies only)
|
|
509
508
|
├── .env (if applicable, ensure it contains necessary variables)
|
|
510
|
-
├── .yarn (optional: exclude cache if not required)
|
|
511
|
-
├── .yarnrc.yml
|
|
512
509
|
├── package.json
|
|
513
|
-
└──
|
|
510
|
+
└── bun.lock
|
|
514
511
|
```
|
|
515
512
|
|
|
516
513
|
Start the application in production mode on the server:
|
|
517
514
|
|
|
518
515
|
```shell
|
|
519
|
-
|
|
516
|
+
bun meocord start --prod
|
|
520
517
|
```
|
|
521
518
|
|
|
522
519
|
---
|
|
@@ -6,6 +6,7 @@ require('reflect-metadata');
|
|
|
6
6
|
var inversify = require('inversify');
|
|
7
7
|
var enum_index = require('../enum/index.cjs');
|
|
8
8
|
var lodashEs = require('lodash-es');
|
|
9
|
+
var Table = require('cli-table3');
|
|
9
10
|
|
|
10
11
|
const mainContainer = new inversify.Container();
|
|
11
12
|
|
|
@@ -279,23 +280,25 @@ class MeoCordApp {
|
|
|
279
280
|
try {
|
|
280
281
|
if (this.bot.application) {
|
|
281
282
|
await this.bot.application.commands.set(builders);
|
|
282
|
-
|
|
283
|
+
const table = new Table({
|
|
284
|
+
head: [
|
|
285
|
+
'Name',
|
|
286
|
+
'Type',
|
|
287
|
+
'Sub-commands'
|
|
288
|
+
]
|
|
289
|
+
});
|
|
290
|
+
for (const builder of builders){
|
|
283
291
|
const json = typeof builder.toJSON === 'function' ? builder.toJSON() : builder;
|
|
284
292
|
const typeName = json?.type === 1 ? 'SlashCommand' : json?.type === 2 ? 'UserContextMenu' : json?.type === 3 ? 'MessageContextMenu' : builder instanceof discord_js.SlashCommandBuilder ? 'SlashCommand' : 'Command';
|
|
285
|
-
const subCommands = Array.isArray(json?.options) && json.options.length ? json.options.map((opt)=>({
|
|
286
|
-
name: opt.name,
|
|
287
|
-
options: opt.options.map((opt)=>opt.name)
|
|
288
|
-
})) : undefined;
|
|
289
293
|
const name = json?.name || builder.name;
|
|
290
|
-
|
|
291
|
-
|
|
294
|
+
const subCommands = Array.isArray(json?.options) && json.options.length ? json.options.map((opt)=>opt.name).join(', ') : '';
|
|
295
|
+
table.push([
|
|
292
296
|
name,
|
|
297
|
+
typeName,
|
|
293
298
|
subCommands
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
};
|
|
298
|
-
}));
|
|
299
|
+
]);
|
|
300
|
+
}
|
|
301
|
+
this.logger.log(`Registered ${builders.length} bot commands:\n${table.toString()}`);
|
|
299
302
|
}
|
|
300
303
|
} catch (error) {
|
|
301
304
|
this.logger.error('Error during command registration:', error);
|
package/dist/cjs/core/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('reflect-metadata');
|
|
4
4
|
var theme = require('../_shared/theme-TAjboxtz.cjs');
|
|
5
|
-
var meocord_app = require('../_shared/meocord.app-
|
|
5
|
+
var meocord_app = require('../_shared/meocord.app-Bt4fq4mq.cjs');
|
|
6
6
|
require('inversify');
|
|
7
7
|
require('discord.js');
|
|
8
8
|
require('path');
|
|
@@ -15,6 +15,7 @@ require('dayjs/plugin/timezone.js');
|
|
|
15
15
|
require('chalk');
|
|
16
16
|
require('../enum/index.cjs');
|
|
17
17
|
require('lodash-es');
|
|
18
|
+
require('cli-table3');
|
|
18
19
|
|
|
19
20
|
class MeoCordFactory {
|
|
20
21
|
static create(target) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('reflect-metadata');
|
|
4
|
-
var meocord_app = require('../_shared/meocord.app-
|
|
4
|
+
var meocord_app = require('../_shared/meocord.app-Bt4fq4mq.cjs');
|
|
5
5
|
var inversify = require('inversify');
|
|
6
6
|
var discord_js = require('discord.js');
|
|
7
7
|
var theme = require('../_shared/theme-TAjboxtz.cjs');
|
|
8
8
|
require('../enum/index.cjs');
|
|
9
9
|
require('lodash-es');
|
|
10
|
+
require('cli-table3');
|
|
10
11
|
require('node:util');
|
|
11
12
|
require('dayjs');
|
|
12
13
|
require('dayjs/plugin/utc.js');
|
package/dist/esm/bin/meocord.js
CHANGED
|
@@ -12,8 +12,9 @@ import { setEnvironment, compileAndValidateConfig } from '../util/common.util.js
|
|
|
12
12
|
import { prepareModifiedTsConfig } from '../util/tsconfig.util.js';
|
|
13
13
|
import { Command } from 'commander';
|
|
14
14
|
import { simpleGit } from 'simple-git';
|
|
15
|
-
import chalk from 'chalk';
|
|
16
15
|
import { execSync } from 'child_process';
|
|
16
|
+
import * as p from '@clack/prompts';
|
|
17
|
+
import { detectInstalledPMs, getInstallCommand } from '../util/package-manager.util.js';
|
|
17
18
|
import { ensureReady, configureCommandHelp } from '../util/meocord-cli.util.js';
|
|
18
19
|
import packageJson from '../package.json.js';
|
|
19
20
|
import { fileURLToPath } from 'url';
|
|
@@ -65,7 +66,7 @@ For full license details, refer to:
|
|
|
65
66
|
`);
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
|
-
program.command('create <app-name>').description('Create a new MeoCord application').action(async (appName)=>await this.createApp(appName));
|
|
69
|
+
program.command('create <app-name>').description('Create a new MeoCord application').option('--use-npm', 'Use npm as the package manager').option('--use-yarn', 'Use Yarn as the package manager').option('--use-pnpm', 'Use pnpm as the package manager').option('--use-bun', 'Use Bun as the package manager').action(async (appName, options)=>await this.createApp(appName, options));
|
|
69
70
|
program.command('build').description('Build the application').option('-d, --dev', 'Build in development mode').option('-p, --prod', 'Build in production mode').action(async (options)=>{
|
|
70
71
|
await ensureReady();
|
|
71
72
|
const mode = options.prod ? 'production' : 'development';
|
|
@@ -91,55 +92,105 @@ For full license details, refer to:
|
|
|
91
92
|
configureCommandHelp(program);
|
|
92
93
|
program.showHelpAfterError().parse(process.argv);
|
|
93
94
|
}
|
|
94
|
-
async createApp(appName) {
|
|
95
|
+
async createApp(appName, options) {
|
|
95
96
|
const kebabCaseAppName = appName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
96
97
|
const appPath = path.resolve(process.cwd(), kebabCaseAppName);
|
|
97
98
|
const gitRepo = 'https://github.com/l7aromeo/meocord-template.git';
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
p.intro(`meocord v${this.version}`);
|
|
100
|
+
// Validate directory
|
|
101
|
+
if (fs.existsSync(appPath)) {
|
|
102
|
+
p.cancel(`Directory "${kebabCaseAppName}" already exists.`);
|
|
103
|
+
await wait(100);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
// Check Node.js version
|
|
107
|
+
const MINIMUM_NODE_VERSION = '22.14.0';
|
|
108
|
+
const [major, minor, patch] = process.version.slice(1).split('.').map(Number);
|
|
109
|
+
const [minMajor, minMinor, minPatch] = MINIMUM_NODE_VERSION.split('.').map(Number);
|
|
110
|
+
if (major < minMajor || major === minMajor && minor < minMinor || major === minMajor && minor === minMinor && patch < minPatch) {
|
|
111
|
+
p.cancel(`Node.js v${MINIMUM_NODE_VERSION} or higher is required. Current: ${process.version}`);
|
|
112
|
+
await wait(100);
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
// Determine package manager
|
|
116
|
+
const installedPMs = detectInstalledPMs();
|
|
117
|
+
let pm;
|
|
118
|
+
const flagMap = {
|
|
119
|
+
useNpm: 'npm',
|
|
120
|
+
useYarn: 'yarn',
|
|
121
|
+
usePnpm: 'pnpm',
|
|
122
|
+
useBun: 'bun'
|
|
123
|
+
};
|
|
124
|
+
const selectedFlag = Object.entries(flagMap).find(([key])=>options[key]);
|
|
125
|
+
if (selectedFlag) {
|
|
126
|
+
pm = selectedFlag[1];
|
|
127
|
+
if (!installedPMs.includes(pm)) {
|
|
128
|
+
p.cancel(`${pm} is not installed.`);
|
|
103
129
|
await wait(100);
|
|
104
130
|
process.exit(1);
|
|
105
131
|
}
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
132
|
+
} else {
|
|
133
|
+
const defaultPM = installedPMs.includes('bun') ? 'bun' : 'npm';
|
|
134
|
+
const selected = await p.select({
|
|
135
|
+
message: 'Which package manager do you want to use?',
|
|
136
|
+
options: installedPMs.map((name)=>({
|
|
137
|
+
value: name,
|
|
138
|
+
label: name,
|
|
139
|
+
hint: name === defaultPM ? 'default' : undefined
|
|
140
|
+
})),
|
|
141
|
+
initialValue: defaultPM
|
|
142
|
+
});
|
|
143
|
+
if (p.isCancel(selected)) {
|
|
144
|
+
p.cancel('Operation cancelled.');
|
|
145
|
+
process.exit(0);
|
|
114
146
|
}
|
|
115
|
-
|
|
116
|
-
|
|
147
|
+
pm = selected;
|
|
148
|
+
}
|
|
149
|
+
const s = p.spinner();
|
|
150
|
+
// Clone template
|
|
151
|
+
s.start(`Creating a new MeoCord app: ${kebabCaseAppName}`);
|
|
152
|
+
try {
|
|
117
153
|
await simpleGit().clone(gitRepo, appPath);
|
|
118
|
-
|
|
119
|
-
|
|
154
|
+
} catch (error) {
|
|
155
|
+
s.stop('Failed to fetch template.');
|
|
156
|
+
p.cancel(error instanceof Error ? error.message : String(error));
|
|
157
|
+
await wait(100);
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
s.stop(`App created at: ${appPath}`);
|
|
161
|
+
// Initialize git
|
|
162
|
+
s.start('Initializing Git repository...');
|
|
163
|
+
try {
|
|
120
164
|
fs.rmSync(path.join(appPath, '.git'), {
|
|
121
165
|
recursive: true,
|
|
122
166
|
force: true
|
|
123
167
|
});
|
|
124
|
-
// Initialize a new Git repository
|
|
125
|
-
console.info(chalk.blueBright('🔧 Initializing Git repository...'));
|
|
126
168
|
const git = simpleGit(appPath);
|
|
127
169
|
await git.init();
|
|
128
170
|
await git.add('./*');
|
|
129
171
|
await git.commit('Initial commit');
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
172
|
+
} catch (error) {
|
|
173
|
+
s.stop('Failed to initialize Git.');
|
|
174
|
+
p.cancel(error instanceof Error ? error.message : String(error));
|
|
175
|
+
await wait(100);
|
|
176
|
+
process.exit(1);
|
|
177
|
+
}
|
|
178
|
+
s.stop('Git repository initialized.');
|
|
179
|
+
// Install dependencies
|
|
180
|
+
s.start(`Installing dependencies with ${pm}...`);
|
|
181
|
+
try {
|
|
182
|
+
execSync(getInstallCommand(pm), {
|
|
183
|
+
cwd: appPath,
|
|
184
|
+
stdio: 'ignore'
|
|
135
185
|
});
|
|
136
|
-
console.log(chalk.green('✔ Dependencies installed successfully.'));
|
|
137
|
-
console.log(chalk.greenBright(`🎉 MeoCord app "${chalk.bold(kebabCaseAppName)}" is ready!`));
|
|
138
186
|
} catch (error) {
|
|
139
|
-
|
|
187
|
+
s.stop('Failed to install dependencies.');
|
|
188
|
+
p.cancel(error instanceof Error ? error.message : String(error));
|
|
140
189
|
await wait(100);
|
|
141
190
|
process.exit(1);
|
|
142
191
|
}
|
|
192
|
+
s.stop('Dependencies installed.');
|
|
193
|
+
p.outro(`MeoCord app "${kebabCaseAppName}" is ready!`);
|
|
143
194
|
}
|
|
144
195
|
/**
|
|
145
196
|
* Builds the MeoCord application in the specified mode.
|
|
@@ -287,6 +338,7 @@ For full license details, refer to:
|
|
|
287
338
|
try {
|
|
288
339
|
this.clearConsole();
|
|
289
340
|
this.logger.log('Starting watch mode...');
|
|
341
|
+
await this.compileConfig();
|
|
290
342
|
const webpackConfig = (await import(this.webpackConfigPath)).default;
|
|
291
343
|
const compiler = webpack({
|
|
292
344
|
...webpackConfig,
|
|
@@ -6,6 +6,7 @@ import { mainContainer } from '../decorator/container.js';
|
|
|
6
6
|
import { sample } from 'lodash-es';
|
|
7
7
|
import { createErrorEmbed } from '../util/embed.util.js';
|
|
8
8
|
import { ReactionHandlerAction, CommandType } from '../enum/controller.enum.js';
|
|
9
|
+
import CliTable3 from 'cli-table3';
|
|
9
10
|
|
|
10
11
|
class MeoCordApp {
|
|
11
12
|
async start() {
|
|
@@ -58,23 +59,25 @@ class MeoCordApp {
|
|
|
58
59
|
try {
|
|
59
60
|
if (this.bot.application) {
|
|
60
61
|
await this.bot.application.commands.set(builders);
|
|
61
|
-
|
|
62
|
+
const table = new CliTable3({
|
|
63
|
+
head: [
|
|
64
|
+
'Name',
|
|
65
|
+
'Type',
|
|
66
|
+
'Sub-commands'
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
for (const builder of builders){
|
|
62
70
|
const json = typeof builder.toJSON === 'function' ? builder.toJSON() : builder;
|
|
63
71
|
const typeName = json?.type === 1 ? 'SlashCommand' : json?.type === 2 ? 'UserContextMenu' : json?.type === 3 ? 'MessageContextMenu' : builder instanceof SlashCommandBuilder ? 'SlashCommand' : 'Command';
|
|
64
|
-
const subCommands = Array.isArray(json?.options) && json.options.length ? json.options.map((opt)=>({
|
|
65
|
-
name: opt.name,
|
|
66
|
-
options: opt.options.map((opt)=>opt.name)
|
|
67
|
-
})) : undefined;
|
|
68
72
|
const name = json?.name || builder.name;
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
const subCommands = Array.isArray(json?.options) && json.options.length ? json.options.map((opt)=>opt.name).join(', ') : '';
|
|
74
|
+
table.push([
|
|
71
75
|
name,
|
|
76
|
+
typeName,
|
|
72
77
|
subCommands
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
}));
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
this.logger.log(`Registered ${builders.length} bot commands:\n${table.toString()}`);
|
|
78
81
|
}
|
|
79
82
|
} catch (error) {
|
|
80
83
|
this.logger.error('Error during command registration:', error);
|
package/dist/esm/package.json.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
|
|
3
|
+
const ALL_PACKAGE_MANAGERS = [
|
|
4
|
+
'bun',
|
|
5
|
+
'npm',
|
|
6
|
+
'yarn',
|
|
7
|
+
'pnpm'
|
|
8
|
+
];
|
|
9
|
+
function detectInstalledPMs() {
|
|
10
|
+
return ALL_PACKAGE_MANAGERS.filter((pm)=>{
|
|
11
|
+
try {
|
|
12
|
+
execSync(`which ${pm}`, {
|
|
13
|
+
stdio: 'ignore'
|
|
14
|
+
});
|
|
15
|
+
return true;
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function getInstallCommand(pm) {
|
|
22
|
+
return `${pm} install`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { detectInstalledPMs, getInstallCommand };
|
package/meocord.eslint.mjs
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import
|
|
19
|
+
import { importX } from 'eslint-plugin-import-x'
|
|
20
20
|
import globals from 'globals'
|
|
21
21
|
import tsParser from '@typescript-eslint/parser'
|
|
22
22
|
import eslintTs from 'typescript-eslint'
|
|
@@ -40,7 +40,7 @@ const languageOptions = {
|
|
|
40
40
|
export const typescriptConfig = {
|
|
41
41
|
files: tsFiles,
|
|
42
42
|
plugins: {
|
|
43
|
-
import:
|
|
43
|
+
'import-x': importX,
|
|
44
44
|
prettier: eslintPluginPrettier,
|
|
45
45
|
},
|
|
46
46
|
languageOptions: {
|
|
@@ -48,10 +48,10 @@ export const typescriptConfig = {
|
|
|
48
48
|
parser: tsParser,
|
|
49
49
|
},
|
|
50
50
|
settings: {
|
|
51
|
-
'import/parsers': {
|
|
51
|
+
'import-x/parsers': {
|
|
52
52
|
'@typescript-eslint/parser': ['.ts'],
|
|
53
53
|
},
|
|
54
|
-
'import/resolver': {
|
|
54
|
+
'import-x/resolver': {
|
|
55
55
|
typescript: {
|
|
56
56
|
alwaysTryTypes: true,
|
|
57
57
|
project: './tsconfig.json',
|
|
@@ -59,7 +59,6 @@ export const typescriptConfig = {
|
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
61
|
rules: {
|
|
62
|
-
...importPlugin.configs.typescript.rules,
|
|
63
62
|
'prettier/prettier': 'error',
|
|
64
63
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
65
64
|
'@typescript-eslint/ban-ts-comment': 'off',
|
package/package.json
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
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.
|
|
5
|
-
"packageManager": "yarn@4.12.0",
|
|
4
|
+
"version": "1.3.0",
|
|
6
5
|
"type": "module",
|
|
7
6
|
"scripts": {
|
|
8
7
|
"lint": "eslint --fix . && tsc --noEmit",
|
|
9
8
|
"build": "rm -rf ./dist && rollup -c",
|
|
10
|
-
"publish:prerelease": "./prepublish.sh && yarn build && yarn version -i prerelease && yarn npm publish --tag next",
|
|
11
|
-
"publish:patch": "./prepublish.sh && yarn build && yarn version -i patch && yarn npm publish --tag latest",
|
|
12
|
-
"publish:minor": "./prepublish.sh && yarn build && yarn version -i minor && yarn npm publish --tag latest",
|
|
13
|
-
"publish:premajor": "./prepublish.sh && yarn build && yarn version -i premajor && yarn npm publish --tag next",
|
|
14
|
-
"publish:major": "./prepublish.sh && yarn build && yarn version -i major && yarn npm publish --tag latest",
|
|
15
9
|
"prepare": "husky"
|
|
16
10
|
},
|
|
17
11
|
"bin": "./dist/esm/bin/meocord.js",
|
|
@@ -62,6 +56,7 @@
|
|
|
62
56
|
"README.md"
|
|
63
57
|
],
|
|
64
58
|
"dependencies": {
|
|
59
|
+
"@clack/prompts": "^1.2.0",
|
|
65
60
|
"@swc/core": "1.15.24",
|
|
66
61
|
"chalk": "^5.6.2",
|
|
67
62
|
"cli-table3": "^0.6.5",
|
|
@@ -81,19 +76,23 @@
|
|
|
81
76
|
"webpack-node-externals": "^3.0.0"
|
|
82
77
|
},
|
|
83
78
|
"devDependencies": {
|
|
84
|
-
"@eslint/js": "^
|
|
79
|
+
"@eslint/js": "^10.0.1",
|
|
85
80
|
"@rollup/plugin-alias": "^6.0.0",
|
|
86
81
|
"@rollup/plugin-json": "^6.1.0",
|
|
87
82
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
88
83
|
"@rollup/plugin-swc": "^0.4.0",
|
|
84
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
85
|
+
"@semantic-release/exec": "^7.1.0",
|
|
86
|
+
"@semantic-release/github": "^12.0.6",
|
|
87
|
+
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
89
88
|
"@types/lodash-es": "^4.17.12",
|
|
90
89
|
"@types/webpack-node-externals": "^3.0.4",
|
|
91
90
|
"@typescript-eslint/parser": "^8.58.1",
|
|
92
91
|
"discord.js": "^14.26.2",
|
|
93
|
-
"eslint": "^
|
|
92
|
+
"eslint": "^10.2.0",
|
|
94
93
|
"eslint-config-prettier": "^10.1.8",
|
|
95
94
|
"eslint-plugin-headers": "^1.3.4",
|
|
96
|
-
"eslint-plugin-import": "^
|
|
95
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
97
96
|
"eslint-plugin-prettier": "^5.5.5",
|
|
98
97
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
99
98
|
"globals": "^17.4.0",
|
|
@@ -102,6 +101,7 @@
|
|
|
102
101
|
"rollup": "^4.60.1",
|
|
103
102
|
"rollup-plugin-copy": "^3.5.0",
|
|
104
103
|
"rollup-plugin-dts": "^6.4.1",
|
|
104
|
+
"semantic-release": "^25.0.3",
|
|
105
105
|
"typescript": "^6.0.2",
|
|
106
106
|
"typescript-eslint": "^8.58.1"
|
|
107
107
|
},
|
|
@@ -109,6 +109,9 @@
|
|
|
109
109
|
"discord.js": "^14.17.3",
|
|
110
110
|
"dotenv": "^16.4.7"
|
|
111
111
|
},
|
|
112
|
+
"publishConfig": {
|
|
113
|
+
"provenance": true
|
|
114
|
+
},
|
|
112
115
|
"keywords": [
|
|
113
116
|
"discord",
|
|
114
117
|
"discord-bot",
|
|
@@ -120,4 +123,4 @@
|
|
|
120
123
|
"meocord",
|
|
121
124
|
"scalable-bots"
|
|
122
125
|
]
|
|
123
|
-
}
|
|
126
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [1.2.5] - 2026-04-09
|
|
9
|
-
|
|
10
|
-
### Fixed
|
|
11
|
-
|
|
12
|
-
- Use webpack `mode: 'none'` for config compilation to prevent `DefinePlugin` from replacing `process.env.NODE_ENV` with a string literal, which caused the compiled config to always load the production env file. ([91d8a04](https://github.com/l7aromeo/meocord/commit/91d8a04))
|
|
13
|
-
|
|
14
|
-
## [1.2.4] - 2026-04-09
|
|
15
|
-
|
|
16
|
-
### Fixed
|
|
17
|
-
|
|
18
|
-
- Compile `meocord.config.ts` to `dist/meocord.config.mjs` during `meocord build` so the config can be loaded at runtime without requiring `tsconfig.json`, source files, or path alias resolution. Fixes `@MeoCord` decorator failing with "No container found" in Docker and other environments where only `dist/` is present. ([2765dc8](https://github.com/l7aromeo/meocord/commit/2765dc8))
|
|
19
|
-
- Cache loaded config in `loadMeoCordConfig()` to avoid repeated jiti calls on every invocation (e.g., logger reading `appName` on each log line). ([2765dc8](https://github.com/l7aromeo/meocord/commit/2765dc8))
|
|
20
|
-
|
|
21
|
-
## [1.2.3] - 2026-04-09
|
|
22
|
-
|
|
23
|
-
### Fixed
|
|
24
|
-
|
|
25
|
-
- Move webpack build tools back to dependencies so `meocord start --dev` works automatically after `yarn add meocord` without requiring manual peer dependency installation. ([8fd1ca8](https://github.com/l7aromeo/meocord/commit/8fd1ca8))
|
|
26
|
-
- Add missing `discord.js` and related dev dependencies to package.json. ([449685a](https://github.com/l7aromeo/meocord/commit/449685a))
|
|
27
|
-
|
|
28
|
-
## [1.2.2] - 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.
|
|
33
|
-
- Replace Babel with Rollup for faster ESM, CJS, and declaration builds.
|
|
34
|
-
- Move `discord.js` from dependencies to peer dependencies only, preventing duplicate package installs in consumer projects.
|
|
35
|
-
- Replace webpack-based TypeScript config compilation with jiti runtime loader for faster startup and no temp file generation.
|
|
36
|
-
- Update tsconfig.json for Rollup compatibility with `NodeNext` module resolution.
|
|
37
|
-
|
|
38
|
-
### Fixed
|
|
39
|
-
|
|
40
|
-
- Resolve webpack config path in CLI after dist structure change.
|
|
41
|
-
- Resolve circular dependency between `core/meocord.app.ts` and `decorator/app.decorator.ts`.
|
|
42
|
-
- Extract context validation in `@UseGuard` to a type predicate function to eliminate redundant `instanceof` check warnings.
|
|
43
|
-
|
|
44
|
-
### Documentation
|
|
45
|
-
|
|
46
|
-
- Update README to reflect dual ESM/CJS module support.
|
|
47
|
-
|
|
48
|
-
## [1.2.2-0] - 2026-04-09
|
|
49
|
-
|
|
50
|
-
### Changed
|
|
51
|
-
|
|
52
|
-
- **Breaking:** Migrate build system from Babel to Rollup. Output structure changed from `dist/` to `dist/{esm,cjs,types}/`. Package exports updated accordingly. ([7601ff3](https://github.com/l7aromeo/meocord/commit/7601ff3))
|
|
53
|
-
- Replace Babel with Rollup for faster ESM, CJS, and declaration builds. ([7601ff3](https://github.com/l7aromeo/meocord/commit/7601ff3))
|
|
54
|
-
- Move `discord.js` from dependencies to peer dependencies only, preventing duplicate package installs in consumer projects. ([7601ff3](https://github.com/l7aromeo/meocord/commit/7601ff3))
|
|
55
|
-
- Replace webpack-based TypeScript config compilation with jiti runtime loader for faster startup and no temp file generation. ([268869b](https://github.com/l7aromeo/meocord/commit/268869b))
|
|
56
|
-
|
|
57
|
-
### Fixed
|
|
58
|
-
|
|
59
|
-
- Resolve webpack config path in CLI after dist structure change. ([76fcc96](https://github.com/l7aromeo/meocord/commit/76fcc96))
|
|
60
|
-
- Resolve circular dependency between `core/meocord.app.ts` and `decorator/app.decorator.ts`. ([69b63ec](https://github.com/l7aromeo/meocord/commit/69b63ec))
|
|
61
|
-
- Extract context validation in `@UseGuard` to a type predicate function to eliminate redundant `instanceof` check warnings. ([1c1cdb4](https://github.com/l7aromeo/meocord/commit/1c1cdb4))
|
|
62
|
-
|
|
63
|
-
## [1.2.1] - 2026-03-18
|
|
64
|
-
|
|
65
|
-
### Fixed
|
|
66
|
-
|
|
67
|
-
- Fix graceful shutdown requiring double Ctrl+C to fully exit by properly handling SIGINT across parent and child processes. ([293377b](https://github.com/l7aromeo/meocord/commit/293377b))
|
|
68
|
-
- Clear activity `setInterval` on shutdown to prevent it from keeping the process alive. ([293377b](https://github.com/l7aromeo/meocord/commit/293377b))
|
|
69
|
-
- Remove unnecessary `wait()` delays in shutdown path for faster exit. ([293377b](https://github.com/l7aromeo/meocord/commit/293377b))
|
|
70
|
-
- Add force-exit on second Ctrl+C at all process levels to prevent hanging when `bot.destroy()` stalls. ([293377b](https://github.com/l7aromeo/meocord/commit/293377b))
|
|
71
|
-
- Propagate child process exit code to parent instead of always exiting with 0. ([293377b](https://github.com/l7aromeo/meocord/commit/293377b))
|
|
72
|
-
|
|
73
|
-
## [1.2.0] - 2026-03-11
|
|
74
|
-
|
|
75
|
-
### Added
|
|
76
|
-
|
|
77
|
-
- feat(core): support modal submit in interaction dynamic params ([4f372b8](https://github.com/l7aromeo/meocord/commit/4f372b8709e0a164f80cce7d0d3e7dd64a3cd5f0))
|
|
78
|
-
|
|
79
|
-
### Fixed
|
|
80
|
-
|
|
81
|
-
- Fix Webpack `ExternalItem` type mismatch in `meocord-config-loader.util.ts`.
|
|
82
|
-
|
|
83
|
-
### Changed
|
|
84
|
-
|
|
85
|
-
- chore(deps): bump multiple dependencies ([a70d9e4](https://github.com/l7aromeo/meocord/commit/a70d9e405452553c6a40750b98658fd2403951a8))
|
|
86
|
-
|
|
87
|
-
## [1.1.0] - 2026-01-27
|
|
88
|
-
|
|
89
|
-
### Added
|
|
90
|
-
|
|
91
|
-
- Add support for `UseGuard` to be used directly for class.
|
|
92
|
-
- Add support for `Message` and `MessageReaction` handlers in `UseGuard` and `Guard` decorators.
|
|
93
|
-
|
|
94
|
-
### Changed
|
|
95
|
-
|
|
96
|
-
- Update dependencies.
|
|
97
|
-
- Refactor dependency injection container to avoid circular dependencies.
|
|
98
|
-
|
|
99
|
-
## [1.0.18-0] - 2026-01-26
|
|
100
|
-
|
|
101
|
-
### Added
|
|
102
|
-
|
|
103
|
-
- Add support for `UseGuard` to be used directly for class.
|
|
104
|
-
- Support for `Message` and `MessageReaction` handlers in `UseGuard` and `Guard` decorators.
|
|
105
|
-
|
|
106
|
-
### Changed
|
|
107
|
-
|
|
108
|
-
- Update dependencies.
|
|
109
|
-
- Refactor dependency injection container to avoid circular dependencies.
|
|
110
|
-
|
|
111
|
-
## [1.0.17] - 2025-12-29
|
|
112
|
-
|
|
113
|
-
### Fixed
|
|
114
|
-
|
|
115
|
-
- Improve webpack compiler error handling and add keep-alive workaround for Bun.
|
|
116
|
-
|
|
117
|
-
### Changed
|
|
118
|
-
|
|
119
|
-
- Update ESLint config to ignore `.yarn` directory.
|
|
120
|
-
|
|
121
|
-
## [1.0.16] - 2025-12-24
|
|
122
|
-
|
|
123
|
-
### Changed
|
|
124
|
-
|
|
125
|
-
- Update `@swc/core`, `inversify`, `lodash-es`, `webpack`, and ESLint/TypeScript-ESLint related dependencies to their
|
|
126
|
-
latest versions.
|
|
127
|
-
|
|
128
|
-
## [1.0.15] - 2025-12-12
|
|
129
|
-
|
|
130
|
-
### Added
|
|
131
|
-
|
|
132
|
-
- Add multiple publish scripts for versioning and prepublish tasks.
|
|
133
|
-
|
|
134
|
-
### Changed
|
|
135
|
-
|
|
136
|
-
- Update dependencies and bump Yarn version.
|
|
137
|
-
|
|
138
|
-
## [1.0.14] - 2025-10-30
|
|
139
|
-
|
|
140
|
-
### Fixed
|
|
141
|
-
|
|
142
|
-
- Remove debug logging for command registration.
|
|
143
|
-
|
|
144
|
-
## [1.0.13] - 2025-10-30
|
|
145
|
-
|
|
146
|
-
### Fixed
|
|
147
|
-
|
|
148
|
-
- Enhance command registration logging with type and subcommand details.
|
|
149
|
-
|
|
150
|
-
## [1.0.12] - 2025-10-27
|
|
151
|
-
|
|
152
|
-
### Fixed
|
|
153
|
-
|
|
154
|
-
- Rename event listener from 'ready' to 'clientReady' in bot.
|
|
155
|
-
|
|
156
|
-
### Changed
|
|
157
|
-
|
|
158
|
-
- Update dependencies.
|
|
159
|
-
|
|
160
|
-
## [1.0.11] - 2025-10-14
|
|
161
|
-
|
|
162
|
-
### Added
|
|
163
|
-
|
|
164
|
-
- Integrate SWC for faster TypeScript compilation.
|
|
165
|
-
|
|
166
|
-
## [1.0.10] - 2025-04-21
|
|
167
|
-
|
|
168
|
-
### Fixed
|
|
169
|
-
|
|
170
|
-
- Remove 'clean' property from output config to prevent build errors.
|
|
171
|
-
|
|
172
|
-
### Refactored
|
|
173
|
-
|
|
174
|
-
- Modularize TypeScript config compilation in `config-loader`.
|
|
175
|
-
|
|
176
|
-
## [1.0.9] - 2025-04-20
|
|
177
|
-
|
|
178
|
-
### Fixed
|
|
179
|
-
|
|
180
|
-
- Ensure temporary build files survive output cleaning.
|
|
181
|
-
|
|
182
|
-
## [1.0.8] - 2025-04-20
|
|
183
|
-
|
|
184
|
-
### Refactored
|
|
185
|
-
|
|
186
|
-
- Improve `TerserPlugin` option handling in webpack config.
|
|
187
|
-
|
|
188
|
-
## [1.0.7] - 2025-04-20
|
|
189
|
-
|
|
190
|
-
### Changed
|
|
191
|
-
|
|
192
|
-
- Remove unused packages.
|
|
193
|
-
|
|
194
|
-
### Refactored
|
|
195
|
-
|
|
196
|
-
- Improve webpack config generation for clarity and flexibility.
|
|
197
|
-
|
|
198
|
-
## [1.0.6] - 2025-03-28
|
|
199
|
-
|
|
200
|
-
### Added
|
|
201
|
-
|
|
202
|
-
- Add support for multiple command handlers with the same identifier in interactions.
|
|
203
|
-
|
|
204
|
-
## [1.0.5] - 2025-03-22
|
|
205
|
-
|
|
206
|
-
### Refactored
|
|
207
|
-
|
|
208
|
-
- Replace `container.resolve` with `container.get` using autobind for controllers.
|
|
209
|
-
|
|
210
|
-
## [1.0.4] - 2025-03-20
|
|
211
|
-
|
|
212
|
-
### Changed
|
|
213
|
-
|
|
214
|
-
- Bump dependencies in `yarn.lock` for Babel, TypeScript-ESLint, ESLint, and InversifyJS.
|
|
215
|
-
|
|
216
|
-
### Refactored
|
|
217
|
-
|
|
218
|
-
- Update Inversify usage and guard resolution logic with autobind and streamlined imports.
|
|
219
|
-
|
|
220
|
-
## [1.0.3] - 2025-03-14
|
|
221
|
-
|
|
222
|
-
### Fixed
|
|
223
|
-
|
|
224
|
-
- Improve kebab-case normalization for app names in `createApp` method.
|
|
225
|
-
|
|
226
|
-
## [1.0.2] - 2025-03-14
|
|
227
|
-
|
|
228
|
-
### Added
|
|
229
|
-
|
|
230
|
-
- Add Node.js version check when creating a new MeoCord app.
|
|
231
|
-
|
|
232
|
-
### Changed
|
|
233
|
-
|
|
234
|
-
- Update `packageManager` to `yarn@4.7.0`.
|
|
235
|
-
|
|
236
|
-
### Fixed
|
|
237
|
-
|
|
238
|
-
- Normalize app name to kebab-case when creating a new MeoCord app.
|
|
239
|
-
- Enable corepack before installing dependencies.
|
|
240
|
-
|
|
241
|
-
### Documentation
|
|
242
|
-
|
|
243
|
-
- Update README with prerequisites and app creation guide.
|
|
244
|
-
|
|
245
|
-
## [1.0.1] - 2025-03-12
|
|
246
|
-
|
|
247
|
-
### Documentation
|
|
248
|
-
|
|
249
|
-
- Remove `verbatimModuleSyntax` setting from README.
|
|
250
|
-
|
|
251
|
-
## [1.0.0] - 2025-03-11
|
|
252
|
-
|
|
253
|
-
### Fixed
|
|
254
|
-
|
|
255
|
-
- Update regex to allow alphanumeric parameter names.
|