@thebros/create-benjamin 1.0.15 ā 1.0.17
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/bin/index.js +9 -50
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -11,13 +11,14 @@ async function cloneRepo(repo, target) {
|
|
|
11
11
|
const emitter = degit(repo, {
|
|
12
12
|
cache: false,
|
|
13
13
|
force: true,
|
|
14
|
+
verbose: true,
|
|
14
15
|
});
|
|
15
16
|
|
|
16
17
|
await emitter.clone(target);
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
async function main() {
|
|
20
|
-
console.log(chalk.cyan("\nš Benjamin
|
|
21
|
+
console.log(chalk.cyan("\nš Benjamin CLI Generator\n"));
|
|
21
22
|
|
|
22
23
|
const answers = await inquirer.prompt([
|
|
23
24
|
{
|
|
@@ -26,16 +27,6 @@ async function main() {
|
|
|
26
27
|
message: "Project name:",
|
|
27
28
|
default: "my-app",
|
|
28
29
|
},
|
|
29
|
-
{
|
|
30
|
-
type: "list",
|
|
31
|
-
name: "type",
|
|
32
|
-
message: "Project type:",
|
|
33
|
-
choices: [
|
|
34
|
-
"Full Stack (React + Node)",
|
|
35
|
-
"Frontend (React)",
|
|
36
|
-
"Backend (Express)",
|
|
37
|
-
],
|
|
38
|
-
},
|
|
39
30
|
]);
|
|
40
31
|
|
|
41
32
|
const root = path.join(process.cwd(), answers.projectName);
|
|
@@ -47,53 +38,21 @@ async function main() {
|
|
|
47
38
|
|
|
48
39
|
await fs.mkdir(root);
|
|
49
40
|
|
|
50
|
-
const spinner = ora("
|
|
41
|
+
const spinner = ora("Cloning backend template...").start();
|
|
51
42
|
|
|
52
|
-
//
|
|
53
|
-
// FRONTEND
|
|
54
|
-
// =========================
|
|
43
|
+
// ā
YOUR REPO FIXED HERE
|
|
55
44
|
await cloneRepo(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
await cloneRepo(
|
|
61
|
-
"your-github-username/benjamin-templates/backend-express",
|
|
62
|
-
path.join(root, "backend")
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
// =========================
|
|
66
|
-
// BACKEND
|
|
67
|
-
// =========================
|
|
68
|
-
if (
|
|
69
|
-
answers.type.includes("Backend") ||
|
|
70
|
-
answers.type.includes("Full")
|
|
71
|
-
) {
|
|
72
|
-
await cloneRepo("expressjs/express", path.join(root, "backend"));
|
|
73
|
-
|
|
74
|
-
await fs.writeFile(
|
|
75
|
-
path.join(root, "backend", "server.js"),
|
|
76
|
-
`
|
|
77
|
-
const express = require("express");
|
|
78
|
-
const app = express();
|
|
79
|
-
|
|
80
|
-
app.get("/", (req, res) => {
|
|
81
|
-
res.json({ message: "API Running" });
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
app.listen(5000, () => {
|
|
85
|
-
console.log("Server running on 5000");
|
|
86
|
-
});
|
|
87
|
-
`
|
|
88
|
-
);
|
|
89
|
-
}
|
|
45
|
+
"github:Benjamin-bit1/inventory-backend#main",
|
|
46
|
+
path.join(root, "backend")
|
|
47
|
+
);
|
|
90
48
|
|
|
91
|
-
spinner.succeed("
|
|
49
|
+
spinner.succeed("Backend cloned successfully");
|
|
92
50
|
|
|
93
51
|
console.log(chalk.green("\nā
Done!\n"));
|
|
94
52
|
|
|
95
53
|
console.log(`
|
|
96
54
|
cd ${answers.projectName}
|
|
55
|
+
cd backend
|
|
97
56
|
npm install
|
|
98
57
|
npm run dev
|
|
99
58
|
`);
|