Skip to content

Instantly share code, notes, and snippets.

View skovhus's full-sized avatar

Kenneth Skovhus skovhus

View GitHub Profile
@skovhus
skovhus / flow-to-typescript-codemod.sh
Last active May 26, 2022 16:27
Quick and dirty flow-to-typscript migration codemod
#!/bin/sh
#
# This is a super quick and dirty codemod for migration a codebase from Flow to TypeScript.
#
# Step 1:
# npm i -g jscodeshift
# Step 2: rename all .js files to .ts(x)
# find src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
# find storybook -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
# find src/**/components -name "*.ts" -exec sh -c 'mv "$0" "${0%.ts}.tsx"' {} \;