Hide verbose logs behind debug flag
This commit is contained in:
2
modules/utils/debug.js
Normal file
2
modules/utils/debug.js
Normal file
@ -0,0 +1,2 @@
|
||||
const debug = process.env.DEBUG ? console.log.bind(console) : () => {};
|
||||
export default debug;
|
@ -3,6 +3,7 @@ import https from 'https';
|
||||
import gunzip from 'gunzip-maybe';
|
||||
import tar from 'tar-stream';
|
||||
|
||||
import debug from './debug';
|
||||
import bufferStream from './bufferStream';
|
||||
import agent from './registryAgent';
|
||||
|
||||
@ -10,11 +11,7 @@ export default function fetchNpmPackage(packageConfig) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const tarballURL = packageConfig.dist.tarball;
|
||||
|
||||
console.log(
|
||||
'Fetching package for %s from %s',
|
||||
packageConfig.name,
|
||||
tarballURL
|
||||
);
|
||||
debug('Fetching package for %s from %s', packageConfig.name, tarballURL);
|
||||
|
||||
const { hostname, pathname } = url.parse(tarballURL);
|
||||
const options = {
|
||||
|
@ -3,6 +3,7 @@ import https from 'https';
|
||||
|
||||
import { npmRegistryURL } from '../config';
|
||||
|
||||
import debug from './debug';
|
||||
import bufferStream from './bufferStream';
|
||||
import agent from './registryAgent';
|
||||
|
||||
@ -19,7 +20,7 @@ export default function fetchNpmPackageInfo(packageName) {
|
||||
|
||||
const infoURL = `${npmRegistryURL}/${encodedPackageName}`;
|
||||
|
||||
console.log('Fetching package info for %s from %s', packageName, infoURL);
|
||||
debug('Fetching package info for %s from %s', packageName, infoURL);
|
||||
|
||||
const { hostname, pathname } = url.parse(infoURL);
|
||||
const options = {
|
||||
|
Reference in New Issue
Block a user