able-baker/run.tsx

34 lines
586 B
TypeScript
Raw Permalink Normal View History

2023-07-30 09:16:17 -04:00
import * as Serve from "./run-serve.tsx";
2023-07-30 13:04:26 -04:00
2023-07-30 09:16:17 -04:00
Deno.args.forEach(arg=>
{
if(arg.startsWith("--"))
{
const kvp = arg.substring(2).split("=");
Deno.env.set(kvp[0], kvp[1] || "true");
}
});
2023-07-30 14:01:14 -04:00
const isDeploy = Deno.env.get("dep");
const isDevelop = Deno.env.get("dev");
export default function(config:Serve.ConfigurationArgs)
{
if(!isDeploy)
{
Serve.Configure(config)
Serve.default();
}
}
2023-07-30 09:16:17 -04:00
2023-07-30 14:01:14 -04:00
if(isDeploy)
2023-07-30 09:16:17 -04:00
{
2023-07-30 13:04:26 -04:00
import("./run-deploy.tsx");
}
else
{
2023-07-30 14:01:14 -04:00
if(isDevelop)
2023-07-30 13:04:26 -04:00
{
await import("./run-local.tsx");
}
Serve.default();
2023-07-30 09:16:17 -04:00
}