@@ -34,6 +34,7 @@ echo -e "${YELLOW}\n4) We generated the tsconfig.json with default options${NC}"
34
34
35
35
npx tsc --init
36
36
37
+ # Typescript config file modification
37
38
sed -i.bak '
38
39
s/\/\/ *"rootDir": *".\/"/"rootDir": "\.\/src"/g
39
40
s/\/\/ *"outDir": *".\/"/"outDir": "\.\/dist"/g
@@ -146,6 +147,7 @@ module.exports = {
146
147
};
147
148
EOF
148
149
150
+
149
151
# We set up the scripts in package.json
150
152
echo -e " ${YELLOW} \n11) We set up the scripts in package.json${NC} "
151
153
@@ -155,8 +157,51 @@ npx json -I -f package.json -e 'this.scripts.build="tsc"'
155
157
npx json -I -f package.json -e ' this.scripts.lint="eslint . --ext .ts"'
156
158
npx json -I -f package.json -e ' this.scripts["lint:fix"]="eslint . --ext .ts --fix"'
157
159
160
+ echo -e " ${YELLOW} \n12) Choose your database engine:${NC} "
161
+ echo " 1) PostgreSQL with Sequelize"
162
+ echo " 2) MySQL with Sequelize"
163
+ echo " 3) MongoDB with Mongoose"
164
+ echo " 4) typeORM with postgres"
165
+ echo " 5) No database engine"
166
+ read -p " Enter your choice (1-5): " db_choice
167
+
168
+ case " $db_choice " in
169
+ " 1" )
170
+ echo " Installing PostgreSQL and Sequelize dependencies..."
171
+ npm install pg sequelize
172
+ npm install -D @types/pg @types/sequelize
173
+ echo -e " \n# PostgreSQL Configuration\nDB_HOST=localhost\nDB_PORT=5432\nDB_NAME=your_database\nDB_USER=your_username\nDB_PASSWORD=your_password" >> .env
174
+ ;;
175
+ " 2" )
176
+ echo " Installing MySQL and Sequelize dependencies..."
177
+ npm install mysql2 sequelize
178
+ npm install -D @types/mysql @types/sequelize
179
+ echo -e " \n# MySQL Configuration\nDB_HOST=localhost\nDB_PORT=3306\nDB_NAME=your_database\nDB_USER=your_username\nDB_PASSWORD=your_password" >> .env
180
+ ;;
181
+ " 3" )
182
+ echo " Installing MongoDB and Mongoose dependencies..."
183
+ npm install mongodb mongoose
184
+ npm install -D @types/mongodb @types/mongoose
185
+ echo -e " \n# MongoDB Configuration\nMONGO_URI=mongodb://localhost:27017/your_database" >> .env
186
+ ;;
187
+ " 4" )
188
+ echo " Installing typeORM dependencies..."
189
+ bash typeOrm.sh
190
+ ;;
191
+ " 5" )
192
+ echo " No database dependencies installed."
193
+ ;;
194
+ * )
195
+ echo " Invalid choice. No database dependencies installed."
196
+ ;;
197
+ esac
198
+
158
199
PACKAGE_JSON=" ./package.json"
159
- sed -i ' s/\^//g' " $PACKAGE_JSON "
200
+ if [[ " $OSTYPE " == " darwin" * ]]; then
201
+ sed -i ' ' ' s/\^//g' " $PACKAGE_JSON "
202
+ else
203
+ sed -i ' s/\^//g' " $PACKAGE_JSON "
204
+ fi
160
205
161
206
echo -e " ${GREEN} =========================================================${NC} "
162
207
echo -e " ${RED} ${BOLD} Follow us on GitHub:${NC} "
0 commit comments