jackbsteinberg / get-originals-rewriter

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Remove jscodeshift dependency #30

Closed domenic closed 5 years ago

domenic commented 5 years ago

Since we're now using ts-morph, we shouldn't bring in the large jscodeshift dependency. Currently we are only using it for being a command-line wrapper that feeds rewriter.js the source text, plus we are using its testing framework.

For the command-line wrapper, I think we should replace it with our own custom CLI. This is not too hard to write. The usage should be

$ node rewriter.js input.mjs output.mjs

(I don't think we need to support multiple inputs/outputs; just run the script multiple times.) An example of how this could work is in https://github.com/domenic/svg2png/blob/master/bin/svg2png-cli.js, although we don't need the complicated args parsing using yargs.

For the tests, I think this might be a good match for my baseline-tester project, or we could use Jest snapshot testing.

domenic commented 5 years ago

Discussed in person: let's keep using Jest, instead of moving to baseline tester. We may or may not want to use snapshot testing; I like the current straightforward input.js/output.js structure instead of the single snapshot file.

domenic commented 5 years ago

Also, this task is getting bumped up in priority, because currently we broke the command line invocation.