Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add module-alias dependencies; configure paths #560

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "1.0.0",
"description": "This is my first Discord bot made using [discord.js](https://github.com/discordjs/discord.js)",
"main": "dist/index.js",
"_moduleAliases": {
"@structures": "./dist/structures/index.js"
},
"scripts": {
"build": "tsc",
"prestart": "npm run build",
Expand All @@ -27,6 +30,7 @@
"homepage": "https://github.com/Spiderjockey02/Discord-Bot#readme",
"dependencies": {
"@prisma/client": "^5.13.0",
"@types/module-alias": "^2.0.4",
"@types/node": "^20.12.7",
"axios": "^1.5.0",
"canvacord": "^6.0.2",
Expand All @@ -39,6 +43,7 @@
"i18next": "^23.5.1",
"i18next-fs-backend": "^2.3.1",
"magmastream": "^2.4.0",
"module-alias": "^2.2.3",
"moment": "^2.29.1",
"mongoose": "^7.5.2",
"on-finished": "^2.4.1",
Expand Down
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Dependencies
import 'module-alias/register';
import { Logger } from './utils';
import { ShardingManager } from 'discord.js';
import { validateConfig } from './scripts/verify-config';
import config from './config';
// import config from './config';
const logger = new Logger();

(async () => {
Expand All @@ -22,8 +23,8 @@ const logger = new Logger();
logger.log('=-=-=-=-=-=-=- Loading shard(s) -=-=-=-=-=-=-=');
try {
await manager.spawn();
} catch (err: any) {
logger.error(`Error loading shards: ${err.message}`);
} catch (err: unknown) {
logger.error(`Error loading shards: ${(err as Error).message}`);
}

// Emitted when a shard is created
Expand Down
10 changes: 5 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"compileOnSave": true,
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@middleware/*": ["./src/middleware/*"],
},
"rootDir": "./src",
"types": ["node"],
"outDir": "./dist",
Expand All @@ -31,7 +27,11 @@
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"verbatimModuleSyntax": false,
"resolveJsonModule": true
"resolveJsonModule": true,
"baseUrl": "./src",
"paths": {
"@structures": ["./structures/index"],
},
},
"exclude": ["node_modules"],
}