From 19097e1e6841019e059519ae9e424c2a57917f1f Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Sat, 29 Jul 2023 20:25:41 -0400 Subject: [PATCH] tweak deploy script --- deno.json | 3 ++- example/.env | 1 + run-deploy.tsx | 13 ++++--------- 3 files changed, 7 insertions(+), 10 deletions(-) create mode 100644 example/.env diff --git a/deno.json b/deno.json index 68782be..f8d9679 100644 --- a/deno.json +++ b/deno.json @@ -13,6 +13,7 @@ { "local": "deno run -A --reload=http://localhost --no-lock ./run-local.tsx --port=1234", "serve": "deno run -A --reload=http://localhost --no-lock ./run-serve.tsx --port=1234", - "debug": "deno run -A --reload=http://localhost --inspect-wait --no-lock ./run-serve.tsx --port=1234" + "debug": "deno run -A --reload=http://localhost --inspect-wait --no-lock ./run-serve.tsx --port=1234", + "deploy":"deno run -A --no-lock --reload=http://localhost http://localhost:4507/run-deploy.tsx" } } \ No newline at end of file diff --git a/example/.env b/example/.env new file mode 100644 index 0000000..6a7678a --- /dev/null +++ b/example/.env @@ -0,0 +1 @@ +DENO_DEPLOY_TOKEN=1 \ No newline at end of file diff --git a/run-deploy.tsx b/run-deploy.tsx index 37d7961..89af979 100644 --- a/run-deploy.tsx +++ b/run-deploy.tsx @@ -1,4 +1,4 @@ -import { load } from "https://deno.land/std@0.194.0/dotenv/mod.ts"; +import * as Env from "https://deno.land/std@0.194.0/dotenv/mod.ts"; import { parse } from "https://deno.land/std@0.194.0/flags/mod.ts"; @@ -47,18 +47,12 @@ try { console.log("Runing deploy!"); const serveScript = import.meta.resolve("./run-serve.tsx"); - console.log("Serve script:", serveScript); let arg = parse(Deno.args); - let env = await load(); + let env = await Env.load(); let useToken = await collect("DENO_DEPLOY_TOKEN", arg, env); let useProject = await collect("DENO_DEPLOY_PROJECT", arg, env); - let useEntry = await collect("DENO_DEPLOY_ENTRY", arg, env); - - Deno.env.set("DENO_DEPLOY_TOKEN", useToken || ""); - Deno.env.set("DENO_DEPLOY_ENTRY", useEntry || ""); - const command = new Deno.Command( `deno`, @@ -67,10 +61,11 @@ try "run", "-A", "--no-lock", - "--config=deno.json", "https://deno.land/x/deploy/deployctl.ts", "deploy", `--project=${useProject}`, + `--config=deno.json`, + `--token=${useToken}`, serveScript ], stdin: "piped",