Skip to content

Commit bf603c5

Browse files
committed
refactor: replace execa w/ ezspawn
1 parent eb4201b commit bf603c5

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
},
3636
"dependencies": {
3737
"@antfu/ni": "^0.21.12",
38+
"@jsdevtools/ez-spawn": "^3.0.4",
3839
"cli-progress": "^3.12.0",
3940
"deepmerge": "^4.3.1",
4041
"detect-indent": "^7.0.1",
41-
"execa": "^8.0.1",
4242
"picocolors": "^1.0.0",
4343
"prompts": "^2.4.2",
4444
"ufo": "^1.5.3",

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/check/checkGlobal.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-console */
2-
import { execa, execaCommand } from 'execa'
2+
import { async as ezspawnAsync } from '@jsdevtools/ez-spawn'
33
import c from 'picocolors'
44
import prompts from 'prompts'
55
import { type Agent, getCommand } from '@antfu/ni'
@@ -118,7 +118,7 @@ async function loadGlobalPnpmPackage(options: CheckOptions): Promise<GlobalPacka
118118
let pnpmStdout
119119

120120
try {
121-
pnpmStdout = (await execa('pnpm', ['ls', '--global', '--depth=0', '--json'], { stdio: 'pipe' })).stdout
121+
pnpmStdout = (await ezspawnAsync('pnpm', ['ls', '--global', '--depth=0', '--json'], { stdio: 'pipe' })).stdout
122122
}
123123
catch (error) {
124124
return []
@@ -152,7 +152,7 @@ async function loadGlobalPnpmPackage(options: CheckOptions): Promise<GlobalPacka
152152
}
153153

154154
async function loadGlobalNpmPackage(options: CheckOptions): Promise<GlobalPackageMeta> {
155-
const { stdout } = await execa('npm', ['ls', '--global', '--depth=0', '--json'], { stdio: 'pipe' })
155+
const { stdout } = await ezspawnAsync('npm', ['ls', '--global', '--depth=0', '--json'], { stdio: 'pipe' })
156156
const npmOut = JSON.parse(stdout) as NpmOut
157157
const filter = createDependenciesFilter(options.include, options.exclude)
158158

@@ -182,5 +182,5 @@ async function installPkg(pkg: GlobalPackageMeta) {
182182
const dependencies = dumpDependencies(changes, 'dependencies')
183183
const updateArgs = Object.entries(dependencies).map(([name, version]) => `${name}@${version}`)
184184
const installCommand = getCommand(pkg.agent, 'global', [...updateArgs])
185-
await execaCommand(installCommand, { stdio: 'inherit' })
185+
await ezspawnAsync(installCommand, { stdio: 'inherit' })
186186
}

test/cli.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import path from 'node:path'
22
import { expect, it } from 'vitest'
3-
import { execa } from 'execa'
3+
import { async as ezspawnAsync } from '@jsdevtools/ez-spawn'
44

55
it('taze cli should just works', async () => {
66
const binPath = path.resolve(__dirname, '../bin/taze.mjs')
77

8-
const proc = await execa(process.execPath, [binPath], { stdio: 'pipe' })
8+
const proc = await ezspawnAsync(process.execPath, [binPath], { stdio: 'pipe' })
99

1010
expect(proc.stderr).toBe('')
1111
})

0 commit comments

Comments
 (0)