Skip to content

Commit

Permalink
Remove support for DEBUG env var in favor of only PINEJS_DEBUG
Browse files Browse the repository at this point in the history
Change-type: major
  • Loading branch information
Page- committed May 17, 2023
1 parent c4bbef5 commit b2e1c66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion build/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ config.plugins = config.plugins.concat(
new webpack.DefinePlugin({
'process.browser': true,
'process.env.CONFIG_LOADER_DISABLED': true,
'process.env.DEBUG': true,
'process.env.PINEJS_DEBUG': true,
'process.env.SBVR_SERVER_ENABLED': true,
}),
Expand Down
7 changes: 2 additions & 5 deletions src/config-loader/env.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
// TODO-MAJOR: Drop the support for the global `DEBUG` env var
const { DEBUG: globalDebug, PINEJS_DEBUG } = process.env;
const { PINEJS_DEBUG } = process.env;
if (![undefined, '', '0', '1'].includes(PINEJS_DEBUG)) {
// TODO-MAJOR: Throw on invalid value
console.warn(`Invalid value for PINEJS_DEBUG '${PINEJS_DEBUG}'`);
}
// Setting PINEJS_DEBUG to explicitly '0' will disable debug even if global debug is truthy
export const DEBUG =
PINEJS_DEBUG === '1' || (PINEJS_DEBUG !== '0' && !!globalDebug);
export const DEBUG = PINEJS_DEBUG === '1';

type CacheFnOpts<T extends (...args: any[]) => any> =
| {
Expand Down

0 comments on commit b2e1c66

Please sign in to comment.