feature: add SERVERUS_TYPESCRIPT_IMPORT_LOGGING environment variable

feature(wip): reload on changes
This commit is contained in:
Andy Burke 2025-06-25 16:53:45 -07:00
parent 62eba8612b
commit 26125f4f11
5 changed files with 18 additions and 7 deletions

View file

@ -8,31 +8,34 @@ import { SERVER } from './server.ts';
import * as path from '@std/path';
const settings = parseArgs(Deno.args, {
boolean: ['help', 'logs', 'version'],
boolean: ['help', 'logs', 'version', 'watch'],
string: ['hostname', 'port', 'root'],
negatable: ['logs'],
negatable: ['logs', 'watch'],
alias: {
help: 'h',
port: 'p',
root: 'r',
version: 'v'
version: 'v',
watch: 'w'
},
default: {
hostname: 'localhost',
logs: true,
port: '8000',
root: Deno.env.get('SERVERUS_ROOT') ?? './'
root: Deno.env.get('SERVERUS_ROOT') ?? './',
watch: true
}
});
if (settings.help) {
console.log(
`Usage: serverus [--h(elp)] [--v(ersion)] [--no-logs] [--r(oot) ./www]
`Usage: serverus [--h(elp)] [--v(ersion)] [--no-logs] [--no-watch] [--r(oot) ./www]
Options:
-h, --help Show this help message
--hostname Set the hostname/ip to bind to, default: localhost
--no-logs Disable logging
--no-watch Disable watch/reloading for certain types of file changes (handlers, typescript)
-p, --port Set the port to bind to, default: 8000
-r, --root Set the root directory to serve, default: './'
-v, --version Show the version number