Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quizlet/ts-migration
Tools to facilitate Quizlet's migration from Flow to TypeScript
https://github.com/quizlet/ts-migration
Last synced: about 2 months ago
JSON representation
Tools to facilitate Quizlet's migration from Flow to TypeScript
- Host: GitHub
- URL: https://github.com/quizlet/ts-migration
- Owner: quizlet
- License: mit
- Archived: true
- Created: 2019-05-13T17:10:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-13T23:24:02.000Z (over 5 years ago)
- Last Synced: 2024-07-26T23:47:41.336Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 572 KB
- Stars: 39
- Watchers: 27
- Forks: 20
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flow to TypeScript Migration Tools
These are a collection of tools that we used at Quizlet when migrating from Flow to TypeScript. We hope that you find these tools useful when doing your own migration, but keep in mind that they are made for the particularities of Quizlet's large codebase. You may need to modify these tools to suit your needs, but that said, they should be at the very least a good starting point.
The converter uses a fork of [babel-plugin-flow-to-typescript](https://github.com/rgoldfinger-quizlet/babel-plugin-flow-to-typescript) along with [Recast](https://github.com/benjamn/recast) to preserve formatting. As it runs, it will rename files to `.ts` (or `.tsx` if it contains React), along with any snaps. In order to preserve the git history, this runs the conversion and commits the changes, and then renames all the files in a separate commit.
## Installation
```
yarn add --dev quizlet/ts-migration.git[#commit]
```### This tool assumes:
1. TypeScript is installed in your codebase, and you have a `tsconfig.json` configured to suit your needs.
2. You use prettier, and you have a `.prettierrc`.## Commands:
Once installed, you can access the tools via the binary.
### Preview a conversion (without renaming files):
```
yarn ts-migration convert-codebase
```### Convert the codebase and rename files to `.ts[x]`:
```
yarn ts-migration convert-codebase --commit
```### Ignore all TypeScript errors:
```
yarn ts-migration ignore-errors [--commit] [--includeJSX]
```The `--includeJSX` option can be extremely useful when you have a lot of errors you want to ignore, but will insert ignore comments in such a way that they can appear in the rendered HTML, so be sure to carefully review the output!
### Strip Flow comments
```
yarn ts-migration strip-comments [--commit]
```# License
ts-migration is [MIT licensed](./LICENSE).