-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbin.js
More file actions
74 lines (63 loc) · 2.45 KB
/
bin.js
File metadata and controls
74 lines (63 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env node
const process = require('process');
const fs = require('fs');
const inquirer = require('inquirer');
const cli_color = require('cli-color');
const child = require('child_process');
const prompt = require('prompt-sync')();
console.log(
cli_color.cyanBright.bold(
`\nHeyy, I am Frontify 💥💥. I'm here to deliver you your Bioler Plate.`
)
);
inquirer.prompt([
{
type: "list",
name: 'choice',
choices: ["create-react-app", "vite"]
}
]).then((result) => {
if (result.choice == "create-react-app") {
const name = prompt(`Whats your Application Name ?`);
console.log(`Creating ${name}....`);
child.execSync(`npx create-react-app ${name}`, { stdio: [] });
fs.unlinkSync(`${process.cwd()}/${name}/src/reportWebVitals.js`);
fs.unlinkSync(`${process.cwd()}/${name}/src/setupTests.js`);
fs.unlinkSync(`${process.cwd()}/${name}/src/App.test.js`);
fs.unlinkSync(`${process.cwd()}/${name}/public/favicon.ico`);
fs.unlinkSync(`${process.cwd()}/${name}/public/logo192.png`);
fs.unlinkSync(`${process.cwd()}/${name}/public/logo512.png`);
fs.mkdirSync(`${process.cwd()}/${name}/src/components`);
fs.mkdirSync(`${process.cwd()}/${name}/src/assets`);
fs.mkdirSync(`${process.cwd()}/${name}/src/pages`);
console.log(
cli_color.greenBright(
"Folders are created and files are deleted... \n Happy Coding ✨"
)
);
}else if(result.choice == "vite"){
const name = prompt(`Whats your Application Name ? `);
inquirer.prompt([
{
type: "list",
name: 'choice',
choices: ["Vanilla", "Vue", "React", "Preact", "Lit", "Svelte", "Solid", "Qwick"]
}
]).then((data)=>{
var template = data.choice.toLowerCase();
console.log(`Creating ${name}....`);
child.execSync(`npm create vite@latest ${name} -- --template ${template}`, { stdio: [] });
fs.mkdirSync(`${process.cwd()}/${name}/src/components`);
fs.mkdirSync(`${process.cwd()}/${name}/src/pages`);
console.log(
cli_color.greenBright(
"Folders are created... \n Happy Coding ✨"
)
);
}).catch((err) => {
console.log(err);
});
}
}).catch((err) => {
console.log(err);
});