From 6a31473d22c27d13c732d36f9b4a56bcb872dfe5 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 30 Sep 2023 12:31:25 +0200 Subject: [PATCH] scripts: move scripts to the project root directory I believe, that these kind of scripts should reside there instead of src directory --- Dockerfile | 1 + package.json | 2 +- {src/scripts => scripts}/pushCommands.ts | 6 +++--- tsconfig.json | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) rename {src/scripts => scripts}/pushCommands.ts (90%) diff --git a/Dockerfile b/Dockerfile index 4b9f015..9ef0693 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ RUN npx prisma generate # Typescript compiling COPY tsconfig.json . COPY src ./src +COPY scripts ./scripts RUN npx tsc # Run the app diff --git a/package.json b/package.json index feb71a3..a3dee49 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "start": "tsc && node dist/src/index.js", "test": "echo \"Error: no test specified\" && exit 1", - "publishCommands": "tsc && node dist/src/scripts/pushCommands.js" + "publishCommands": "tsc && node dist/scripts/pushCommands.js" }, "author": "Wroclaw", "license": "MIT", diff --git a/src/scripts/pushCommands.ts b/scripts/pushCommands.ts similarity index 90% rename from src/scripts/pushCommands.ts rename to scripts/pushCommands.ts index 3f88ee5..b6419fc 100644 --- a/src/scripts/pushCommands.ts +++ b/scripts/pushCommands.ts @@ -1,15 +1,15 @@ // https://discordjs.guide/creating-your-bot/command-deployment.html#guild-commands import { REST, RESTGetAPIOAuth2CurrentApplicationResult, RESTPostAPIApplicationCommandsJSONBody, Routes } from "discord.js"; -import { config } from "../index"; +import { config } from "../src/index"; import requireDirectory from "require-directory"; -import Command from "../command"; +import Command from "../src/command"; const post: RESTPostAPIApplicationCommandsJSONBody[] = []; const guildId = process.argv.slice(2)[0]; -requireDirectory<{default: Command}, void>(module, "../commands", { +requireDirectory<{default: Command}, void>(module, "../src/commands", { visit: function (obj) { console.log(obj); // eslint-disable-next-line @typescript-eslint/ban-ts-comment diff --git a/tsconfig.json b/tsconfig.json index 77c5666..173e3c9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "include": [ - "./src/**/*" + "./src/**/*", + "./scripts/**/*" ], "compilerOptions": { "target": "ES2022",