- Added `vendor/discord-video-stream` to pnpm workspace. - Refactored `llmModerationClient.ts` for better readability and consistency. - Adjusted imports in `recordingsRoutes.ts` for clarity. - Updated `webserver.ts` to correctly import `createRecordingsRoutes`. - Enhanced test cases in `llmModerationClient.test.ts` for improved readability. - Updated submodule references for `better-sqlite3`, `discord-video-stream`, `discord.js-selfbot-v13`, `drizzle-orm`, and `node-datachannel`. - Created documentation for deprecated dependency removal plan and design.
4.3 KiB
Deprecated Dependency Removal Design
Goal
Remove deprecated packages from the pnpm lockfile where practical. Prefer maintained replacements or upgrades. If no maintained replacement exists, vendor upstream code as a submodule/workspace and patch dependency metadata there.
Scope
Current deprecated sources:
drizzle-kitpulls@esbuild-kit/esm-loaderand@esbuild-kit/core-utils.discord.js-selfbot-v13pullsotplib@12plugins.@discordjs/opuspulls@discordjs/node-pre-gyp, which pullsnpmlog,are-we-there-yet,gauge,rimraf@3,glob@7, andinflight.@lng2004/node-datachannelandbetter-sqlite3pullprebuild-install.
Existing workspace packages:
vendor/discord.js-selfbot-v13vendor/discord-video-stream
Approach
- Upgrade direct dependencies first and re-check
pnpm whyplus npm deprecation metadata. - Patch vendored workspace dependencies when project already owns package source.
- Replace direct packages only when runtime compatibility is clear.
- Add submodules only for packages that cannot be replaced or upgraded without keeping deprecated transitive packages.
Package Plan
drizzle-kit
Try latest compatible drizzle-kit. If latest still depends on @esbuild-kit/*, keep current version unless project commands fail, because vendoring drizzle-kit only to remove dev-only install warnings has high maintenance cost.
discord.js-selfbot-v13
Patch vendor/discord.js-selfbot-v13 dependency graph to remove otplib@12 if code is compatible with otplib@13. Verify by installing and running typecheck/tests. Keep peer/package name unchanged.
@discordjs/opus
Find maintained Opus alternative compatible with current recorder and @discordjs/voice. Prefer removing direct @discordjs/opus only if code and tests still pass. If native Opus remains needed and every maintained option drags deprecated install tooling, vendor the smallest dependency owner.
prebuild-install sources
Do not patch native package install chains blindly. For better-sqlite3, keep upstream unless latest removes prebuild-install. For @lng2004/node-datachannel, try latest first through discord-video-stream; vendor only if strict lockfile cleanup remains blocked and build still works.
discord-video-stream
Keep as workspace submodule. Patch devDependency discord.js-selfbot-v13 to use workspace reference so installs do not fetch deprecated registry selfbot.
Verification
After each dependency change:
- Run
pnpm install. - Run
pnpm whyfor known deprecated package names. - Check npm deprecation metadata for remaining lockfile packages.
- Run
pnpm run typecheck. - Run
pnpm run test.
Success Criteria
- Root
package.jsonuses workspace paths for vendored packages. pnpm-lock.yamlhas no deprecated packages where maintained replacements exist.- Any remaining deprecated packages are documented as no-maintained-replacement and owned by a vendored submodule or unavoidable native upstream.
- Typecheck and tests pass.
Final Audit Result
Deprecated packages removed from active dependency graph:
@otplib/plugin-crypto,@otplib/plugin-thirty-two,@otplib/preset-default— removed by patchingvendor/discord.js-selfbot-v13tootplib@13.@discordjs/opusdirect dependency — removed from root dependencies.@discordjs/node-pre-gyp,npmlog,are-we-there-yet,gauge,rimraf@3,glob@7,inflight— removed by eliminating@discordjs/opusauto-installed peer path.
Remaining unavoidable deprecated packages:
@esbuild-kit/core-utils@3.3.2viadrizzle-kit@0.31.10.@esbuild-kit/esm-loader@2.6.5viadrizzle-kit@0.31.10.prebuild-install@7.1.3viabetter-sqlite3@12.10.0and@lng2004/node-datachannel@0.32.0-20260202.
Reason these remain:
drizzle-kit@0.31.10is latest stable and still depends on@esbuild-kit/*.better-sqlite3@12.10.0is latest stable and still usesprebuild-installfor native binary install.@lng2004/node-datachannel@0.32.0-20260202is latest available and still usesprebuild-installfor native binary install.
The upstream repositories are vendored as submodules for future patching if strict zero-deprecated lockfile becomes worth maintaining as forks:
vendor/drizzle-ormvendor/better-sqlite3vendor/node-datachannel