From c3891f9c2dfb6469e1f72d6f95093d9269166d05 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Sat, 26 Aug 2023 22:19:04 +0200 Subject: [PATCH] feat: update paths to typescript /dist --- .gitignore | 1 + package.json | 10 +++++----- src/index.ts | 2 +- src/utils/deploySlashCommands.ts | 4 ++-- src/utils/registerClientCommands.ts | 4 ++-- src/utils/registerEventListeners.ts | 4 ++-- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index cec1399..3061e0c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /logs/app-*.log /cookies.json /cookies.txt +/dist diff --git a/package.json b/package.json index 1df0c4b..0de33b5 100644 --- a/package.json +++ b/package.json @@ -19,11 +19,11 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "node ./src/index.js", - "start-pretty": "node ./src/index.js | pino-pretty --ignore environment,source,module,action,name,context,executionId,shardId,guildId", - "start-pretty-no-ignore": "node ./src/index.js | pino-pretty", - "deploy": "node ./src/utils/deploySlashCommands.js", - "deploy-pretty": "node ./src/utils/deploySlashCommands.js | pino-pretty --ignore environment,source,module,action,name,context,executionId,shardId,guildId", + "start": "node ./dist/index.js", + "start-pretty": "node ./dist/index.js | pino-pretty --ignore environment,source,module,action,name,context,executionId,shardId,guildId", + "start-pretty-no-ignore": "node ./dist/index.js | pino-pretty", + "deploy": "node ./dist/utils/deploySlashCommands.js", + "deploy-pretty": "node ./dist/utils/deploySlashCommands.js | pino-pretty --ignore environment,source,module,action,name,context,executionId,shardId,guildId", "eslint": "eslint ./" }, "dependencies": { diff --git a/src/index.ts b/src/index.ts index 5d7575c..7acbd6c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ const shardingOptions = require('config').get('shardingOptions'); const { ShardingManager, ShardEvents } = require('discord.js'); const { v4: uuidv4 } = require('uuid'); -const manager = new ShardingManager('./src/bot.js', { +const manager = new ShardingManager('./dist/bot.js', { token: process.env.DISCORD_BOT_TOKEN, ...shardingOptions }); diff --git a/src/utils/deploySlashCommands.ts b/src/utils/deploySlashCommands.ts index 0f34a89..bd4bd32 100644 --- a/src/utils/deploySlashCommands.ts +++ b/src/utils/deploySlashCommands.ts @@ -17,10 +17,10 @@ const logger = require('../services/logger').child({ const slashCommands = []; const systemCommands = []; -const commandFolders = fs.readdirSync(path.resolve('./src/commands')); +const commandFolders = fs.readdirSync(path.resolve('./dist/commands')); for (const folder of commandFolders) { const commandFiles = fs - .readdirSync(path.resolve(`./src/commands/${folder}`)) + .readdirSync(path.resolve(`./dist/commands/${folder}`)) .filter((file) => file.endsWith('.js')); for (const file of commandFiles) { diff --git a/src/utils/registerClientCommands.ts b/src/utils/registerClientCommands.ts index d5c3c77..ab0b2ca 100644 --- a/src/utils/registerClientCommands.ts +++ b/src/utils/registerClientCommands.ts @@ -14,11 +14,11 @@ exports.registerClientCommands = ({ client, executionId }) => { logger.debug('Registering client commands...'); client.commands = new Collection(); - const commandFolders = fs.readdirSync(path.resolve('./src/commands')); + const commandFolders = fs.readdirSync(path.resolve('./dist/commands')); for (const folder of commandFolders) { logger.trace(`Registering client commands for folder '${folder}'...`); const commandFiles = fs - .readdirSync(path.resolve(`./src/commands/${folder}`)) + .readdirSync(path.resolve(`./dist/commands/${folder}`)) .filter((file) => file.endsWith('.js')); for (const file of commandFiles) { diff --git a/src/utils/registerEventListeners.ts b/src/utils/registerEventListeners.ts index 004b86c..ba1f94f 100644 --- a/src/utils/registerEventListeners.ts +++ b/src/utils/registerEventListeners.ts @@ -15,12 +15,12 @@ exports.registerEventListeners = ({ client, player, executionId }) => { logger.debug('Registering event listeners...'); - const eventFolders = fs.readdirSync(path.resolve('./src/events')); + const eventFolders = fs.readdirSync(path.resolve('./dist/events')); for (const folder of eventFolders) { logger.trace(`Registering event listener for folder '${folder}'...`); const eventFiles = fs - .readdirSync(path.resolve(`./src/events/${folder}`)) + .readdirSync(path.resolve(`./dist/events/${folder}`)) .filter((file) => file.endsWith('.js')); for (const file of eventFiles) {