diff --git a/jest.config.js b/jest.config.js index 5e73182..b5d24e7 100644 --- a/jest.config.js +++ b/jest.config.js @@ -14,6 +14,7 @@ module.exports = { "node" ], moduleNameMapper: { - '^@/(.*)$': '/src/$1' + '^@/(.*)$': '/src/$1', + '@root/(.*)$': '/$1' } }; diff --git a/src/commands/_template.ts b/src/commands/_template.ts index ed4af29..63c0ab8 100644 --- a/src/commands/_template.ts +++ b/src/commands/_template.ts @@ -1,5 +1,5 @@ +import ICommand from '@/library/interfaces/iCommand'; import { Message } from 'discord.js'; -import ICommand from '../library/interfaces/iCommand'; // Hack for implementing with static properties/methods let CommandName: ICommand; diff --git a/src/commands/add.ts b/src/commands/add.ts index ae53084..fdf810f 100644 --- a/src/commands/add.ts +++ b/src/commands/add.ts @@ -1,5 +1,5 @@ import { Message } from "discord.js"; -import ICommand from "../library/interfaces/iCommand"; +import ICommand from "@/library/interfaces/iCommand"; let Add: ICommand; diff --git a/src/commands/format.ts b/src/commands/format.ts index f9a1f52..3a4aaae 100644 --- a/src/commands/format.ts +++ b/src/commands/format.ts @@ -1,5 +1,5 @@ import { Message } from 'discord.js'; -import ICommand from '../library/interfaces/iCommand'; +import ICommand from '@/library/interfaces/iCommand'; // Hack for implementing with static properties/methods let Format: ICommand; diff --git a/src/commands/gitProfile.ts b/src/commands/gitProfile.ts index bea514e..2f5c40d 100644 --- a/src/commands/gitProfile.ts +++ b/src/commands/gitProfile.ts @@ -1,7 +1,7 @@ import axios from 'axios'; import { Message } from 'discord.js'; import moment from 'moment'; -import ICommand from '../library/interfaces/iCommand'; +import ICommand from '@/library/interfaces/iCommand'; import IGithubProfile from './interfaces/iGithubProfile'; let GitProfile: ICommand; diff --git a/src/commands/help.ts b/src/commands/help.ts index 00844f1..cfe5c66 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -1,7 +1,7 @@ import { Message } from 'discord.js'; -import config from '../config'; -import Commands from '../library/commands'; -import ICommand from '../library/interfaces/iCommand'; +import config from '@/config'; +import Commands from '@/library/commands'; +import ICommand from '@/library/interfaces/iCommand'; let Help: ICommand; diff --git a/src/commands/lmgtfy.ts b/src/commands/lmgtfy.ts index 9b2ad79..d1887cd 100644 --- a/src/commands/lmgtfy.ts +++ b/src/commands/lmgtfy.ts @@ -1,5 +1,5 @@ import { Message } from 'discord.js'; -import ICommand from '../library/interfaces/iCommand'; +import ICommand from '@/library/interfaces/iCommand'; let Lmgtfy: ICommand; diff --git a/src/commands/magic8ball.ts b/src/commands/magic8ball.ts index 5fb43ce..1dab84d 100644 --- a/src/commands/magic8ball.ts +++ b/src/commands/magic8ball.ts @@ -1,5 +1,5 @@ import { Message } from 'discord.js'; -import ICommand from '../library/interfaces/iCommand'; +import ICommand from '@/library/interfaces/iCommand'; let Magic8Ball: ICommand; diff --git a/src/commands/rules.ts b/src/commands/rules.ts index 8ea8969..59e22b4 100644 --- a/src/commands/rules.ts +++ b/src/commands/rules.ts @@ -1,5 +1,5 @@ import { Message } from 'discord.js'; -import ICommand from '../library/interfaces/iCommand'; +import ICommand from '@/library/interfaces/iCommand'; let Rules: ICommand; diff --git a/src/commands/say.ts b/src/commands/say.ts index 1aef6a8..c0af7c4 100644 --- a/src/commands/say.ts +++ b/src/commands/say.ts @@ -1,5 +1,5 @@ import { Message } from 'discord.js'; -import ICommand from '../library/interfaces/iCommand'; +import ICommand from '@/library/interfaces/iCommand'; let Say: ICommand; diff --git a/src/commands/search.ts b/src/commands/search.ts index 9875456..53e5ee1 100644 --- a/src/commands/search.ts +++ b/src/commands/search.ts @@ -1,7 +1,7 @@ +import config from '@/config'; +import ICommand from '@/library/interfaces/iCommand'; import axios, { AxiosResponse } from 'axios'; import { Message } from 'discord.js'; -import config from '../config'; -import ICommand from '../library/interfaces/iCommand'; let Search: ICommand; diff --git a/src/commands/source.ts b/src/commands/source.ts index 2af2b09..518bb51 100644 --- a/src/commands/source.ts +++ b/src/commands/source.ts @@ -1,5 +1,5 @@ import { Message } from 'discord.js'; -import ICommand from '../library/interfaces/iCommand'; +import ICommand from '@/library/interfaces/iCommand'; let Source: ICommand; diff --git a/src/commands/version.ts b/src/commands/version.ts index 98363dd..98a253d 100644 --- a/src/commands/version.ts +++ b/src/commands/version.ts @@ -1,7 +1,7 @@ +import config from '@/config'; +import { version } from '@root/package.json'; import { Message } from 'discord.js'; -import { version } from '../../package.json'; -import config from '../config'; -import ICommand from '../library/interfaces/iCommand'; +import ICommand from '@/library/interfaces/iCommand'; let Version: ICommand; diff --git a/src/commands/weather.ts b/src/commands/weather.ts index 23cb008..3aa2406 100644 --- a/src/commands/weather.ts +++ b/src/commands/weather.ts @@ -1,7 +1,7 @@ import axios, { AxiosResponse } from 'axios'; import { Message } from 'discord.js'; -import config from '../config'; -import ICommand from '../library/interfaces/iCommand'; +import config from '@/config'; +import ICommand from '@/library/interfaces/iCommand'; let Weather: ICommand; diff --git a/src/commands/xmas.ts b/src/commands/xmas.ts index a1732a7..a44e43d 100644 --- a/src/commands/xmas.ts +++ b/src/commands/xmas.ts @@ -1,5 +1,5 @@ import { Message } from 'discord.js'; -import ICommand from '../library/interfaces/iCommand'; +import ICommand from '@/library/interfaces/iCommand'; let Xmas: ICommand; diff --git a/src/library/core.ts b/src/library/core.ts index 4e942d8..b3f9e26 100644 --- a/src/library/core.ts +++ b/src/library/core.ts @@ -1,6 +1,6 @@ +import config from '@/config'; import { Client, GuildMember, Message, TextChannel } from 'discord.js'; import glob from 'glob'; -import config from '../config'; import CommandLoader from './commandLoader'; import CommandParser from './commandParser'; import Commands from './commands'; diff --git a/src/library/interfaces/iCommand.ts b/src/library/interfaces/iCommand.ts index fb035a9..ba06045 100644 --- a/src/library/interfaces/iCommand.ts +++ b/src/library/interfaces/iCommand.ts @@ -1,5 +1,5 @@ import { Client, Message } from "discord.js"; -import Commands from "../commands"; +import Commands from "@/commands"; /** * An interface for all commands to extend, representing the API that all diff --git a/tsconfig.json b/tsconfig.json index 4453cf3..577a9b3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -41,6 +41,9 @@ "paths": { "@/*": [ "./*" + ], + "@root/*": [ + "../*" ] }, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */