Skip to content

Commit

Permalink
fix(proxy): build proxyList correctly
Browse files Browse the repository at this point in the history
Also remove unnecessary `all` npm script.
  • Loading branch information
jef committed Jan 17, 2021
1 parent b7930b2 commit c177aed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -3,7 +3,6 @@
"description": "The world's easiest, most powerful stock checker",
"main": "src/index.ts",
"scripts": {
"all": "npm run compile && npm run lint && npm run test",
"fix": "gts fix",
"lint": "gts lint",
"clean": "gts clean",
Expand Down
6 changes: 3 additions & 3 deletions src/config.ts
Expand Up @@ -158,15 +158,15 @@ function envOrNumberMax(
return number ?? 0;
}

function loadProxyList(filename: string): string[] {
function loadProxyList(filename: string): string[] | undefined {
try {
return readFileSync(`${filename}.proxies`)
.toString()
.trim()
.split('\n')
.map(x => x.trim());
} catch {
return [];
return undefined;
}
}

Expand Down Expand Up @@ -412,7 +412,7 @@ const store = {

let proxyList = loadProxyList(name);

if (proxyList.length === 0) {
if (!proxyList) {
proxyList = loadProxyList('global');
}

Expand Down
2 changes: 1 addition & 1 deletion src/web/index.ts
Expand Up @@ -11,7 +11,7 @@ import {
import {isAbsolute, join, normalize, relative} from 'path';
import {logger} from '../logger';

const approot = join(__dirname, '../../../');
const approot = join(__dirname, '../../');
const webroot = join(approot, './web');

const contentTypeMap: Record<string, string> = {
Expand Down

0 comments on commit c177aed

Please sign in to comment.