Skip to content

Commit

Permalink
fix: get rid of debug runtime dependency (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-fenster committed Jan 19, 2024
1 parent e36289f commit 85e1bd0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
13 changes: 12 additions & 1 deletion index.js
@@ -1,9 +1,20 @@
'use strict';

const {PassThrough} = require('stream');
const debug = require('debug')('retry-request');
const extend = require('extend');

let debug = () => {};
if (
typeof process !== 'undefined' &&
'env' in process &&
typeof process.env === 'object' &&
process.env.DEBUG === 'retry-request'
) {
debug = message => {
console.log('retry-request:', message);
};
}

const DEFAULTS = {
objectMode: false,
retries: 2,
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -31,7 +31,6 @@
},
"dependencies": {
"@types/request": "^2.48.8",
"debug": "^4.1.1",
"extend": "^3.0.2",
"teeny-request": "^9.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -48,7 +48,7 @@ request(urlThatReturns503)

## Can I monitor what retry-request is doing internally?

Yes! This project uses [debug](https://www.npmjs.com/package/debug) to provide the current retry attempt, each response status, and the delay computed until the next retry attempt is made. To enable the debug mode, set the environment variable `DEBUG` to _retry-request_.
Yes! To enable the debug mode, set the environment variable `DEBUG` to _retry-request_.

(Thanks for the implementation, @yihaozhadan!)

Expand Down

0 comments on commit 85e1bd0

Please sign in to comment.