Skip to content

Instantly share code, notes, and snippets.

@BaezCrdrm
Last active October 7, 2022 16:11
Show Gist options
  • Save BaezCrdrm/33382813284be4a011ba879042ec6ff3 to your computer and use it in GitHub Desktop.
Save BaezCrdrm/33382813284be4a011ba879042ec6ff3 to your computer and use it in GitHub Desktop.
Express JS init using TypeScript

Dependencies installer

This script will help to install the (my) basic dependencies and Development dependencies for an ExpressJS based project using TypeScript.

How to use

$ chmod +x dep_installer.sh
$ ./dep_installer.sh [options] <path to project>

Options

Option Description
-y Use yarn instead of npm
-p Set a path to start the Express.js project
path=.
engine=npm
while getopts "yp:" option;
do
case ${option} in
y )
engine=yarn
;;
p )
path=$OPTARG
;;
esac
done
cd ${path}
if [ $engine == npm ];
then
echo "Installing using npm"
npm install express dotenv winston cors
npm install -D @types/chai-http @types/cors @types/express @types/mime-types @types/mocha @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser chai chai-http eslint mocha nodemon nyc supertest ts-node typescript
fi
if [ $engine == yarn ];
then
echo "Installing using yarn"
yarn add express dotenv winston cors
yarn add -D @types/chai-http @types/cors @types/express @types/mime-types @types/mocha @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser chai chai-http eslint mocha nodemon nyc supertest ts-node typescript
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment