Skip to content

Commit

Permalink
Fix jscodeshift error: env: node\r: No such file or directory
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed Feb 21, 2023
1 parent f340212 commit 5ac3b94
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions code/lib/codemod/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,17 @@ export async function runCodemod(codemod, { glob, logger, dryRun, rename, parser

const files = await globby([glob, '!**/node_modules', '!**/dist']);
logger.log(`=> Applying ${codemod}: ${files.length} files`);
if (!dryRun) {
if (files.length === 0) {
logger.log(`=> No matching files for glob: ${glob}`);
return;
}

if (!dryRun && files.length > 0) {
const parserArgs = inferredParser ? ['--parser', inferredParser] : [];
spawnSync(
'npx',
'node',
[
'jscodeshift',
require.resolve('jscodeshift/bin/jscodeshift'),
// this makes sure codeshift doesn't transform our own source code with babel
// which is faster, and also makes sure the user won't see babel messages such as:
// [BABEL] Note: The code generator has deoptimised the styling of repo/node_modules/prettier/index.js as it exceeds the max of 500KB.
Expand Down

0 comments on commit 5ac3b94

Please sign in to comment.