Skip to content

Commit

Permalink
fix(deps): update dependency chokidar to v4 (#626)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency chokidar to v4

* refactor: update chokidar import to use ChokidarOptions

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jeroen Claassens <[email protected]>
  • Loading branch information
renovate[bot] and favna authored Sep 19, 2024
1 parent 9b36bae commit e6fdc84
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/hmr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"check-update": "cliff-jumper --dry-run"
},
"dependencies": {
"chokidar": "^3.6.0"
"chokidar": "^4.0.0"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/hmr/src/lib/hmr.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/i18next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions packages/i18next/src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -44,7 +44,7 @@ export interface HMROptions {
/**
* HMR options
*/
options?: WatchOptions;
options?: ChokidarOptions;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions packages/i18next/src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Expand Down
20 changes: 18 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit e6fdc84

Please sign in to comment.