Skip to content

Commit

Permalink
feat: replace ezspawn with tinyexec (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Aug 12, 2024
1 parent b7d3293 commit 8580e01
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@
"release": "bumpp --commit --push --tag && pnpm publish",
"lint": "eslint ."
},
"dependencies": {
"@jsdevtools/ez-spawn": "^3.0.4"
},
"devDependencies": {
"@antfu/eslint-config": "^2.16.0",
"@antfu/ni": "^0.21.12",
Expand All @@ -57,5 +54,8 @@
"publint": "^0.2.7",
"tsup": "^8.0.2",
"typescript": "^5.4.5"
},
"dependencies": {
"tinyexec": "^0.1.2"
}
}
11 changes: 8 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/install.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync } from 'node:fs'
import process from 'node:process'
import { resolve } from 'node:path'
import { async as ezspawn } from '@jsdevtools/ez-spawn'
import { x } from 'tinyexec'
import { detectPackageManager } from '.'

export interface InstallPackageOptions {
Expand Down Expand Up @@ -34,7 +34,7 @@ export async function installPackage(names: string | string[], options: InstallP
if (agent === 'pnpm' && existsSync(resolve(options.cwd ?? process.cwd(), 'pnpm-workspace.yaml')))
args.unshift('-w')

return ezspawn(
return x(
agent,
[
agent === 'yarn'
Expand All @@ -45,8 +45,10 @@ export async function installPackage(names: string | string[], options: InstallP
...names,
].filter(Boolean),
{
stdio: options.silent ? 'ignore' : 'inherit',
cwd: options.cwd,
nodeOptions: {
stdio: options.silent ? 'ignore' : 'inherit',
cwd: options.cwd,
},
},
)
}

0 comments on commit 8580e01

Please sign in to comment.