-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deprecation helpers and link to issues (#92)
- Loading branch information
Showing
2 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {emitWarning} from 'process'; | ||
|
||
function warningEmitter (warning, code) { | ||
let hasWarned = false; | ||
return () => { | ||
if (hasWarned) return; | ||
hasWarned = true; | ||
emitWarning(warning, 'DeprecationWarning', code); | ||
}; | ||
} | ||
|
||
// https://github.com/eritbh/yuuko/issues/88 | ||
export const addCommandDir = warningEmitter('Client#addCommandDir is deprecated. Use Client#addDir instead.', 'yuuko#88'); | ||
export const addCommandFile = warningEmitter('Client#addCommandFile is deprecated. Use Client#addFile instead.', 'yuuko#88'); | ||
export const reloadCommands = warningEmitter('Client#reloadCommands is deprecated. Use Client#reloadFiles instead.', 'yuuko#88'); | ||
|
||
// https://github.com/eritbh/yuuko/issues/89 | ||
export const setGlobalRequirements = warningEmitter('Client#setGlobalRequirements is deprecated. Use the globalCommandRequirements client option instead.', 'yuuko#89'); | ||
export const ignoreGlobalRequirements = warningEmitter('The ignoreGlobalRequirements client option is deprecated. Pass no globalCommandRequirements client option instead.', 'yuuko#89'); | ||
|
||
// https://github.com/eritbh/yuuko/issues/90 | ||
export const defaultPrefix = warningEmitter('Client#edfaultPrefix is deprecated. Use Client#prefix instead.', 'yuuko#90'); |