Skip to content

Commit

Permalink
fix: drop is-online for is-reachable
Browse files Browse the repository at this point in the history
  • Loading branch information
PopGoesTheWza committed Mar 19, 2021
1 parent 44e7e25 commit 4454d26
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import cliTruncate from 'cli-truncate';
import fs from 'fs-extra';
import {script_v1 as scriptV1} from 'googleapis';
import isOnline from 'is-online';
import isReachable from 'is-reachable';
import ora from 'ora';
import path from 'path';

Expand Down Expand Up @@ -203,7 +203,14 @@ export const getApiFileType = (value: string): string => {
// If using a proxy, return true since `isOnline` doesn't work.
// @see https://github.com/googleapis/google-api-nodejs-client#using-a-proxy
export const safeIsOnline = async (): Promise<boolean> =>
Boolean(process.env.HTTP_PROXY || process.env.HTTPS_PROXY) || isOnline();
Boolean(process.env.HTTP_PROXY || process.env.HTTPS_PROXY) ||
isReachable([
'www.googleapis.com',
'script.google.com',
'console.developers.google.com',
'console.cloud.google.com',
'drive.google.com',
]);

/**
* Checks if the network is available. Gracefully exits if not.
Expand Down

0 comments on commit 4454d26

Please sign in to comment.