mirror of
https://github.com/Routstr/routstrd.git
synced 2026-10-05 12:28:23 +00:00
* feat: add standalone binary releases * fix: propagate async CLI failures * fix: detect older Bun standalone builds * fix: constrain npm package contents * fix: preserve npm daemon entrypoint * fix: compare prerelease versions correctly * fix: verify daemon ownership before update restart * docs: add release and PM2 migration guidance * ci: validate standalone builds before release * chore: prepare v0.4.9 release --------- Co-authored-by: hzrd149, redshift <213178690+1ftredsh@users.noreply.github.com>
26 lines
906 B
TypeScript
26 lines
906 B
TypeScript
export function parseArgs(argv: string[]): {
|
|
port: number | null;
|
|
host: string | null;
|
|
provider: string | null;
|
|
} {
|
|
const portFlagIndex = argv.findIndex((arg) => arg === "--port");
|
|
const hostFlagIndex = argv.findIndex((arg) => arg === "--host");
|
|
const providerFlagIndex = argv.findIndex(
|
|
(arg) => arg === "--provider" || arg === "-p",
|
|
);
|
|
|
|
const portValue = portFlagIndex !== -1 ? argv[portFlagIndex + 1] : undefined;
|
|
const parsedPort = portValue ? Number.parseInt(portValue, 10) : Number.NaN;
|
|
const port = Number.isInteger(parsedPort) ? parsedPort : null;
|
|
|
|
const hostValue =
|
|
hostFlagIndex !== -1 ? argv[hostFlagIndex + 1] : undefined;
|
|
const host = hostValue?.trim() || null;
|
|
|
|
const providerValue =
|
|
providerFlagIndex !== -1 ? argv[providerFlagIndex + 1] : undefined;
|
|
const provider = providerValue ? providerValue.trim() : null;
|
|
|
|
return { port, host, provider };
|
|
}
|