Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Fix jscodeshift error: env: node\r: No such file or directory #21180

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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