@usercli/clideveloper 2.0.4 → 2.1.5

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.
@@ -180,6 +180,13 @@ app.listen(7000,()=> console.log("Server is on and running on port 7000"))
180
180
 
181
181
  spinner2.success({text:"Prisma setup done enjoy!"});
182
182
 
183
+ let spinner3=createSpinner("Prisma client is installing...").start();
184
+
185
+ // install @prisma/client
186
+ await execPromise("npm install @prisma/client",{cwd:`${path}/backend`});
187
+
188
+ spinner3.success({text:"Prisma client install successfully!"});
189
+
183
190
  console.log("Prisma installed completely with prisma setup");
184
191
  }
185
192
 
@@ -1,90 +1,99 @@
1
- const {exec}=require("child_process");
2
- const util=require("util");
1
+ const { exec } = require("child_process");
2
+ const util = require("util");
3
3
  const { createSpinner } = require("nanospinner");
4
4
  const path = require("path");
5
- const inquire=require("inquirer").default;
5
+ const inquire = require("inquirer").default;
6
+ const fs = require("fs").promises;
6
7
 
7
- let execPromise=util.promisify(exec);
8
+ let execPromise = util.promisify(exec);
8
9
 
9
- async function commonNextReactSetup(userPath,setupName){
10
- try{
11
-
12
- let userInstallPath=path.join(process.cwd(),userPath);
10
+ async function commonNextReactSetup(userPath, setupName) {
11
+ try {
12
+ const frontendPath = path.join(process.cwd(), userPath, "frontend");
13
13
 
14
- switch(setupName){
14
+ await fs.mkdir(frontendPath, { recursive: true });
15
15
 
16
+ switch (setupName) {
16
17
  // next js installing process
17
18
  case "nextjs":
18
-
19
- let jsTsChoice=await inquire.prompt([
19
+ let jsTsChoice = await inquire.prompt([
20
20
  {
21
- name:"jsTs",
22
- type:"input",
23
- message:"You want to use typescript then write y or if you want to use normal js write n?",
24
- validate:(check)=>{
25
- if(check.trim()=="y" || check.trim()=="n"){
21
+ name: "jsTs",
22
+ type: "input",
23
+ message: "You want to use typescript then write y or if you want to use normal js write n?",
24
+ validate: (check) => {
25
+ if (check.trim() == "y" || check.trim() == "n") {
26
26
  return true;
27
27
  }
28
-
29
28
  return "Write y or n in small";
30
29
  }
31
30
  }
32
- ])
33
-
31
+ ]);
34
32
 
35
- let spinner=createSpinner("Installing Next.js… greatness takes a moment 🚀").start();
33
+ let spinner = createSpinner("Installing Next.js… greatness takes a moment 🚀").start();
36
34
 
37
- await execPromise(`npx create-next-app@latest . ${(jsTsChoice.jsTs=="y")?"--typescript":"--javascript"} --tailwind --app --no-eslint --import-alias "@/*" --yes --no-git`,{cwd:userInstallPath, shell: true});
38
-
39
- spinner.success({text:"Successfully installed next js enjoy coding!"});
35
+
36
+ await execPromise(
37
+ `npx create-next-app@latest . ${(jsTsChoice.jsTs == "y") ? "--typescript" : "--javascript"} --tailwind --app --no-eslint --import-alias "@/*" --yes --no-git`,
38
+ {
39
+ cwd: frontendPath,
40
+ shell: true,
41
+ windowsHide: true
42
+ }
43
+ );
40
44
 
45
+ spinner.success({ text: "Successfully installed next js enjoy coding!" });
41
46
  break;
42
47
 
43
-
44
-
45
48
  // react js installing process
46
49
  case "reactjs":
47
- let tsjs=await inquire.prompt([
50
+ let tsjs = await inquire.prompt([
48
51
  {
49
- name:"jsts",
50
- type:"input",
51
- message:"If you want to install react with typescript write y and if you want to install react with normal js write n?",
52
- validate:(check)=>{
53
- if(check.trim()=="y" || check.trim()=="n"){
52
+ name: "jsts",
53
+ type: "input",
54
+ message: "If you want to install react with typescript write y and if you want to install react with normal js write n?",
55
+ validate: (check) => {
56
+ if (check.trim() == "y" || check.trim() == "n") {
54
57
  return true;
55
58
  }
56
59
  return "Only write y or n in small";
57
60
  }
58
61
  },
59
62
  {
60
- name:"backend",
61
- type:"input",
62
- message:"You want backend type y otherwise n?",
63
- validate:(check)=>{
64
- if(check.trim()=="y" || check.trim()=="n"){
63
+ name: "backend",
64
+ type: "input",
65
+ message: "You want backend type y otherwise n?",
66
+ validate: (check) => {
67
+ if (check.trim() == "y" || check.trim() == "n") {
65
68
  return true;
66
69
  }
67
-
68
70
  return "Write y and n in small no other options are available";
69
71
  }
70
72
  }
71
- ])
73
+ ]);
72
74
 
73
- let spinner1=createSpinner("Downloading React… grabbing virtual DOM snacks 🍪").start();
75
+ let spinner1 = createSpinner("Downloading React… grabbing virtual DOM snacks 🍪").start();
74
76
 
75
- await execPromise(`npm create vite@latest . --template ${(tsjs=="y")?"react-ts":"react"} --yes`,{cwd:userInstallPath,shell:true})
76
-
77
- spinner1.success({text:"Successfully install react enjoy!"});
77
+
78
+ await execPromise(
79
+ `npm create vite@latest . --template ${(tsjs.jsts == "y") ? "react-ts" : "react"} --yes`,
80
+ {
81
+ cwd: frontendPath,
82
+ shell: true,
83
+ windowsHide: true
84
+ }
85
+ );
78
86
 
87
+ spinner1.success({ text: "Successfully install react enjoy!" });
79
88
  break;
80
89
 
81
90
  default:
82
91
  console.log("There no this type option are available");
83
-
84
92
  }
85
- }catch(err){
86
- console.log(err);
93
+ } catch (err) {
94
+ console.error("Error in setup:", err);
95
+ throw err;
87
96
  }
88
97
  }
89
98
 
90
- module.exports={commonNextReactSetup};
99
+ module.exports = { commonNextReactSetup };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usercli/clideveloper",
3
- "version": "2.0.4",
3
+ "version": "2.1.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {