This commit is contained in:
2023-05-25 12:12:29 +08:00
parent 800e8b9603
commit 8e3c329fce
2 changed files with 8 additions and 3 deletions

View File

@@ -3,9 +3,9 @@
"tasks": {
"server-dev": "deno run -A --unstable --watch=static/,routes/ server-dev.ts",
"test": "deno test --allow-read=./ --allow-net --allow-write=./ --allow-run=tasklist.exe --unstable",
"run": "deno run --allow-read=./ --allow-write=./ --allow-run=tasklist.exe --allow-net --unstable",
"compile": "deno compile --allow-read=./ --allow-write=./ --allow-run=tasklist.exe --allow-net --unstable",
"compile_full": "deno compile --allow-read --allow-write --allow-run=tasklist.exe --allow-net --unstable"
"run": "deno run --allow-read=./ --allow-write=./ --allow-run=tasklist.exe --allow-env=DENO_DEPLOYMENT_ID --allow-net --unstable",
"compile": "deno compile --allow-read=./ --allow-write=./ --allow-run=tasklist.exe --allow-env=DENO_DEPLOYMENT_ID --allow-net --unstable",
"compile_full": "deno compile --allow-read --allow-write --allow-run=tasklist.exe --allow-env=DENO_DEPLOYMENT_ID --allow-net --unstable"
},
"fmt": {
"indentWidth": 4,

View File

@@ -7,6 +7,7 @@ import { sure_dir, try_remove_sync } from "./utils.ts";
import { EhDb } from "./db.ts";
import { load_eht_file, update_database_tag } from "./eh_translation.ts";
import { get_abort_signal } from "./signal_handler.ts";
import { startServer } from "./server.ts";
function show_help() {
console.log("Usage: main.ts [options]");
@@ -23,6 +24,7 @@ enum CMD {
Optimize,
UpdateTagTranslation,
ExportZip,
Server,
}
const args = parse(Deno.args, {
@@ -46,6 +48,7 @@ if (rcmd == "utt" || rcmd == "update_tag_translation") {
cmd = CMD.UpdateTagTranslation;
}
if (rcmd == "ez" || rcmd == "export_zip") cmd = CMD.ExportZip;
if (rcmd == "s" || rcmd == "server") cmd = CMD.Server;
if (cmd == CMD.Unknown) {
throw Error(`Unknown command: ${rcmd}`);
}
@@ -129,6 +132,8 @@ async function main() {
await update_tag_translation();
} else if (cmd == CMD.ExportZip) {
await export_zip();
} else if (cmd == CMD.Server) {
await startServer(settings);
}
}