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

Process all supported JavaScript extensions by default #584

Merged
merged 1 commit into from Feb 22, 2024

Conversation

trivikr
Copy link
Contributor

@trivikr trivikr commented Feb 21, 2024

Description

Fixes: #582

Testing

Before

The ts files are not processed by default

$ ../jscodeshift/bin/jscodeshift.js example.ts 2>&1 | head -n 1
No files selected, nothing to do.

The extensions had to be explicitly passed

$ ../jscodeshift/bin/jscodeshift.js --extensions=ts example.ts 2>&1 | head -n 1
Processing 1 files...

By default, the extensions is set to js

$ ../jscodeshift/bin/jscodeshift.js --help | grep -A 1 extensions
      --extensions=EXT          transform files with these file extensions (comma separated list)
                                (default: js)

After

The ts files are processed without requiring to pass extensions

$ ../jscodeshift/bin/jscodeshift.js example.ts 2>&1 | head -n 1
Processing 1 files...

The ts files are skipped if extensions do not allow it

$ ../jscodeshift/bin/jscodeshift.js --extensions=js example.ts 2>&1 | head -n 1
No files selected, nothing to do.

The ts files are processed if extensions allow it

$ ../jscodeshift/bin/jscodeshift.js --extensions=ts example.ts 2>&1 | head -n 1
Processing 1 files...

By default, the extensions include all supported JavaScript/TypeScript files

$ ../jscodeshift/bin/jscodeshift.js --help | grep -A 1 extensions
      --extensions=EXT          transform files with these file extensions (comma separated list)
                                (default: cjs,es,es6,js,jsx,mjs,ts,tsx)

Copy link
Member

@Daniel15 Daniel15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

@Daniel15 Daniel15 merged commit 6869004 into facebook:main Feb 22, 2024
4 checks passed
@Daniel15
Copy link
Member

I'll try publish this by the end of the week.

@trivikr trivikr deleted the extensions-default-supported branch February 22, 2024 00:48
@Daniel15
Copy link
Member

Daniel15 commented Feb 22, 2024

Published as 0.15.2. Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] jscodeshift@0.15.1 ignores the files not starting with .js extension by default
3 participants