tweak deploy script

This commit is contained in:
Seth Trowbridge 2023-07-29 20:25:41 -04:00
parent 06981cc067
commit 19097e1e68
3 changed files with 7 additions and 10 deletions

View File

@ -13,6 +13,7 @@
{ {
"local": "deno run -A --reload=http://localhost --no-lock ./run-local.tsx --port=1234", "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", "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"
} }
} }

1
example/.env Normal file
View File

@ -0,0 +1 @@
DENO_DEPLOY_TOKEN=1

View File

@ -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"; import { parse } from "https://deno.land/std@0.194.0/flags/mod.ts";
@ -47,18 +47,12 @@ try
{ {
console.log("Runing deploy!"); console.log("Runing deploy!");
const serveScript = import.meta.resolve("./run-serve.tsx"); const serveScript = import.meta.resolve("./run-serve.tsx");
console.log("Serve script:", serveScript);
let arg = parse(Deno.args); let arg = parse(Deno.args);
let env = await load(); let env = await Env.load();
let useToken = await collect("DENO_DEPLOY_TOKEN", arg, env); let useToken = await collect("DENO_DEPLOY_TOKEN", arg, env);
let useProject = await collect("DENO_DEPLOY_PROJECT", 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( const command = new Deno.Command(
`deno`, `deno`,
@ -67,10 +61,11 @@ try
"run", "run",
"-A", "-A",
"--no-lock", "--no-lock",
"--config=deno.json",
"https://deno.land/x/deploy/deployctl.ts", "https://deno.land/x/deploy/deployctl.ts",
"deploy", "deploy",
`--project=${useProject}`, `--project=${useProject}`,
`--config=deno.json`,
`--token=${useToken}`,
serveScript serveScript
], ],
stdin: "piped", stdin: "piped",