Skip to content

Releases: facebook/jscodeshift

v0.3.20

24 Apr 05:56
Compare
Choose a tag to compare

New

  • --ignore-pattern and --ignore-file command line arguments, which allow you to specify paths to ignore when using jscodeshift to traverse over a dictionary ( #107 , @chrisdarroch )

  • jscodeshift.use which you can pass a plugin too. A plugin would a function that accepts a jscodeshift instance and calls registerMethods on it. This allows plugins to be decoupled form jscodeshift. In addition, if .use is called with the same plugin multiple times, subsequent calls are ignored.

    Example:

    function myPlugin(jscodeshift) {
      jscodeshift.registerMethods({
        myExtension() { ... },
      }, jscodeshift.Identifier);
    }
    
    jscodeshift.use(myPlugin);

    ( #108 , @jamestalmage )

  • Better registerMethods method! Until now, it was impossible to register two methods with the same name, even if it was attached to different types (and therefore, conceptually, different collections). @jamestalmage changed this in #110 and and now it's possible to register such methods if the types are not super- or sub-types.

    Example:

    jscodeshift.registerMethods({
      rename() { ... },
    }, j.Identifier);
    
    jscodeshift.registerMethods({
      rename() { ... },
    }, j.VariableDeclarator);
  • Unit tests for transforms: @Daniel15 added helper methods to make writing unit tests easier ( #104 ) . See the readme and the example for more information.

    This results in a directory structure like this:

      /MyTransform.js
      /__tests__/MyTransform-test.js
      /__testfixtures__/MyTransform.input.js
      /__testfixtures__/MyTransform.output.js
    

    To define a test, use defineTest from the testUtils module:

      jest.autoMockOff();
      const defineTest = require('jscodeshift/dist/testUtils').defineTest;
      defineTest(__dirname, 'MyTransform');
    

v0.3.19

27 Mar 07:00
Compare
Choose a tag to compare

Fixes

  • Fixed hanging worker processes under certain conditions (we weren't able to find out the exact reasons but it looks like it involves processing at least 75 files) ( #102 ).
  • Added missing line breaks to CLI output.

Internals

  • Switched to jest 0.9.2.

v0.3.18

18 Mar 22:45
Compare
Choose a tag to compare

Fixes

Fixed log output ( #101 )

v0.3.17

17 Mar 23:19
Compare
Choose a tag to compare

Fixes

Both jscodeshift -t ... foo and jscodeshift -t ... foo/ work now ( #100 )

v0.3.16

15 Mar 20:28
Compare
Choose a tag to compare

Fixes

  • Installation issue (missing module)
  • Typo (process.std vs process.stdout)

v0.3.15

15 Mar 16:31
Compare
Choose a tag to compare

New

@iamdustan added supported for passing URLs to -t to load transforms remotely ( #94, #95 )

jscodeshift -t http://path/to/script.js

Note: That script cannot have any external dependencies, it has to be entirely self-contained.

Fixes

v0.3.14

09 Mar 01:44
Compare
Choose a tag to compare

Improvements

@avikchaudhuri improved invalid symlink handling ( #92 ) and worker performance ( #93 )!

v0.3.13

25 Jan 22:09
Compare
Choose a tag to compare

Fixes

Ignore local .babelrc files. This fixes issues with running jscodeshift on code that was in a project that uses Babel. ( #85 ). Thanks to @sviridov!

v0.3.12

07 Jan 16:55
Compare
Choose a tag to compare

Fixes

Fixed filtering for .closest method ( #83). Thanks @juliankrispel!

v0.3.11

19 Dec 01:33
Compare
Choose a tag to compare

New

The --slient / -s option suppresses logging to the console ( #79 , #60 ).