generated from markthree/deno-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
25 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from "https://deno.land/std@0.182.0/fmt/colors.ts" | ||
export * from "https://deno.land/std@0.185.0/fmt/colors.ts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { dirname, join, slash } from "./path.ts" | ||
|
||
export { walk } from "https://deno.land/[email protected]/fs/walk.ts" | ||
|
||
export async function exist(path: string) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { Select } from "https://deno.land/x/[email protected]/mod.ts" | ||
|
||
import { exist } from "./fs.ts" | ||
import { creatLocalStorageRef } from "./storage.ts" | ||
import { Select } from "https://deno.land/x/[email protected]/mod.ts" | ||
|
||
export type PackageManager = "npm" | "yarn" | "pnpm" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
import { which } from "https://deno.land/x/[email protected]/mod.ts" | ||
|
||
import { cyan, red, yellow } from "./color.ts" | ||
import { which } from "https://deno.land/x/[email protected]/mod.ts" | ||
|
||
export async function execa(cmd: string[]) { | ||
const command = await which(cmd.shift()!) | ||
|
||
const process = Deno.run({ | ||
cmd: [command!, ...cmd], | ||
const commander = new Deno.Command(command!, { | ||
args: [...cmd], | ||
stdin: "inherit", | ||
stderr: "inherit", | ||
stdout: "inherit", | ||
}) | ||
|
||
let closed = false | ||
|
||
function childExit() { | ||
if (!closed) { | ||
// No need to manually pass in signo | ||
Deno.kill(process.pid) | ||
Deno.close(process.rid) | ||
process.kill() | ||
} | ||
closed = true | ||
} | ||
|
@@ -27,7 +26,6 @@ export async function execa(cmd: string[]) { | |
console.log( | ||
`❎ The task was ${yellow("manually interrupted")}`, | ||
) | ||
|
||
childExit() | ||
Deno.exit(130) | ||
}) | ||
|
@@ -41,9 +39,13 @@ export async function execa(cmd: string[]) { | |
childExit() | ||
}) | ||
|
||
const { success, code } = await process.status() | ||
globalThis.addEventListener("unload", () => { | ||
childExit() | ||
}) | ||
|
||
const process = commander.spawn() | ||
|
||
process.close() | ||
const { success, code } = await process.status | ||
|
||
if (!success) { | ||
console.log(`❎ ${red("Task execution failed")}`) | ||
|