@usercli/clideveloper 2.1.5 β†’ 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -55,6 +55,7 @@ With **Easy Dev Installer**, you can quickly install and configure:
55
55
  - Express.js
56
56
  - CORS
57
57
  - Prisma
58
+ - Redis
58
59
  - NestJS
59
60
 
60
61
  …and more in future updates! All without breaking a sweat 😎.
@@ -97,6 +97,20 @@ app.listen(7000,()=> console.log("Server is on and running on port 7000"))
97
97
  return "Yes or No only";
98
98
  }
99
99
  },
100
+
101
+ {
102
+ name:"redis",
103
+ type:"rawlist",
104
+ message:"Yes or No to install ioredis in express?",
105
+ choices:["Yes","No"],
106
+ validate:(check)=>{
107
+ if(check.trim()=="Yes" || check.trim()=="No"){
108
+ return true;
109
+ }
110
+
111
+ return "Yes or No only";
112
+ }
113
+ }
100
114
  ])
101
115
 
102
116
 
@@ -116,7 +130,7 @@ app.listen(7000,()=> console.log("Server is on and running on port 7000"))
116
130
 
117
131
 
118
132
 
119
- async function userNpmInstall({mongooseInstall,cors,prisma},path){
133
+ async function userNpmInstall({mongooseInstall,cors,prisma,redis},path){
120
134
  try{
121
135
 
122
136
  // mongoose installing process
@@ -190,6 +204,92 @@ app.listen(7000,()=> console.log("Server is on and running on port 7000"))
190
204
  console.log("Prisma installed completely with prisma setup");
191
205
  }
192
206
 
207
+ if(redis=="Yes"){
208
+ try{
209
+ // write redis file or create folder
210
+
211
+ let spinner=createSpinner("Downloading all the things which are required to run redies...").start();
212
+ await execPromise("npm i ioredis",{cwd:`${path}/backend`})
213
+ await execPromise("npm i cors",{cwd:`${path}/backend`})
214
+ await execPromise("npm i dotenv",{cwd:`${path}/backend`});
215
+
216
+ await fs.mkdir(`${path}/backend/redisFileForConnection`,{recursive:true});
217
+
218
+ let redisCode=`
219
+ const Redis=require("ioredis");
220
+ require("dotenv").config();
221
+
222
+ const redis=new Redis({
223
+
224
+ host:process.env.REDIS_HOST,
225
+ password:process.env.REDIS_PASS,
226
+ port:process.env.REDIS_PORT
227
+ })
228
+
229
+
230
+ module.exports={redis}
231
+
232
+ `
233
+
234
+ let cleanRedis=redisCode.trim();
235
+
236
+ await fs.writeFile(`${path}/backend/redisFileForConnection/redisConnection.js`,cleanRedis);
237
+
238
+ // env file is made
239
+ let envData=`
240
+ # string
241
+ REDIS_HOST=""
242
+
243
+ #string
244
+ REDIS_PASS=""
245
+
246
+ #number
247
+ REDIS_PORT=
248
+ `;
249
+ let cleanEnvFile=envData.trim();
250
+ await fs.writeFile(`${path}/backend/.env`,cleanEnvFile);
251
+ console.log("Env file is made succefully");
252
+
253
+
254
+
255
+
256
+ let expressCode=`
257
+ const express=require("express");
258
+ const cors=require("cors");
259
+ const {redis}=require("./redisFileForConnection/redisConnection");
260
+
261
+
262
+ const app=express();
263
+
264
+ redis.on("connect",()=>{
265
+ console.log("redis is connected succesfully");
266
+ })
267
+
268
+ app.use(cors());
269
+
270
+ app.get("/",(_,res)=>{
271
+
272
+ res.status(200).json({success:"hello developer"});
273
+
274
+ })
275
+
276
+ app.listen(7000,()=> console.log("Server is on and running on port 7000"))
277
+
278
+ `
279
+
280
+ let clean=expressCode.trim();
281
+ let readFile=await fs.readFile(`${path}/backend/index.js`,"utf8");
282
+
283
+ readFile=readFile=clean;
284
+
285
+ await fs.writeFile(`${path}/backend/index.js`,readFile);
286
+ spinner.success({text:"redis setup is done enjoy!"});
287
+
288
+ }catch(err){
289
+ console.log("ioredis is not install for some reason");
290
+ }
291
+ }
292
+
193
293
 
194
294
  else{
195
295
  if(mongooseInstall=="No"){
@@ -202,6 +302,10 @@ app.listen(7000,()=> console.log("Server is on and running on port 7000"))
202
302
  console.log("You do not installed prisma");
203
303
  }
204
304
 
305
+ if(redis=="No"){
306
+ console.log("You do not install redis");
307
+ }
308
+
205
309
  else{
206
310
  console.log("There is no option like this");
207
311
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usercli/clideveloper",
3
- "version": "2.1.5",
3
+ "version": "2.2.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {