Replaces:
^const ([^ ]+) = require\(([^)]*)\)$
import $1 from $2
^const ([^ ]+) = require\(([^)]*)\).(.*)$
import { $3 as $1 } from $2
^const \{ ([^}]+)\} = require\(([^)]*)\)$
import { $1 } from $2
module\.exports =
export default
Renaming .js
to .ts
(it takes a while):
find . -depth -name "*.js" -exec sh -c 'mv "$1" "${1%.js}.ts"' _ {} \;