@captainulfur/server-cli 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/cli.js +63 -0
  2. package/package.json +4 -1
package/cli.js ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "fs";
4
+ import path from "path";
5
+
6
+ const projectName = process.argv[2];
7
+
8
+ if (!projectName) {
9
+ console.log("❌ Please provide project name");
10
+ process.exit(1);
11
+ }
12
+
13
+ const projectPath = path.join(process.cwd(), projectName);
14
+
15
+ fs.mkdirSync(projectPath);
16
+
17
+ // package.json داخل پروژه جدید
18
+ const pkg = {
19
+ name: projectName,
20
+ version: "1.0.0",
21
+ type: "module",
22
+ scripts: {
23
+ start: "node server.js",
24
+ dev: "nodemon server.js"
25
+ },
26
+ dependencies: {
27
+ express: "^5.2.1",
28
+ mongoose: "^9.4.1",
29
+ dotenv: "^17.4.1",
30
+ cryptjs: "^3.0.3",
31
+ cors: "^2.8.6",
32
+ jsonwebtoken: "^9.0.3",
33
+ morgan: "^1.10.1",
34
+ multer: "^2.1.1",
35
+ nodemon: "^3.1.14"
36
+ }
37
+ };
38
+
39
+ fs.writeFileSync(
40
+ path.join(projectPath, "package.json"),
41
+ JSON.stringify(pkg, null, 2)
42
+ );
43
+
44
+ // server file
45
+ fs.writeFileSync(
46
+ path.join(projectPath, "server.js"),
47
+ `
48
+ import express from "express";
49
+
50
+ const app = express();
51
+ const PORT = 3000;
52
+
53
+ app.get("/", (req, res) => {
54
+ res.send("API running 🚀");
55
+ });
56
+
57
+ app.listen(PORT, () => {
58
+ console.log("Server running on port " + PORT);
59
+ });
60
+ `
61
+ );
62
+
63
+ console.log("✅ Project created at:", projectPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@captainulfur/server-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "server.js",
6
6
  "scripts": {
@@ -24,6 +24,9 @@
24
24
  "author": "",
25
25
  "license": "MIT",
26
26
  "type": "module",
27
+ "bin": {
28
+ "server-cli": "./cli.js"
29
+ },
27
30
  "dependencies": {
28
31
  "bcryptjs": "^3.0.3",
29
32
  "cors": "^2.8.6",