Work on plug:run

This commit is contained in:
Zef Hemel
2023-08-11 20:37:13 +02:00
parent d4f7833f0d
commit 4dbbc31cb9
24 changed files with 174 additions and 104 deletions
+1
View File
@@ -26,4 +26,5 @@ export async function plugCompileCommand(
},
);
esbuild.stop();
Deno.exit(0);
}
+8 -1
View File
@@ -8,11 +8,15 @@ import { AssetBundle } from "../plugos/asset_bundle/bundle.ts";
export async function plugRunCommand(
{
noIndex,
hostname,
port,
}: {
noIndex: boolean;
hostname?: string;
port?: number;
},
spacePath: string,
functionName: string,
functionName: string | undefined,
...args: string[]
) {
spacePath = path.resolve(spacePath);
@@ -25,8 +29,11 @@ export async function plugRunCommand(
args,
new AssetBundle(assets),
!noIndex,
port,
hostname,
);
console.log("Output", result);
Deno.exit(0);
} catch (e: any) {
console.error(e.message);
Deno.exit(1);
+2 -1
View File
@@ -18,7 +18,8 @@ export async function serveCommand(
options: any,
folder?: string,
) {
const hostname = options.hostname || "127.0.0.1";
const hostname = options.hostname || Deno.env.get("SB_HOSTNAME") ||
"127.0.0.1";
const port = options.port ||
(Deno.env.get("SB_PORT") && +Deno.env.get("SB_PORT")!) || 3000;
const maxFileSizeMB = options.maxFileSizeMB || 20;