Skip to content

Commit

Permalink
fix(gatsby-codemods): fix spawning jscodeshift process (#36780)
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh authored Oct 10, 2022
1 parent f4ac70f commit 04ac1d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let execaReturnValue

jest.setMock("execa", {
sync: () => execaReturnValue,
node: () => execaReturnValue,
})

import process from "process"
Expand Down
6 changes: 2 additions & 4 deletions packages/gatsby-codemods/src/bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ export function runTransform(transform, targetDir) {
args = args.concat([`--transform`, transformerPath, targetDir])

console.log(`Executing command: jscodeshift ${args.join(` `)}`)

const pathToNodeBin = process.argv[0]
const result = execa.sync(pathToNodeBin, args, {
const result = execa.node(jscodeshiftExecutable, args, {
stdio: `inherit`,
stripEof: false,
})
Expand All @@ -52,7 +50,7 @@ export function run() {
if (!codemods.includes(transform)) {
console.log(
`You have passed in invalid codemod name: ${transform}. Please pass in one of the following: ${codemods.join(
", "
`, `
)}.`
)
return
Expand Down

0 comments on commit 04ac1d6

Please sign in to comment.