diff --git a/packages/hmr/package.json b/packages/hmr/package.json index e31c6fd8..20b34bb1 100644 --- a/packages/hmr/package.json +++ b/packages/hmr/package.json @@ -49,7 +49,7 @@ "check-update": "cliff-jumper --dry-run" }, "dependencies": { - "chokidar": "^3.6.0" + "chokidar": "^4.0.0" }, "repository": { "type": "git", diff --git a/packages/hmr/src/lib/hmr.ts b/packages/hmr/src/lib/hmr.ts index a551b50b..dc3b7a10 100644 --- a/packages/hmr/src/lib/hmr.ts +++ b/packages/hmr/src/lib/hmr.ts @@ -1,8 +1,8 @@ import { Piece, Result, Store, container } from '@sapphire/framework'; -import { watch, type WatchOptions } from 'chokidar'; +import { watch, type ChokidarOptions } from 'chokidar'; import { relative } from 'node:path'; -export interface HMROptions extends WatchOptions { +export interface HMROptions extends ChokidarOptions { enabled?: boolean; silent?: boolean; } diff --git a/packages/i18next/package.json b/packages/i18next/package.json index de4d1e94..44ae500f 100644 --- a/packages/i18next/package.json +++ b/packages/i18next/package.json @@ -52,7 +52,7 @@ "dependencies": { "@sapphire/utilities": "^3.17.0", "@skyra/i18next-backend": "^2.0.5", - "chokidar": "^3.6.0", + "chokidar": "^4.0.0", "i18next": "^23.14.0" }, "repository": { diff --git a/packages/i18next/src/lib/types.ts b/packages/i18next/src/lib/types.ts index cafdad26..1f73d864 100644 --- a/packages/i18next/src/lib/types.ts +++ b/packages/i18next/src/lib/types.ts @@ -1,6 +1,6 @@ import type { Awaitable } from '@sapphire/utilities'; import type { Backend } from '@skyra/i18next-backend'; -import type { WatchOptions } from 'chokidar'; +import type { ChokidarOptions } from 'chokidar'; import type { BaseInteraction, Guild, Interaction, LocalizationMap, Message, StageChannel, User, VoiceChannel } from 'discord.js'; import type { InitOptions } from 'i18next'; @@ -44,7 +44,7 @@ export interface HMROptions { /** * HMR options */ - options?: WatchOptions; + options?: ChokidarOptions; } /** diff --git a/packages/i18next/src/register.ts b/packages/i18next/src/register.ts index abddb89f..a61fe3db 100644 --- a/packages/i18next/src/register.ts +++ b/packages/i18next/src/register.ts @@ -17,9 +17,10 @@ export class I18nextPlugin extends Plugin { public static [postLogin](this: SapphireClient): void { if (this.options.i18n?.hmr?.enabled) { container.logger.info('[i18next-Plugin]: HMR enabled. Watching for languages changes.'); - const hmr = watch(container.i18n.languagesDirectory, this.options.i18n.hmr.options); - for (const event of ['change', 'unlink']) hmr.on(event, () => container.i18n.reloadResources()); + watch(container.i18n.languagesDirectory, this.options.i18n.hmr.options ?? {}) + .on('change', () => container.i18n.reloadResources()) + .on('unlink', () => container.i18n.reloadResources()); } } } diff --git a/yarn.lock b/yarn.lock index 25f7852e..8d30de0e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1375,7 +1375,7 @@ __metadata: dependencies: "@favware/cliff-jumper": "npm:^4.1.0" "@favware/rollup-type-bundler": "npm:^3.3.0" - chokidar: "npm:^3.6.0" + chokidar: "npm:^4.0.0" concurrently: "npm:^9.0.1" tsup: "npm:^8.2.4" tsx: "npm:^4.19.0" @@ -1393,7 +1393,7 @@ __metadata: "@favware/rollup-type-bundler": "npm:^3.3.0" "@sapphire/utilities": "npm:^3.17.0" "@skyra/i18next-backend": "npm:^2.0.5" - chokidar: "npm:^3.6.0" + chokidar: "npm:^4.0.0" concurrently: "npm:^9.0.1" i18next: "npm:^23.14.0" tsup: "npm:^8.2.4" @@ -2314,6 +2314,15 @@ __metadata: languageName: node linkType: hard +"chokidar@npm:^4.0.0": + version: 4.0.0 + resolution: "chokidar@npm:4.0.0" + dependencies: + readdirp: "npm:^4.0.1" + checksum: 10/e9a65db724a9ba2a40ad10f1d55caa5ccb5ba17533414271ec315004664860439348e51fa4faaa640fcc5f6427a410919fa1608892fbad41ed86fce682633cfa + languageName: node + linkType: hard + "chownr@npm:^2.0.0": version: 2.0.0 resolution: "chownr@npm:2.0.0" @@ -5584,6 +5593,13 @@ __metadata: languageName: node linkType: hard +"readdirp@npm:^4.0.1": + version: 4.0.1 + resolution: "readdirp@npm:4.0.1" + checksum: 10/f8a2d3308c9dd19d9da4fc7f19a02fc057259a80014949d8f3d98f4e6042896119fb96eb3f3e6a743747d12f0bf781b771902b0b03aba58f884589c50968fad4 + languageName: node + linkType: hard + "readdirp@npm:~3.6.0": version: 3.6.0 resolution: "readdirp@npm:3.6.0"