Skip to content

Commit 3ad0acf

Browse files
committed
perf: remove execa
1 parent a167e89 commit 3ad0acf

File tree

3 files changed

+4
-135
lines changed

3 files changed

+4
-135
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
},
6161
"dependencies": {
6262
"ast-kit": "^2.0.0",
63-
"execa": "^9.5.3",
6463
"fast-glob": "^3.3.3",
6564
"magic-string": "^0.30.17",
6665
"picomatch": "^4.0.2",

pnpm-lock.yaml

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

src/core/enum.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import assert from 'node:assert'
2+
import { spawnSync } from 'node:child_process'
23
import { readFileSync } from 'node:fs'
34
import path from 'node:path'
45
import { babelParse, getLang, isTs } from 'ast-kit'
5-
import { execaSync } from 'execa'
66
import fg from 'fast-glob'
77
import picomatch from 'picomatch'
88
import type { OptionsResolved } from './options'
@@ -216,15 +216,12 @@ export function scanFiles(options: ScanOptions): string[] {
216216
})
217217
.map((file) => path.resolve(options.scanDir, file))
218218
} else {
219-
const { stdout, stderr, exitCode } = execaSync(
219+
const { stdout, stderr, status } = spawnSync(
220220
'git',
221221
['grep', '--untracked', 'export enum'],
222-
{
223-
cwd: options.scanDir,
224-
reject: false,
225-
},
222+
{ cwd: options.scanDir, encoding: 'utf8' },
226223
)
227-
if (exitCode !== 0) {
224+
if (status !== 0) {
228225
if (stderr) throw new Error(`git grep failed: ${stderr}`)
229226
else return []
230227
}

0 commit comments

Comments
 (0)