From 0a14264b0ecc7e83f7cffc9751e3557dece01d5c Mon Sep 17 00:00:00 2001 From: ayntee Date: Fri, 25 Dec 2020 15:47:24 +0400 Subject: [PATCH 1/2] deps: segregate third-party deps to deps.ts file --- deps.ts | 7 +++++++ mod.ts | 1 - src/gateway/index.ts | 4 ++-- src/managers/guildEmojis.ts | 2 +- src/models/cacheAdapter.ts | 2 +- src/models/client.ts | 2 +- src/models/command.ts | 2 +- src/models/shard.ts | 2 +- src/structures/webhook.ts | 2 +- src/test/music.ts | 2 +- 10 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 deps.ts diff --git a/deps.ts b/deps.ts new file mode 100644 index 0000000..8a186e3 --- /dev/null +++ b/deps.ts @@ -0,0 +1,7 @@ +export { EventEmitter } from "https://deno.land/std@0.82.0/node/events.ts"; +export { unzlib } from "https://deno.land/x/denoflate@1.1/mod.ts"; +export { fetchAuto } from "https://raw.githubusercontent.com/DjDeveloperr/fetch-base64/main/mod.ts"; +export { parse } from "https://deno.land/x/mutil@0.1.2/mod.ts"; +export { connect } from "https://deno.land/x/redis@v0.14.1/mod.ts"; +export type { Redis, RedisConnectOptions } from "https://deno.land/x/redis@v0.14.1/mod.ts" +export { Manager, Player } from "https://raw.githubusercontent.com/Lavaclient/lavadeno/master/mod.ts"; \ No newline at end of file diff --git a/mod.ts b/mod.ts index 2c2e779..b2ae4fc 100644 --- a/mod.ts +++ b/mod.ts @@ -1,5 +1,4 @@ export { GatewayIntents } from './src/types/gateway.ts' -export { default as EventEmitter } from 'https://deno.land/std@0.74.0/node/events.ts' export { Base } from './src/structures/base.ts' export { Gateway } from './src/gateway/index.ts' export type { ClientEvents } from './src/gateway/handlers/index.ts' diff --git a/src/gateway/index.ts b/src/gateway/index.ts index a8349a4..081e1c8 100644 --- a/src/gateway/index.ts +++ b/src/gateway/index.ts @@ -1,4 +1,4 @@ -import { unzlib } from 'https://deno.land/x/denoflate@1.1/mod.ts' +import { unzlib } from '../../deps.ts' import { Client } from '../models/client.ts' import { DISCORD_GATEWAY_URL, @@ -18,7 +18,7 @@ import { GatewayCache } from '../managers/gatewayCache.ts' import { delay } from '../utils/delay.ts' import { VoiceChannel } from '../structures/guildVoiceChannel.ts' import { Guild } from '../structures/guild.ts' -import EventEmitter from 'https://deno.land/std@0.74.0/node/events.ts' +import { EventEmitter } from '../../deps.ts' export interface RequestMembersOptions { limit?: number diff --git a/src/managers/guildEmojis.ts b/src/managers/guildEmojis.ts index 30c1d49..9da7344 100644 --- a/src/managers/guildEmojis.ts +++ b/src/managers/guildEmojis.ts @@ -6,7 +6,7 @@ import { EmojiPayload } from '../types/emoji.ts' import { CHANNEL, GUILD_EMOJI, GUILD_EMOJIS } from '../types/endpoint.ts' import { BaseChildManager } from './baseChild.ts' import { EmojisManager } from './emojis.ts' -import { fetchAuto } from 'https://raw.githubusercontent.com/DjDeveloperr/fetch-base64/main/mod.ts' +import { fetchAuto } from '../../deps.ts' export class GuildEmojisManager extends BaseChildManager { guild: Guild diff --git a/src/models/cacheAdapter.ts b/src/models/cacheAdapter.ts index fe9df03..41b7503 100644 --- a/src/models/cacheAdapter.ts +++ b/src/models/cacheAdapter.ts @@ -3,7 +3,7 @@ import { connect, Redis, RedisConnectOptions -} from 'https://denopkg.com/keroxp/deno-redis/mod.ts' +} from '../../deps.ts' /** * ICacheAdapter is the interface to be implemented by Cache Adapters for them to be usable with Harmony. diff --git a/src/models/client.ts b/src/models/client.ts index 07955d5..5562cee 100644 --- a/src/models/client.ts +++ b/src/models/client.ts @@ -2,7 +2,7 @@ import { User } from '../structures/user.ts' import { GatewayIntents } from '../types/gateway.ts' import { Gateway } from '../gateway/index.ts' import { RESTManager } from './rest.ts' -import EventEmitter from 'https://deno.land/std@0.74.0/node/events.ts' +import { EventEmitter } from '../../deps.ts' import { DefaultCacheAdapter, ICacheAdapter } from './cacheAdapter.ts' import { UsersManager } from '../managers/users.ts' import { GuildManager } from '../managers/guilds.ts' diff --git a/src/models/command.ts b/src/models/command.ts index 2cbc033..3293229 100644 --- a/src/models/command.ts +++ b/src/models/command.ts @@ -5,7 +5,7 @@ import { User } from '../structures/user.ts' import { Collection } from '../utils/collection.ts' import { CommandClient } from './commandClient.ts' import { Extension } from './extensions.ts' -import { parse } from 'https://deno.land/x/mutil@0.1.2/mod.ts' +import { parse } from '../../deps.ts' export interface CommandContext { /** The Client object */ diff --git a/src/models/shard.ts b/src/models/shard.ts index 52927cb..436d01d 100644 --- a/src/models/shard.ts +++ b/src/models/shard.ts @@ -1,6 +1,6 @@ import { Collection } from '../utils/collection.ts' import { Client, ClientOptions } from './client.ts' -import EventEmitter from 'https://deno.land/std@0.74.0/node/events.ts' +import {EventEmitter} from '../../deps.ts' import { RESTManager } from './rest.ts' // import { GATEWAY_BOT } from '../types/endpoint.ts' // import { GatewayBotPayload } from '../types/gatewayBot.ts' diff --git a/src/structures/webhook.ts b/src/structures/webhook.ts index dd5dc8c..2d571c5 100644 --- a/src/structures/webhook.ts +++ b/src/structures/webhook.ts @@ -11,7 +11,7 @@ import { Embed } from './embed.ts' import { Message } from './message.ts' import { TextChannel } from './textChannel.ts' import { User } from './user.ts' -import { fetchAuto } from 'https://raw.githubusercontent.com/DjDeveloperr/fetch-base64/main/mod.ts' +import { fetchAuto } from '../../deps.ts' import { WEBHOOK_MESSAGE } from '../types/endpoint.ts' export interface WebhookMessageOptions extends MessageOption { diff --git a/src/test/music.ts b/src/test/music.ts index 07f65b6..c8f720b 100644 --- a/src/test/music.ts +++ b/src/test/music.ts @@ -13,7 +13,7 @@ import { LL_IP, LL_PASS, LL_PORT, TOKEN } from './config.ts' import { Manager, Player -} from 'https://raw.githubusercontent.com/Lavaclient/lavadeno/master/mod.ts' +} from '../../deps.ts' import { Interaction } from '../structures/slash.ts' import { slash } from '../models/client.ts' // import { SlashCommandOptionType } from '../types/slash.ts' From 255bc2d4e9994725373f2e9684b9e6e5138d7e7e Mon Sep 17 00:00:00 2001 From: ayntee Date: Fri, 25 Dec 2020 16:11:41 +0400 Subject: [PATCH 2/2] style: format files --- deps.ts | 20 +++++++++++++------- src/gateway/index.ts | 3 +-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/deps.ts b/deps.ts index 8a186e3..3e1dd63 100644 --- a/deps.ts +++ b/deps.ts @@ -1,7 +1,13 @@ -export { EventEmitter } from "https://deno.land/std@0.82.0/node/events.ts"; -export { unzlib } from "https://deno.land/x/denoflate@1.1/mod.ts"; -export { fetchAuto } from "https://raw.githubusercontent.com/DjDeveloperr/fetch-base64/main/mod.ts"; -export { parse } from "https://deno.land/x/mutil@0.1.2/mod.ts"; -export { connect } from "https://deno.land/x/redis@v0.14.1/mod.ts"; -export type { Redis, RedisConnectOptions } from "https://deno.land/x/redis@v0.14.1/mod.ts" -export { Manager, Player } from "https://raw.githubusercontent.com/Lavaclient/lavadeno/master/mod.ts"; \ No newline at end of file +export { EventEmitter } from 'https://deno.land/std@0.82.0/node/events.ts' +export { unzlib } from 'https://deno.land/x/denoflate@1.1/mod.ts' +export { fetchAuto } from 'https://raw.githubusercontent.com/DjDeveloperr/fetch-base64/main/mod.ts' +export { parse } from 'https://deno.land/x/mutil@0.1.2/mod.ts' +export { connect } from 'https://deno.land/x/redis@v0.14.1/mod.ts' +export type { + Redis, + RedisConnectOptions +} from 'https://deno.land/x/redis@v0.14.1/mod.ts' +export { + Manager, + Player +} from 'https://raw.githubusercontent.com/Lavaclient/lavadeno/master/mod.ts' diff --git a/src/gateway/index.ts b/src/gateway/index.ts index 081e1c8..495829d 100644 --- a/src/gateway/index.ts +++ b/src/gateway/index.ts @@ -1,4 +1,4 @@ -import { unzlib } from '../../deps.ts' +import { unzlib, EventEmitter } from '../../deps.ts' import { Client } from '../models/client.ts' import { DISCORD_GATEWAY_URL, @@ -18,7 +18,6 @@ import { GatewayCache } from '../managers/gatewayCache.ts' import { delay } from '../utils/delay.ts' import { VoiceChannel } from '../structures/guildVoiceChannel.ts' import { Guild } from '../structures/guild.ts' -import { EventEmitter } from '../../deps.ts' export interface RequestMembersOptions { limit?: number