diff --git a/package.json b/package.json index e622f2c..befbf74 100644 --- a/package.json +++ b/package.json @@ -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" }, @@ -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" } } diff --git a/src/sgo.ts b/src/sgo.ts index 7a69655..64cf26c 100644 --- a/src/sgo.ts +++ b/src/sgo.ts @@ -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); })();