@usercli/clideveloper 1.0.7 β 1.0.9
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 +7 -4
- package/components/nextjsReactjsSetup.js +73 -0
- package/index.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<h1><strong>π‘ Quick Install (Recommended):</strong></h1>
|
|
5
5
|
|
|
6
6
|
<pre>
|
|
7
|
-
<code>npx
|
|
7
|
+
<code>npx @usercli/clideveloper@latest</code>
|
|
8
8
|
</pre>
|
|
9
9
|
|
|
10
10
|
This npm package is designed to make the **developer installation and setup process easy and automatic**.
|
|
@@ -16,8 +16,11 @@ Think of it as your **personal npm butler** π΄οΈ, setting up your tools while
|
|
|
16
16
|
|
|
17
17
|
## π§ Current Status
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
. β
Backend frameworks fully supported
|
|
20
|
+
|
|
21
|
+
. β
React.js and Next.js installation is now available
|
|
22
|
+
|
|
23
|
+
. β οΈ Other frontend frameworks will be added in future updates
|
|
21
24
|
|
|
22
25
|
---
|
|
23
26
|
|
|
@@ -53,4 +56,4 @@ This package helps developers quickly bootstrap backend tools **without manual c
|
|
|
53
56
|
## π¦ Installation
|
|
54
57
|
|
|
55
58
|
```bash
|
|
56
|
-
npx
|
|
59
|
+
npx @usercli/clideveloper@latest
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const {exec}=require("child_process");
|
|
2
|
+
const util=require("util");
|
|
3
|
+
const { createSpinner } = require("nanospinner");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const inquire=require("inquirer").default;
|
|
6
|
+
|
|
7
|
+
let execPromise=util.promisify(exec);
|
|
8
|
+
|
|
9
|
+
async function commonNextReactSetup(userPath,setupName){
|
|
10
|
+
try{
|
|
11
|
+
|
|
12
|
+
let userInstallPath=path.join(process.cwd(),userPath);
|
|
13
|
+
|
|
14
|
+
switch(setupName){
|
|
15
|
+
case "nextjs":
|
|
16
|
+
|
|
17
|
+
let jsTsChoice=await inquire.prompt([
|
|
18
|
+
{
|
|
19
|
+
name:"jsTs",
|
|
20
|
+
type:"input",
|
|
21
|
+
message:"You want to use typescript then write y or if you want to use normal js write n?",
|
|
22
|
+
validate:(check)=>{
|
|
23
|
+
if(check.trim()=="y" || check.trim()=="n"){
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return "Write y or n in small";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
])
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
let spinner=createSpinner("Installing Next.jsβ¦ greatness takes a moment π").start();
|
|
34
|
+
|
|
35
|
+
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});
|
|
36
|
+
|
|
37
|
+
spinner.success({text:"Successfully installed next js enjoy coding!"});
|
|
38
|
+
|
|
39
|
+
break;
|
|
40
|
+
|
|
41
|
+
case "reactjs":
|
|
42
|
+
let tsjs=await inquire.prompt([
|
|
43
|
+
{
|
|
44
|
+
name:"jsts",
|
|
45
|
+
type:"input",
|
|
46
|
+
message:"If you want to install react with typescript write y and if you want to install react with normal js write n?",
|
|
47
|
+
validate:(check)=>{
|
|
48
|
+
if(check.trim()=="y" || check.trim()=="n"){
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return "Only write y or n in small";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
])
|
|
55
|
+
|
|
56
|
+
let spinner1=createSpinner("Downloading Reactβ¦ grabbing virtual DOM snacks πͺ").start();
|
|
57
|
+
|
|
58
|
+
await execPromise(`npm create vite@latest . --template ${(tsjs=="y")?"react-ts":"react"} --yes`,{cwd:userInstallPath,shell:true})
|
|
59
|
+
|
|
60
|
+
spinner1.success({text:"Successfully install react enjoy!"});
|
|
61
|
+
|
|
62
|
+
break;
|
|
63
|
+
|
|
64
|
+
default:
|
|
65
|
+
console.log("There no this type option are available");
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
}catch(err){
|
|
69
|
+
console.log(err);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports={commonNextReactSetup};
|
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ let {createFoldder}=require("./components/folderCreate");
|
|
|
7
7
|
let {nodejs}=require("./components/nodejs");
|
|
8
8
|
const {heading} =require("./components/welcomeHeading");
|
|
9
9
|
const {createNestJs}=require("./components/nestjs");
|
|
10
|
+
const {commonNextReactSetup}=require("./components/nextjsReactjsSetup");
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
async function main() {
|
|
@@ -34,9 +35,9 @@ async function main() {
|
|
|
34
35
|
}else if(answer.framework=="nestjs"){
|
|
35
36
|
await createNestJs(answer.folderName)
|
|
36
37
|
}else if(answer.framework=="reactjs"){
|
|
37
|
-
|
|
38
|
+
await commonNextReactSetup(answer.folderName,"reactjs");
|
|
38
39
|
}else if(answer.framework=="nextjs"){
|
|
39
|
-
|
|
40
|
+
await commonNextReactSetup(answer.folderName,"nextjs");
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
}
|