Created
April 20, 2021 17:15
-
-
Save regmicmahesh/189f46f528ab39b6517f6e8f3240ba32 to your computer and use it in GitHub Desktop.
ts setup
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 "npm/yarn?" | |
read pm | |
echo "Selected $pm" | |
read -r -d '' tsconfig << EOM | |
{ | |
"compilerOptions": { | |
"module": "commonjs", | |
"outDir": "./build/", | |
"rootDir": "./src/", | |
"strict": true, | |
"baseUrl": "./", | |
"paths": { | |
"*" : ["node_modules"] | |
}, | |
"esModuleInterop": true, | |
"skipLibCheck": true, | |
"forceConsistentCasingInFileNames": true | |
} | |
} | |
EOM | |
read -r -d '' package << EOM | |
{ | |
"scripts": { | |
"dev": "concurrently --kill-others \"tsc -w\" \"nodemon dist/app.js\"" | |
} | |
} | |
EOM | |
case $pm in | |
npm) | |
echo -e "$package" >> package.json | |
echo -e "$tsconfig" > tsconfig.json | |
sudo npm i -g typescript concurrently nodemon | |
echo "$ts_config" >> tsconfig.json | |
mkdir src dist | |
touch src/app.ts dist/app.js | |
echo "npm run dev to get started." | |
;; | |
yarn) | |
echo -e "$package" >> package.json | |
echo -e "$tsconfig" > tsconfig.json | |
yarn global add typescript concurrently nodemon | |
echo "ts_config" >> tsconfig.json | |
mkdir src | |
mkdir dist | |
touch src/app.ts | |
echo "yarn dev to get started." | |
;; | |
*) | |
echo -n "Unknown" | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment