Skip to content

Commit

Permalink
fix: register aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Markkop committed Sep 20, 2024
1 parent 23a8b51 commit 38a2b2b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},
"main": "dist/bot.js",
"scripts": {
"start": "npm run build && node dist/bot.js",
"dev": "npm run build && ts-node src/bot.ts",
"start": "npm run build && node -r ./dist/registerAlias.js dist/bot.js",
"dev": "ts-node src/bot.ts",
"build": "tsc",
"import": "npm run build && ts-node src/importers/import.ts",
"lint": "eslint .",
Expand Down
1 change: 1 addition & 0 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { registerCommands } from '@utils/registerCommands'
import { Client, Guild, Intents, Interaction, Message, MessageReaction, TextChannel, User } from 'discord.js'
import express from 'express'
import 'module-alias/register'
import './registerAlias'
import ReactionService from './services/ReactionService'
import { handleInteractionError, handleMessageError, handleReactionError } from './utils/handleError'
require('dotenv').config()
Expand Down
11 changes: 11 additions & 0 deletions src/registerAlias.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { addAlias } from 'module-alias'
import path from 'path'

const rootPath = path.resolve(__dirname, '..')

addAlias('@types', path.join(rootPath, 'dist', 'types.js'))
addAlias('@stringsLang', path.join(rootPath, 'dist', 'stringsLang.js'))
addAlias('@managers', path.join(rootPath, 'dist', 'managers'))
addAlias('@commands', path.join(rootPath, 'dist', 'commands'))
addAlias('@baseCommands', path.join(rootPath, 'dist', 'baseCommands'))
addAlias('@utils', path.join(rootPath, 'dist', 'utils'))
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"module": "CommonJS",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop" : true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"outDir": "dist",
"rootDir": "src",
"outDir": "./dist",
"rootDir": "./src",
"baseUrl": "src/",
"paths": {
"@types": ["types.ts"],
Expand All @@ -19,4 +19,4 @@
}
},
"exclude": ["data", "tests", "tsconfig.json"]
}
}

0 comments on commit 38a2b2b

Please sign in to comment.