Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
markthree committed May 3, 2023
1 parent 01d6a71 commit 6236a56
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 20 deletions.
14 changes: 7 additions & 7 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { join } from "./src/path.ts"
import { listLog } from "./src/log.ts"
import { cyan, green, red, yellow } from "./src/color.ts"
import { execa, normalFusing } from "./src/process.ts"
import { isPackageManager, usePackageManager } from "./src/pm.ts"
import { exist, findUpNodeModules, findUpPackageJson } from "./src/fs.ts"
import { extractDeps, extractDepsFromPackageJson } from "./src/extract.ts"
import { cyan, green, red, yellow } from './src/color.ts';
import { extractDeps, extractDepsFromPackageJson } from './src/extract.ts';
import { exist, findUpNodeModules, findUpPackageJson } from './src/fs.ts';
import { listLog } from './src/log.ts';
import { join } from './src/path.ts';
import { isPackageManager, usePackageManager } from './src/pm.ts';
import { execa, normalFusing } from './src/process.ts';

const { staging, ref: pm, getCommand, select: selectPM } = usePackageManager()

Expand Down
2 changes: 1 addition & 1 deletion src/color.ts
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"
3 changes: 2 additions & 1 deletion src/extract.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { exist, walk } from "./fs.ts"
import { builtinModules as _builtinModules } from "node:module"

import { exist, walk } from "./fs.ts"

export const BUILTIN_MODULES = [
"module",
"node:module",
Expand Down
1 change: 1 addition & 0 deletions src/fs.ts
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) {
Expand Down
2 changes: 1 addition & 1 deletion src/path.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { dirname, join } from "https://deno.land/std@0.182.0/path/mod.ts"
export { dirname, join } from "https://deno.land/std@0.185.0/path/mod.ts"

export function slash(path: string) {
return path.replace(/\\/g, "/")
Expand Down
3 changes: 2 additions & 1 deletion src/pm.ts
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"

Expand Down
20 changes: 11 additions & 9 deletions src/process.ts
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
}
Expand All @@ -27,7 +26,6 @@ export async function execa(cmd: string[]) {
console.log(
`❎ The task was ${yellow("manually interrupted")}`,
)

childExit()
Deno.exit(130)
})
Expand All @@ -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")}`)
Expand Down

0 comments on commit 6236a56

Please sign in to comment.