#!/bin/bash
# create tsconfig.json
echo "Create tsconfig.json"
touch tsconfig.json
# install packages for typescript
echo "install packages"
YARNCOMMAND='yarn add --dev typescript @types/react @types/node'
if $YARNCOMMAND ; then
echo "installed package by yarn"
yarn dev
else
npm install --save-dev typescript @types/react @types/node
echo "installed package by npm"
npm run dev
fi
# change ext from .js file to .ts/.tsx
echo "rename files"
find pages -name "_app.js" -or -name "index.js" | sed 'p;s/.js$/.tsx/' | xargs -n2 mv & \\n find pages/api -name "*.js" | sed 'p;s/.js$/.ts/' | xargs -n2 mv
echo "done ✌️"
Last active
May 8, 2021 20:19
-
-
Save koji/d06cb38ce10e6a5378dffe1199928d3b to your computer and use it in GitHub Desktop.
Temporary script for
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Create tsconfig.json" | |
touch tsconfig.json | |
echo "install packages" | |
YARNCOMMAND='yarn add --dev typescript @types/react @types/node' | |
if $YARNCOMMAND ; then | |
echo "installed package by yarn" | |
else | |
npm install --save-dev typescript @types/react @types/node | |
echo "installed package by npm" | |
fi | |
# WIP | |
echo "rename files" | |
find pages -name "_app.js" -or -name "index.js" | sed 'p;s/.js$/.tsx/' | xargs -n2 mv & \\n find pages/api -name "*.js" | sed 'p;s/.js$/.ts/' | xargs -n2 mv | |
echo "done ✌️" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment