Skip to content

Commit

Permalink
fix: fix argvs issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed May 7, 2023
1 parent cc2b11f commit 64624b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"build": "tsbb build",
"watch": "tsbb watch",
"type-check": "tsc --noEmit",
"test:doc": "node lib/sgo.js -d node_modules/@uiw/doc/web",
"test": "tsbb test",
"coverage": "tsbb test --coverage"
},
Expand Down Expand Up @@ -59,6 +60,7 @@
"@types/fs-extra": "^11.0.1",
"@types/minimist": "^1.2.2",
"@types/node": "^18.15.11",
"@uiw/doc": "^4.21.28",
"tsbb": "^4.0.1"
}
}
18 changes: 10 additions & 8 deletions src/sgo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ import server from './server';
console.log(' Copyright 2020');
return;
}
if (argvs.reload === undefined || argvs.r) argvs.reload = argvs.r = true;
if (argvs.browser === undefined || argvs.b) argvs.browser = argvs.b = true;
if (!argvs.port) argvs.port = argvs.p = Number(process.env.PORT) || 1987;
if (argvs.p) argvs.port = argvs.p;
if (!argvs.dir) argvs.dir = argvs.d = '';
if (argvs.d) argvs.dir = argvs.d;
if (!argvs.fallback) argvs.fallback = '';
if (!argvs['reload-port'])argvs['reload-port'] = 19872;
argvs.reload = argvs.reload || argvs.b || true;
argvs.b = argvs.reload;
argvs.browser = argvs.browser || argvs.b || true;
argvs.b = argvs.browser;
argvs.port = argvs.port || argvs.p || Number(process.env.PORT) || 1987;
argvs.p = argvs.port;
argvs.dir = argvs.dir || argvs.d || '';
argvs.d = argvs.dir;
argvs.fallback = argvs.fallback || '';
argvs['reload-port'] = argvs['reload-port'] || 19872;
server(argvs);

})();

0 comments on commit 64624b4

Please sign in to comment.