facebook / jscodeshift

A JavaScript codemod toolkit.
https://jscodeshift.com
MIT License
9.11k stars 468 forks source link

Process all supported JavaScript extensions by default #584

Closed trivikr closed 4 months ago

trivikr commented 5 months ago

Description

Fixes: https://github.com/facebook/jscodeshift/issues/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)
Daniel15 commented 4 months ago

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

Daniel15 commented 4 months ago

Published as 0.15.2. Thanks for your contribution!