@usercli/clideveloper 2.2.6 → 2.2.7
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/components/expressjs.js +30 -4
- package/package.json +1 -1
package/components/expressjs.js
CHANGED
|
@@ -209,10 +209,36 @@ app.listen(7000,()=> console.log("Server is on and running on port 7000"))
|
|
|
209
209
|
// write redis file or create folder
|
|
210
210
|
|
|
211
211
|
let spinner=createSpinner("Downloading all the things which are required to run redies...").start();
|
|
212
|
+
|
|
212
213
|
await execPromise("npm i ioredis",{cwd:`${path}/backend`})
|
|
213
214
|
await execPromise("npm i cors",{cwd:`${path}/backend`})
|
|
214
215
|
await execPromise("npm i dotenv",{cwd:`${path}/backend`});
|
|
215
216
|
|
|
217
|
+
spinner.success({text:"All requirements are installed successfully"});
|
|
218
|
+
spinner.stop();
|
|
219
|
+
|
|
220
|
+
console.log("To fully setup redis answer below question to run the redis");
|
|
221
|
+
// env redis file setup
|
|
222
|
+
|
|
223
|
+
const envRedis=await inquire.prompt([
|
|
224
|
+
{
|
|
225
|
+
name:"envHost",
|
|
226
|
+
type:"editor",
|
|
227
|
+
message:"Write your host name which is required to run redis editor will open copy and past your host name and with ctrl+s save it and close the editor fully?:"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name:"envPass",
|
|
231
|
+
type:"editor",
|
|
232
|
+
message:"Write your password which is required to run redis editor will open copy and past your password and with ctrl+s save it and close the editor fully?:"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name:"envPort",
|
|
236
|
+
type:"input",
|
|
237
|
+
message:"Write your port which is required to run redis?:"
|
|
238
|
+
}
|
|
239
|
+
])
|
|
240
|
+
|
|
241
|
+
let spinner1=createSpinner("Doing setup for redies...").start();
|
|
216
242
|
await fs.mkdir(`${path}/backend/redisFileForConnection`,{recursive:true});
|
|
217
243
|
|
|
218
244
|
let redisCode=`
|
|
@@ -238,13 +264,13 @@ module.exports={redis}
|
|
|
238
264
|
// env file is made
|
|
239
265
|
let envData=`
|
|
240
266
|
# string
|
|
241
|
-
REDIS_HOST
|
|
267
|
+
REDIS_HOST=${envRedis.envHost}
|
|
242
268
|
|
|
243
269
|
#string
|
|
244
|
-
REDIS_PASS
|
|
270
|
+
REDIS_PASS=${envRedis.envPass}
|
|
245
271
|
|
|
246
272
|
#number
|
|
247
|
-
REDIS_PORT
|
|
273
|
+
REDIS_PORT=${parseInt(envRedis.envPort)}
|
|
248
274
|
`;
|
|
249
275
|
let cleanEnvFile=envData.trim();
|
|
250
276
|
await fs.writeFile(`${path}/backend/.env`,cleanEnvFile);
|
|
@@ -283,7 +309,7 @@ app.listen(7000,()=> console.log("Server is on and running on port 7000"))
|
|
|
283
309
|
readFile=readFile=clean;
|
|
284
310
|
|
|
285
311
|
await fs.writeFile(`${path}/backend/index.js`,readFile);
|
|
286
|
-
|
|
312
|
+
spinner1.success({text:"redis setup is done enjoy!"});
|
|
287
313
|
|
|
288
314
|
}catch(err){
|
|
289
315
|
console.log("ioredis is not install for some reason");
|