Skip to content
This repository was archived by the owner on Sep 21, 2019. It is now read-only.

Safety/QOL fixes #39

Merged
merged 7 commits into from
May 20, 2018
Merged

Safety/QOL fixes #39

merged 7 commits into from
May 20, 2018

Conversation

akx
Copy link
Contributor

@akx akx commented May 19, 2018

This PR makes transformations a little safer and easier to script.

  • Safety: a temporary .tsx file is first created as the transformation target, instead of wholesale renaming the original JS file to .tsx for transformation; if transformation succeeds, the target .tsx is written and the original and temporary files are deleted (unless the new --keep-*-files flags are set). (Before this, the original .js file was renamed but left untransformed if there were problems.)
  • QOL: A new --ignore-prettier-errors option was added, to make it possible to use "almost working" TS files (see Named-function SFCs get mistransformed #38)
  • QOL/scripting: The CLI now exits, as is customary, with error code 1 if there were any transformation problems.
  • QOL/bugfix: Multiple files/glob parameters didn't work correctly before; only the first argument was parsed, and since glob expansion occurs at shell level, one would have had to invoke the command using bin/... 'my/**.tsx' (note the extra quotes). Multiple parameters (i.e. shell expansion) now works (but Node-level globs do too).
  • QOL: A progress message was added to the otherwise very quiet CLI. :)

Thanks for the project – I've had lots of fun, even, converting codebases to TypeScript :)

@mohsen1
Copy link
Contributor

mohsen1 commented May 19, 2018

Thanks for your contribution! I'll review and provide more feedback. In the meantime I'll try to fix the issue you raised in #38. We should never print invalid TS and Prettier should never fail.

@mohsen1 mohsen1 merged commit 3b91d88 into lyft:master May 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants