diff --git a/lib/postbuild.ts b/lib/postbuild.ts new file mode 100644 index 00000000..fd3bc1e4 --- /dev/null +++ b/lib/postbuild.ts @@ -0,0 +1,31 @@ +import path from 'path'; +import replace from 'replace-in-file'; + +import tsconfig from '../../tsconfig.json'; + +const pathAliases = tsconfig.compilerOptions.paths; + +const from = Object.keys(pathAliases).map(key => + new RegExp(`${key.split('/*')[0]}/[^"]*`, 'g') +); + +const to: { [index: string]: string } = {}; +for (const [key, value] of Object.entries(pathAliases)) { + const match = key.split('/*')[0]; + const replacement = value[0].split('/*')[0]; + to[match] = replacement; +} + +const options = { + files: ['dist/**/*.js'], + from: from, + to: (...args: Array) => { + const [match, _, __, filename] = args; + const [replacePattern, ...file] = match.split('/'); + + return path.relative(path.join(process.cwd(), path.dirname(filename)), + path.join(process.cwd(), 'dist', to[replacePattern], ...file)); + } +}; + +replace.sync(options); diff --git a/package.json b/package.json index 8e55d0f6..49eb29b0 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "discord.js": "^11.4.2", "i18n": "^0.8.3", "lowdb": "^1.0.0", - "node-opus": "^0.3.0" + "node-opus": "^0.3.0", + "replace-in-file": "^3.4.2" }, "optionalDependencies": { "erlpack": "discordapp/erlpack", @@ -46,11 +47,13 @@ }, "scripts": { "clean": "rm -rf dist", - "build": "tsc -p tsconfig.json", + "compile": "tsc -p tsconfig.json", + "build": "npm run compile", "lint": "tslint -p tsconfig.json", - "serve": "node dist/main.js", + "postcompile": "node dist/lib/postbuild.js", + "serve": "node dist/src/main.js", "start": "npm run build && npm run serve", - "rebuild": "npm run clean && npm run start", + "rebuild": "npm run clean && npm run build", "release": "npm run build && npm run lint" } } diff --git a/src/bot/MessageHandler.ts b/src/bot/MessageHandler.ts index b39326ef..8f9f2ee0 100644 --- a/src/bot/MessageHandler.ts +++ b/src/bot/MessageHandler.ts @@ -1,9 +1,9 @@ import { Message } from 'discord.js'; import '../discord/Message'; -import config from '../../config/config.json'; +import config from '@config/config.json'; -import DatabaseAdapter from '../util/db/DatabaseAdapter'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; import CommandCollection from './CommandCollection'; export default class MessageHandler { diff --git a/src/bot/SoundBot.ts b/src/bot/SoundBot.ts index d77354d7..f0c48f7e 100644 --- a/src/bot/SoundBot.ts +++ b/src/bot/SoundBot.ts @@ -1,8 +1,8 @@ import Discord from 'discord.js'; -import config from '../../config/config.json'; +import config from '@config/config.json'; -import LocaleService from '../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; import CommandCollection from './CommandCollection'; import MessageHandler from './MessageHandler'; diff --git a/src/bot/commands/AvatarCommand.ts b/src/bot/commands/AvatarCommand.ts index 828aea69..a332f2be 100644 --- a/src/bot/commands/AvatarCommand.ts +++ b/src/bot/commands/AvatarCommand.ts @@ -1,10 +1,10 @@ import { ClientUser, Message, Permissions } from 'discord.js'; -import config from '../../../config/config.json'; +import config from '@config/config.json'; import IUserCommand from './base/IUserCommand'; -import LocaleService from '../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; export default class AvatarCommand implements IUserCommand { public readonly TRIGGERS = ['avatar']; diff --git a/src/bot/commands/DownloadCommand.ts b/src/bot/commands/DownloadCommand.ts index 5dfb02d9..0f0b5a20 100644 --- a/src/bot/commands/DownloadCommand.ts +++ b/src/bot/commands/DownloadCommand.ts @@ -2,7 +2,7 @@ import { Attachment, Message } from 'discord.js'; import ICommand from './base/ICommand'; -import SoundUtil from '../../util/SoundUtil'; +import SoundUtil from '@util/SoundUtil'; export default class DownloadCommand implements ICommand { public readonly TRIGGERS = ['download']; diff --git a/src/bot/commands/HelpCommand.ts b/src/bot/commands/HelpCommand.ts index 4ad3c00a..5a5f9e94 100644 --- a/src/bot/commands/HelpCommand.ts +++ b/src/bot/commands/HelpCommand.ts @@ -1,10 +1,10 @@ import { Message } from 'discord.js'; -import config from '../../../config/config.json'; +import config from '@config/config.json'; import ICommand from './base/ICommand'; -import LocaleService from '../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; export default class HelpCommand implements ICommand { public readonly TRIGGERS = ['commands', 'help']; diff --git a/src/bot/commands/IgnoreCommand.ts b/src/bot/commands/IgnoreCommand.ts index 17a5ffec..09c007ea 100644 --- a/src/bot/commands/IgnoreCommand.ts +++ b/src/bot/commands/IgnoreCommand.ts @@ -2,8 +2,8 @@ import { Message, Permissions } from 'discord.js'; import ICommand from './base/ICommand'; -import DatabaseAdapter from '../../util/db/DatabaseAdapter'; -import LocaleService from '../../util/i18n/LocaleService'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; +import LocaleService from '@util/i18n/LocaleService'; import UserFinder from './helpers/UserFinder'; export default class IgnoreCommand implements ICommand { diff --git a/src/bot/commands/LastAddedCommand.ts b/src/bot/commands/LastAddedCommand.ts index b002151f..1f4e6c64 100644 --- a/src/bot/commands/LastAddedCommand.ts +++ b/src/bot/commands/LastAddedCommand.ts @@ -4,7 +4,7 @@ import { Message } from 'discord.js'; import ICommand from './base/ICommand'; -import SoundUtil from '../../util/SoundUtil'; +import SoundUtil from '@util/SoundUtil'; export default class LastAddedCommand implements ICommand { public readonly TRIGGERS = ['lastadded']; diff --git a/src/bot/commands/MostPlayedCommand.ts b/src/bot/commands/MostPlayedCommand.ts index e3c33728..0f699581 100644 --- a/src/bot/commands/MostPlayedCommand.ts +++ b/src/bot/commands/MostPlayedCommand.ts @@ -2,8 +2,8 @@ import { Message } from 'discord.js'; import ICommand from './base/ICommand'; -import DatabaseAdapter from '../../util/db/DatabaseAdapter'; -import Sound from '../../util/db/models/Sound'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; +import Sound from '@util/db/models/Sound'; export default class MostPlayedCommand implements ICommand { public readonly TRIGGERS = ['mostplayed']; diff --git a/src/bot/commands/RandomCommand.ts b/src/bot/commands/RandomCommand.ts index 46721f66..df61a466 100644 --- a/src/bot/commands/RandomCommand.ts +++ b/src/bot/commands/RandomCommand.ts @@ -2,9 +2,9 @@ import { Message } from 'discord.js'; import ICommand from './base/ICommand'; -import QueueItem from '../../util/queue/QueueItem'; -import SoundQueue from '../../util/queue/SoundQueue'; -import SoundUtil from '../../util/SoundUtil'; +import QueueItem from '@util/queue/QueueItem'; +import SoundQueue from '@util/queue/SoundQueue'; +import SoundUtil from '@util/SoundUtil'; import VoiceChannelFinder from './helpers/VoiceChannelFinder'; export default class RandomCommand implements ICommand { diff --git a/src/bot/commands/RemoveCommand.ts b/src/bot/commands/RemoveCommand.ts index dda072e2..f4aecf7a 100644 --- a/src/bot/commands/RemoveCommand.ts +++ b/src/bot/commands/RemoveCommand.ts @@ -4,9 +4,9 @@ import { Message, Permissions } from 'discord.js'; import ICommand from './base/ICommand'; -import DatabaseAdapter from '../../util/db/DatabaseAdapter'; -import LocaleService from '../../util/i18n/LocaleService'; -import SoundUtil from '../../util/SoundUtil'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; +import LocaleService from '@util/i18n/LocaleService'; +import SoundUtil from '@util/SoundUtil'; export default class RemoveCommand implements ICommand { public readonly TRIGGERS = ['remove']; diff --git a/src/bot/commands/RenameCommand.ts b/src/bot/commands/RenameCommand.ts index 53dc9299..87a0a285 100644 --- a/src/bot/commands/RenameCommand.ts +++ b/src/bot/commands/RenameCommand.ts @@ -4,9 +4,9 @@ import { Message, Permissions } from 'discord.js'; import ICommand from './base/ICommand'; -import DatabaseAdapter from '../../util/db/DatabaseAdapter'; -import LocaleService from '../../util/i18n/LocaleService'; -import SoundUtil from '../../util/SoundUtil'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; +import LocaleService from '@util/i18n/LocaleService'; +import SoundUtil from '@util/SoundUtil'; export default class RenameCommand implements ICommand { public readonly TRIGGERS = ['rename']; diff --git a/src/bot/commands/SearchCommand.ts b/src/bot/commands/SearchCommand.ts index 36cfec20..7480b846 100644 --- a/src/bot/commands/SearchCommand.ts +++ b/src/bot/commands/SearchCommand.ts @@ -2,9 +2,9 @@ import { Message } from 'discord.js'; import ICommand from './base/ICommand'; -import DatabaseAdapter from '../../util/db/DatabaseAdapter'; -import LocaleService from '../../util/i18n/LocaleService'; -import SoundUtil from '../../util/SoundUtil'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; +import LocaleService from '@util/i18n/LocaleService'; +import SoundUtil from '@util/SoundUtil'; export default class SearchCommand implements ICommand { public readonly TRIGGERS = ['search']; diff --git a/src/bot/commands/SoundCommand.ts b/src/bot/commands/SoundCommand.ts index 687aaaab..de70b749 100644 --- a/src/bot/commands/SoundCommand.ts +++ b/src/bot/commands/SoundCommand.ts @@ -2,9 +2,9 @@ import { Message } from 'discord.js'; import ICommand from './base/ICommand'; -import QueueItem from '../../util/queue/QueueItem'; -import SoundQueue from '../../util/queue/SoundQueue'; -import SoundUtil from '../../util/SoundUtil'; +import QueueItem from '@util/queue/QueueItem'; +import SoundQueue from '@util/queue/SoundQueue'; +import SoundUtil from '@util/SoundUtil'; import VoiceChannelFinder from './helpers/VoiceChannelFinder'; export default class SoundCommand implements ICommand { diff --git a/src/bot/commands/SoundsCommand.ts b/src/bot/commands/SoundsCommand.ts index 0691dcc3..4c00cf5d 100644 --- a/src/bot/commands/SoundsCommand.ts +++ b/src/bot/commands/SoundsCommand.ts @@ -1,11 +1,11 @@ import { Message } from 'discord.js'; -import config from '../../../config/config.json'; +import config from '@config/config.json'; import ICommand from './base/ICommand'; -import LocaleService from '../../util/i18n/LocaleService'; -import SoundUtil from '../../util/SoundUtil'; +import LocaleService from '@util/i18n/LocaleService'; +import SoundUtil from '@util/SoundUtil'; import MessageChunker from './helpers/MessageChunker'; export default class SoundsCommand implements ICommand { diff --git a/src/bot/commands/StopCommand.ts b/src/bot/commands/StopCommand.ts index edb6fc2c..164ed71d 100644 --- a/src/bot/commands/StopCommand.ts +++ b/src/bot/commands/StopCommand.ts @@ -2,7 +2,7 @@ import { Message } from 'discord.js'; import ICommand from './base/ICommand'; -import SoundQueue from '../../util/queue/SoundQueue'; +import SoundQueue from '@util/queue/SoundQueue'; export default class StopCommand implements ICommand { public readonly TRIGGERS = ['leave', 'stop']; diff --git a/src/bot/commands/TagCommand.ts b/src/bot/commands/TagCommand.ts index fc851e69..20fbc31a 100644 --- a/src/bot/commands/TagCommand.ts +++ b/src/bot/commands/TagCommand.ts @@ -2,9 +2,9 @@ import { Message, Permissions } from 'discord.js'; import ICommand from './base/ICommand'; -import DatabaseAdapter from '../../util/db/DatabaseAdapter'; -import LocaleService from '../../util/i18n/LocaleService'; -import SoundUtil from '../../util/SoundUtil'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; +import LocaleService from '@util/i18n/LocaleService'; +import SoundUtil from '@util/SoundUtil'; export default class TagCommand implements ICommand { public readonly TRIGGERS = ['tag']; diff --git a/src/bot/commands/TagsCommand.ts b/src/bot/commands/TagsCommand.ts index d6f81e3d..84c2040e 100644 --- a/src/bot/commands/TagsCommand.ts +++ b/src/bot/commands/TagsCommand.ts @@ -2,8 +2,8 @@ import { Message } from 'discord.js'; import ICommand from './base/ICommand'; -import DatabaseAdapter from '../../util/db/DatabaseAdapter'; -import SoundUtil from '../../util/SoundUtil'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; +import SoundUtil from '@util/SoundUtil'; import MessageChunker from './helpers/MessageChunker'; export default class TagsCommand implements ICommand { diff --git a/src/bot/commands/UnignoreCommand.ts b/src/bot/commands/UnignoreCommand.ts index 98681471..68104759 100644 --- a/src/bot/commands/UnignoreCommand.ts +++ b/src/bot/commands/UnignoreCommand.ts @@ -2,8 +2,8 @@ import { Message, Permissions } from 'discord.js'; import ICommand from './base/ICommand'; -import DatabaseAdapter from '../../util/db/DatabaseAdapter'; -import LocaleService from '../../util/i18n/LocaleService'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; +import LocaleService from '@util/i18n/LocaleService'; import UserFinder from './helpers/UserFinder'; export default class UnignoreCommand implements ICommand { diff --git a/src/bot/commands/WelcomeCommand.ts b/src/bot/commands/WelcomeCommand.ts index 82636948..73035eb6 100644 --- a/src/bot/commands/WelcomeCommand.ts +++ b/src/bot/commands/WelcomeCommand.ts @@ -1,10 +1,10 @@ import { Message } from 'discord.js'; -import config from '../../../config/config.json'; +import config from '@config/config.json'; import ICommand from './base/ICommand'; -import LocaleService from '../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; export default class WelcomeCommand implements ICommand { public readonly TRIGGERS = ['welcome']; diff --git a/src/bot/commands/helpers/MessageChunker.ts b/src/bot/commands/helpers/MessageChunker.ts index 2d5abc20..be2b500e 100644 --- a/src/bot/commands/helpers/MessageChunker.ts +++ b/src/bot/commands/helpers/MessageChunker.ts @@ -1,4 +1,4 @@ -import LocaleService from '../../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; export default class MessageChunker { private readonly MAX_MESSAGE_LENGTH = 2000; diff --git a/src/bot/commands/helpers/UserFinder.ts b/src/bot/commands/helpers/UserFinder.ts index 12b75153..767051fc 100644 --- a/src/bot/commands/helpers/UserFinder.ts +++ b/src/bot/commands/helpers/UserFinder.ts @@ -1,6 +1,6 @@ import { Message } from 'discord.js'; -import LocaleService from '../../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; export default class UserFinder { private readonly localeService: LocaleService; diff --git a/src/bot/commands/helpers/VoiceChannelFinder.ts b/src/bot/commands/helpers/VoiceChannelFinder.ts index 036ff9ef..64a1d813 100644 --- a/src/bot/commands/helpers/VoiceChannelFinder.ts +++ b/src/bot/commands/helpers/VoiceChannelFinder.ts @@ -1,6 +1,6 @@ import { Message } from 'discord.js'; -import LocaleService from '../../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; export default class VoiceChannelFinder { private readonly localeService: LocaleService; diff --git a/src/bot/commands/helpers/downloader/AttachmentDownloader.ts b/src/bot/commands/helpers/downloader/AttachmentDownloader.ts index 8ae1216f..3d245433 100644 --- a/src/bot/commands/helpers/downloader/AttachmentDownloader.ts +++ b/src/bot/commands/helpers/downloader/AttachmentDownloader.ts @@ -3,7 +3,7 @@ import fs from 'fs'; import { IncomingMessage } from 'http'; import https from 'https'; -import LocaleService from '../../../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; import BaseDownloader from './BaseDownloader'; import AttachmentValidator from './validator/AttachmentValidator'; diff --git a/src/bot/commands/helpers/downloader/BaseDownloader.ts b/src/bot/commands/helpers/downloader/BaseDownloader.ts index 2545e87d..14495046 100644 --- a/src/bot/commands/helpers/downloader/BaseDownloader.ts +++ b/src/bot/commands/helpers/downloader/BaseDownloader.ts @@ -1,6 +1,6 @@ import { Message } from 'discord.js'; -import LocaleService from '../../../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; import BaseValidator from './validator/BaseValidator'; export default abstract class BaseDownloader { diff --git a/src/bot/commands/helpers/downloader/YoutubeDownloader.ts b/src/bot/commands/helpers/downloader/YoutubeDownloader.ts index 9e0c7737..9ae5356e 100644 --- a/src/bot/commands/helpers/downloader/YoutubeDownloader.ts +++ b/src/bot/commands/helpers/downloader/YoutubeDownloader.ts @@ -3,7 +3,7 @@ import ffmpeg from 'fluent-ffmpeg'; import fs from 'fs'; import ytdl from 'ytdl-core'; -import LocaleService from '../../../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; import BaseDownloader from './BaseDownloader'; import YoutubeValidator from './validator/YoutubeValidator'; diff --git a/src/bot/commands/helpers/downloader/validator/AttachmentValidator.ts b/src/bot/commands/helpers/downloader/validator/AttachmentValidator.ts index 8de26a6a..9f5f5f8c 100644 --- a/src/bot/commands/helpers/downloader/validator/AttachmentValidator.ts +++ b/src/bot/commands/helpers/downloader/validator/AttachmentValidator.ts @@ -1,8 +1,8 @@ import { MessageAttachment } from 'discord.js'; -import config from '../../../../../../config/config.json'; +import config from '@config/config.json'; -import LocaleService from '../../../../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; import BaseValidator from './BaseValidator'; export default class AttachmentValidator extends BaseValidator { diff --git a/src/bot/commands/helpers/downloader/validator/BaseValidator.ts b/src/bot/commands/helpers/downloader/validator/BaseValidator.ts index 33f48cd0..9a4e0854 100644 --- a/src/bot/commands/helpers/downloader/validator/BaseValidator.ts +++ b/src/bot/commands/helpers/downloader/validator/BaseValidator.ts @@ -1,5 +1,5 @@ -import LocaleService from '../../../../../util/i18n/LocaleService'; -import SoundUtil from '../../../../../util/SoundUtil'; +import LocaleService from '@util/i18n/LocaleService'; +import SoundUtil from '@util/SoundUtil'; export default abstract class BaseValidator { protected readonly localeService: LocaleService; diff --git a/src/bot/commands/helpers/downloader/validator/YoutubeValidator.ts b/src/bot/commands/helpers/downloader/validator/YoutubeValidator.ts index ee8b4f23..91f773b0 100644 --- a/src/bot/commands/helpers/downloader/validator/YoutubeValidator.ts +++ b/src/bot/commands/helpers/downloader/validator/YoutubeValidator.ts @@ -1,6 +1,6 @@ import URL from 'url'; -import LocaleService from '../../../../../util/i18n/LocaleService'; +import LocaleService from '@util/i18n/LocaleService'; import BaseValidator from './BaseValidator'; export default class YoutubeValidator extends BaseValidator { diff --git a/src/di/DependencyGraph.ts b/src/di/DependencyGraph.ts index eeaee5c0..b5865d6a 100644 --- a/src/di/DependencyGraph.ts +++ b/src/di/DependencyGraph.ts @@ -1,13 +1,10 @@ -/* tslint:disable no-consecutive-blank-lines */ - import * as awilix from 'awilix'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; +import i18n from '@util/i18n/i18n'; +import LocaleService from '@util/i18n/LocaleService'; +import SoundQueue from '@util/queue/SoundQueue'; import CommandCollection from '../bot/CommandCollection'; -import DatabaseAdapter from '../util/db/DatabaseAdapter'; -import i18n from '../util/i18n/i18n'; -import LocaleService from '../util/i18n/LocaleService'; -import SoundQueue from '../util/queue/SoundQueue'; - const container = awilix.createContainer({ injectionMode: awilix.InjectionMode.CLASSIC @@ -24,7 +21,7 @@ container.register({ container.loadModules([ 'bot/**/*.js' ], { - cwd: 'dist/', + cwd: 'dist/src/', formatName: 'camelCase', resolverOptions: { lifetime: awilix.Lifetime.SINGLETON, diff --git a/src/main.ts b/src/main.ts index d366a7c9..9b873a52 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,9 @@ -import config from '../config/config.json'; +import config from '@config/config.json'; import container from './di/DependencyGraph'; +import LocaleService from '@util/i18n/LocaleService'; import SoundBot from './bot/SoundBot'; -import LocaleService from './util/i18n/LocaleService'; const localeService = container.cradle.localeService as LocaleService; localeService.setLocale(config.language); diff --git a/src/util/SoundUtil.ts b/src/util/SoundUtil.ts index 7f774dc1..d97b0aa2 100644 --- a/src/util/SoundUtil.ts +++ b/src/util/SoundUtil.ts @@ -1,6 +1,6 @@ import fs from 'fs'; -import config from '../../config/config.json'; +import config from '@config/config.json'; export default class SoundUtil { public static getSounds() { diff --git a/src/util/i18n/i18n.ts b/src/util/i18n/i18n.ts index 6f45fb2e..eef58158 100644 --- a/src/util/i18n/i18n.ts +++ b/src/util/i18n/i18n.ts @@ -6,9 +6,9 @@ import path from 'path'; const files = fs.readdirSync('./config/locales'); i18n.configure({ - locales: files.map(file => file.split('.')[0]), + locales: files.map(file => path.basename(file, '.json')), defaultLocale: 'en', - directory: path.join(__dirname, '..', '..', '..', 'config', 'locales'), + directory: path.join(process.cwd(), 'config', 'locales'), objectNotation: true }); diff --git a/src/util/queue/SoundQueue.ts b/src/util/queue/SoundQueue.ts index e02b078f..8ab15415 100644 --- a/src/util/queue/SoundQueue.ts +++ b/src/util/queue/SoundQueue.ts @@ -1,9 +1,9 @@ import { VoiceConnection } from 'discord.js'; -import config from '../../../config/config.json'; +import config from '@config/config.json'; -import DatabaseAdapter from '../../util/db/DatabaseAdapter'; -import SoundUtil from '../../util/SoundUtil'; +import DatabaseAdapter from '@util/db/DatabaseAdapter'; +import SoundUtil from '@util/SoundUtil'; import QueueItem from './QueueItem'; export default class SoundQueue { diff --git a/tsconfig.json b/tsconfig.json index 262e195a..aa34861d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,11 +6,18 @@ "strict": true, "outDir": "dist", "lib": [ - "es7" - ] + "es2017" + ], + + "baseUrl": ".", + "paths": { + "@config/*": ["config/*"], + "@util/*": ["src/util/*"] + } }, "include": [ "src/**/*", + "lib/**/*", "types/*" ] } diff --git a/tslint.yml b/tslint.yml index 2e0dad43..b750c623 100644 --- a/tslint.yml +++ b/tslint.yml @@ -26,6 +26,8 @@ rules: no-unused-variable: - true - check-parameters + - ignore-pattern: ^_ + object-literal-shorthand: - false object-literal-sort-keys: diff --git a/types/replace-in-file.d.ts b/types/replace-in-file.d.ts new file mode 100644 index 00000000..a14bee7f --- /dev/null +++ b/types/replace-in-file.d.ts @@ -0,0 +1,3 @@ +declare module 'replace-in-file' { + function sync(options: object): Array; +} diff --git a/types/tsconfig.d.ts b/types/tsconfig.d.ts new file mode 100644 index 00000000..301086ed --- /dev/null +++ b/types/tsconfig.d.ts @@ -0,0 +1,7 @@ +declare module '*.json' { + const compilerOptions: { + paths: { + [index: string]: Array + }; + }; +} diff --git a/yarn.lock b/yarn.lock index aeeeb211..d5772a8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -62,6 +62,10 @@ ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -137,6 +141,10 @@ camel-case@^3.0.0: no-case "^2.2.0" upper-case "^1.1.1" +camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -147,7 +155,7 @@ chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.3.0: +chalk@^2.3.0, chalk@^2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" dependencies: @@ -155,6 +163,18 @@ chalk@^2.3.0: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +cliui@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" + dependencies: + string-width "^2.1.1" + strip-ansi "^4.0.0" + wrap-ansi "^2.0.0" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + color-convert@^1.9.0: version "1.9.2" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147" @@ -173,6 +193,14 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + csextends@^1.0.3: version "1.2.0" resolved "https://registry.yarnpkg.com/csextends/-/csextends-1.2.0.tgz#6374b210984b54d4495f29c99d3dd069b80543e5" @@ -189,6 +217,12 @@ debug@2: dependencies: ms "2.0.0" +decamelize@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-2.0.0.tgz#656d7bbc8094c4c788ea53c5840908c9c7d063c7" + dependencies: + xregexp "4.0.0" + diff@^3.2.0: version "3.5.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" @@ -232,6 +266,18 @@ esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + extendr@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/extendr/-/extendr-2.1.0.tgz#301aa0bbea565f4d2dc8f570f2a22611a8527b56" @@ -244,6 +290,12 @@ extract-opts@^2.2.0: dependencies: typechecker "~2.0.1" +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + dependencies: + locate-path "^3.0.0" + fluent-ffmpeg@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/fluent-ffmpeg/-/fluent-ffmpeg-2.1.2.tgz#c952de2240f812ebda0aa8006d7776ee2acf7d74" @@ -255,6 +307,14 @@ fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" +get-caller-file@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + glob@^7.1.1, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" @@ -327,10 +387,28 @@ inherits@2: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + is-promise@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -346,6 +424,19 @@ js-yaml@^3.7.0: argparse "^1.0.7" esprima "^4.0.0" +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + dependencies: + invert-kv "^1.0.0" + +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + lodash@4, lodash@^4.17.10: version "4.17.10" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" @@ -368,6 +459,13 @@ lower-case@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" +lru-cache@^4.0.1: + version "4.1.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + m3u8stream@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/m3u8stream/-/m3u8stream-0.3.0.tgz#9b8255ad48b47d6069e755f22c84fce04c4e2697" @@ -386,6 +484,12 @@ math-interval-parser@^1.1.0: dependencies: xregexp "^2.0.0" +mem@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + dependencies: + mimic-fn "^1.0.0" + messageformat@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/messageformat/-/messageformat-0.3.1.tgz#e58fff8245e9b3971799e5b43db58b3e9417f5a2" @@ -396,6 +500,10 @@ messageformat@^0.3.1: nopt "~3.0.6" watchr "~2.4.13" +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + miniget@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/miniget/-/miniget-1.3.0.tgz#839c81b237c793baa21158081980fe424c05416c" @@ -444,6 +552,16 @@ nopt@~3.0.6: dependencies: abbrev "1" +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + ogg-packet@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ogg-packet/-/ogg-packet-1.0.0.tgz#45b885721ac8f7dd5cf22391d42106ae533ac678" @@ -456,10 +574,46 @@ once@^1.3.0: dependencies: wrappy "1" +os-locale@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + dependencies: + execa "^0.7.0" + lcid "^1.0.0" + mem "^1.1.0" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + +p-limit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" + dependencies: + p-try "^2.0.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + dependencies: + p-limit "^2.0.0" + +p-try@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + path-parse@^1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" @@ -472,6 +626,10 @@ prism-media@^0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/prism-media/-/prism-media-0.0.3.tgz#8842d4fae804f099d3b48a9a38e3c2bab6f4855b" +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + ref-struct@*: version "1.1.0" resolved "https://registry.yarnpkg.com/ref-struct/-/ref-struct-1.1.0.tgz#5d5ee65ad41cefc3a5c5feb40587261e479edc13" @@ -487,6 +645,22 @@ ref@1: debug "2" nan "2" +replace-in-file@^3.4.2: + version "3.4.2" + resolved "https://registry.yarnpkg.com/replace-in-file/-/replace-in-file-3.4.2.tgz#6d40f076ac86948e28efeb6fab73fbad5c0bfa2a" + dependencies: + chalk "^2.4.1" + glob "^7.1.2" + yargs "^12.0.1" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + resolve@^1.3.2: version "1.8.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" @@ -519,6 +693,24 @@ semver@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + +signal-exit@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + snekfetch@^3.6.4: version "3.6.4" resolved "https://registry.yarnpkg.com/snekfetch/-/snekfetch-3.6.4.tgz#d13e80a616d892f3d38daae4289f4d258a645120" @@ -537,12 +729,37 @@ steno@^0.4.1: dependencies: graceful-fs "^4.1.3" -strip-ansi@^3.0.0: +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" dependencies: ansi-regex "^2.0.0" +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + dependencies: + ansi-regex "^3.0.0" + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" @@ -630,12 +847,23 @@ watchr@~2.4.13: taskgroup "^4.2.0" typechecker "^2.0.8" -which@^1.1.1: +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + +which@^1.1.1, which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" dependencies: isexe "^2.0.0" +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -647,10 +875,45 @@ ws@^4.0.0: async-limiter "~1.0.0" safe-buffer "~5.1.0" +xregexp@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.0.0.tgz#e698189de49dd2a18cc5687b05e17c8e43943020" + xregexp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-2.0.0.tgz#52a63e56ca0b84a7f3a5f3d61872f126ad7a5943" +"y18n@^3.2.1 || ^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" + +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + +yargs-parser@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.1.0.tgz#7202265b89f7e9e9f2e5765e0fe735a905edbaa8" + dependencies: + camelcase "^4.1.0" + +yargs@^12.0.1: + version "12.0.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.1.tgz#6432e56123bb4e7c3562115401e98374060261c2" + dependencies: + cliui "^4.0.0" + decamelize "^2.0.0" + find-up "^3.0.0" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1 || ^4.0.0" + yargs-parser "^10.1.0" + ytdl-core@^0.24.0: version "0.24.0" resolved "https://registry.yarnpkg.com/ytdl-core/-/ytdl-core-0.24.0.tgz#297703e6d6c825dfab0f614df001ef0f29c8eaef"