Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get rid of debug runtime dependency #118

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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