diff --git a/package.json b/package.json index 055d036..89e280e 100644 --- a/package.json +++ b/package.json @@ -35,10 +35,10 @@ }, "dependencies": { "@antfu/ni": "^0.22.1", - "@jsdevtools/ez-spawn": "^3.0.4", "js-yaml": "^4.1.0", "npm-registry-fetch": "^17.1.0", "ofetch": "^1.3.4", + "tinyexec": "^0.3.0", "unconfig": "^0.5.5", "yargs": "^17.7.2" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c9c39fc..bff8db2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,9 +11,6 @@ importers: '@antfu/ni': specifier: ^0.22.1 version: 0.22.1 - '@jsdevtools/ez-spawn': - specifier: ^3.0.4 - version: 3.0.4 js-yaml: specifier: ^4.1.0 version: 4.1.0 @@ -23,6 +20,9 @@ importers: ofetch: specifier: ^1.3.4 version: 1.3.4 + tinyexec: + specifier: ^0.3.0 + version: 0.3.0 unconfig: specifier: ^0.5.5 version: 0.5.5 @@ -2907,6 +2907,9 @@ packages: tinybench@2.8.0: resolution: {integrity: sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==} + tinyexec@0.3.0: + resolution: {integrity: sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==} + tinypool@1.0.0: resolution: {integrity: sha512-KIKExllK7jp3uvrNtvRBYBWBOAXSX8ZvoaD8T+7KB/QHIuoJW3Pmr60zucywjAlMb5TeXUkcs/MWeWLu0qvuAQ==} engines: {node: ^18.0.0 || >=20.0.0} @@ -6060,6 +6063,8 @@ snapshots: tinybench@2.8.0: {} + tinyexec@0.3.0: {} + tinypool@1.0.0: {} tinyrainbow@1.2.0: {} diff --git a/src/commands/check/checkGlobal.ts b/src/commands/check/checkGlobal.ts index 1bebe81..1f31b08 100644 --- a/src/commands/check/checkGlobal.ts +++ b/src/commands/check/checkGlobal.ts @@ -1,5 +1,5 @@ /* eslint-disable no-console */ -import { async as ezspawn } from '@jsdevtools/ez-spawn' +import { exec } from 'tinyexec' import c from 'picocolors' import prompts from 'prompts' import { type Agent, getCommand } from '@antfu/ni' @@ -120,7 +120,7 @@ async function loadGlobalPnpmPackage(options: CheckOptions): Promise { - const { stdout } = await ezspawn('npm', ['ls', '--global', '--depth=0', '--json'], { stdio: 'pipe' }) + const { stdout } = await exec('npm', ['ls', '--global', '--depth=0', '--json'], { throwOnError: true }) const npmOut = JSON.parse(stdout) as NpmOut const filter = createDependenciesFilter(options.include, options.exclude) @@ -188,5 +188,5 @@ async function installPkg(pkg: GlobalPackageMeta) { const dependencies = dumpDependencies(changes, 'dependencies') const updateArgs = Object.entries(dependencies).map(([name, version]) => `${name}@${version}`) const installCommand = getCommand(pkg.agent, 'global', [...updateArgs]) - await ezspawn(installCommand, { stdio: 'inherit' }) + await exec(installCommand, [], { throwOnError: true }) } diff --git a/test/cli.test.ts b/test/cli.test.ts index c0e476d..0f9781c 100644 --- a/test/cli.test.ts +++ b/test/cli.test.ts @@ -1,11 +1,11 @@ import path from 'node:path' import { expect, it } from 'vitest' -import { async as ezspawn } from '@jsdevtools/ez-spawn' +import { exec } from 'tinyexec' it('taze cli should just works', async () => { const binPath = path.resolve(__dirname, '../bin/taze.mjs') - const proc = await ezspawn(process.execPath, [binPath], { stdio: 'pipe' }) + const proc = await exec(process.execPath, [binPath], { throwOnError: true }) expect(proc.stderr).toBe('') })