feat: adding typescript and new imports to the project#112
feat: adding typescript and new imports to the project#112YoelFerreyra wants to merge 5 commits intomainfrom
Conversation
src/index.ts
Outdated
| client.commands = new Collection(); | ||
| deployCommands(client); | ||
| deployEvents(client); | ||
| //deployEvents(client); |
There was a problem hiding this comment.
Did you miss to uncomment this function?
| } | ||
|
|
||
| function handleCriticalError(error) { | ||
| function handleCriticalError(error: any) { |
There was a problem hiding this comment.
Maybe Error is a better interface for this:
| function handleCriticalError(error: any) { | |
| function handleCriticalError(error: Error) { |
There was a problem hiding this comment.
please take a look at this comment
src/utils/log-error.js
Outdated
| import path from 'path'; | ||
|
|
||
| const logDir = path.join(__dirname, '../log'); | ||
| const logDir = path.join(import.meta.url, '../log'); // Cambié __dirname por import.meta.url, ya que en módulos ES no tienes acceso a __dirname |
There was a problem hiding this comment.
Remove this comment and add it to the PR description instead
heliomar-pena
left a comment
There was a problem hiding this comment.
Uf great work man!
| dotenv.config(); | ||
| import { parseAllowedChannels } from './csv-parser-allowed-channels.ts' | ||
| import path from 'path' | ||
| import type { CronScheduleReview, DiscordServer, GeminiIntegration, MappedStatusCommands, PrTemplate, QAMention, RequestPoint, ScheduleCalendar, ScheduleMessages, TimeZone, VotePoints } from './types/config.d.js'; |
There was a problem hiding this comment.
creo que los archivos de definicion de tipos deben ser .ts y no .js
| }; | ||
|
|
||
| interface ParsedSchedule { | ||
| variables: Record<string, string>; |
There was a problem hiding this comment.
I think here you are defining parameters of parseMarkdownSchedule, and variables is not a parameter of this function
| * @param client - Client object. | ||
| */ | ||
| const processMarkdownFiles = (client) => { | ||
| export const processMarkdownFiles = (client: unknown): void => { |
There was a problem hiding this comment.
Discord doesn't have a type definition for client?
| .filter((file) => file.endsWith('.js')); | ||
| for (const file of commandFiles) { | ||
| const command = require(path.join(commandsPath, file)); | ||
| const command = await import(path.join(commandsPath, file)); |
There was a problem hiding this comment.
Sometimes dynamic import give problems in the build, have you tried the build to see if there is not error?
| } else { | ||
| console.log( | ||
| `[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.` | ||
| `[WARNING] The command at is missing a required "data" or "execute" property.` |
There was a problem hiding this comment.
missed file path in the error message
| @@ -0,0 +1,73 @@ | |||
| import { REST, Routes, Client } from 'discord.js'; | |||
There was a problem hiding this comment.
Here is the Client discord's type, you can use it in here: https://github.com/TeamNovaSoft/novabot/pull/112/files#r1949021235
| import { processMarkdownFiles } from './cron/utils/read-markdown-messages.ts'; | ||
| import { scheduleReviewCheck } from './cron/schedule-code-review.ts'; | ||
|
|
||
|
|
There was a problem hiding this comment.
extra space can be removed
| const translationsPath: string = path.join( | ||
| path.dirname(new URL(import.meta.url).pathname), | ||
| 'translations' | ||
| ); |
There was a problem hiding this comment.
maybe we could use process.cwd() instead of path.dirname(new URL(import.meta.url).pathname),?, I am not sure we should test it
|
Check for rebase |
No description provided.