create-aynal-fullstack 1.0.0
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 +8 -0
- package/bin/index.js +63 -0
- package/data.json +4 -0
- package/log.txt +2 -0
- package/output.txt +1 -0
- package/package.json +19 -0
package/README.md
ADDED
package/bin/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { execSync } = require("child_process");
|
|
6
|
+
|
|
7
|
+
const projectName = process.argv[2];
|
|
8
|
+
|
|
9
|
+
if (!projectName) {
|
|
10
|
+
console.log("❌ Project name required");
|
|
11
|
+
console.log("Usage: create-fullstack-app my-project");
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const root = path.join(process.cwd(), projectName);
|
|
16
|
+
const backend = path.join(root, "backend");
|
|
17
|
+
const frontend = path.join(root, "frontend");
|
|
18
|
+
|
|
19
|
+
const mkdir = (p) => !fs.existsSync(p) && fs.mkdirSync(p, { recursive: true });
|
|
20
|
+
const write = (p, c) => fs.writeFileSync(p, c);
|
|
21
|
+
|
|
22
|
+
console.log("🚀 Generating Fullstack App...");
|
|
23
|
+
|
|
24
|
+
mkdir(root);
|
|
25
|
+
mkdir(backend);
|
|
26
|
+
|
|
27
|
+
// Backend
|
|
28
|
+
process.chdir(backend);
|
|
29
|
+
execSync("npm init -y", { stdio: "inherit" });
|
|
30
|
+
execSync("npm install express cors dotenv", { stdio: "inherit" });
|
|
31
|
+
|
|
32
|
+
mkdir("src");
|
|
33
|
+
|
|
34
|
+
write(
|
|
35
|
+
"src/app.js",
|
|
36
|
+
`const express = require("express");
|
|
37
|
+
const app = express();
|
|
38
|
+
app.use(express.json());
|
|
39
|
+
app.get("/", (_, res) => res.send("Backend running 🚀"));
|
|
40
|
+
module.exports = app;
|
|
41
|
+
`
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
write(
|
|
45
|
+
"src/server.js",
|
|
46
|
+
`require("dotenv").config();
|
|
47
|
+
const app = require("./app");
|
|
48
|
+
app.listen(5000, () => console.log("Server on 5000"));
|
|
49
|
+
`
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
write(".env", "PORT=5000");
|
|
53
|
+
|
|
54
|
+
// Frontend
|
|
55
|
+
process.chdir(root);
|
|
56
|
+
execSync("npm create vite@latest frontend -- --template react", {
|
|
57
|
+
stdio: "inherit",
|
|
58
|
+
});
|
|
59
|
+
process.chdir(frontend);
|
|
60
|
+
execSync("npm install", { stdio: "inherit" });
|
|
61
|
+
|
|
62
|
+
console.log("✅ Done!");
|
|
63
|
+
console.log(`👉 cd ${projectName}`);
|
package/data.json
ADDED
package/log.txt
ADDED
package/output.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Hello, World!
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-aynal-fullstack",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI to generate Node.js + React (Vite) fullstack projects",
|
|
5
|
+
"bin": {
|
|
6
|
+
"create-aynal-fullstack": "bin/index.js"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"cli",
|
|
10
|
+
"mern",
|
|
11
|
+
"vite",
|
|
12
|
+
"react"
|
|
13
|
+
],
|
|
14
|
+
"author": "Md. Aynal Haque",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
}
|
|
19
|
+
}
|