create-charcole 1.0.0 → 1.1.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.
Files changed (2) hide show
  1. package/bin/index.js +36 -10
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -1,7 +1,8 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const fs = require("fs");
4
4
  const path = require("path");
5
+ const { execSync } = require("child_process");
5
6
 
6
7
  const projectName = process.argv[2];
7
8
 
@@ -22,11 +23,9 @@ if (fs.existsSync(targetDir)) {
22
23
 
23
24
  function copyDir(src, dest) {
24
25
  fs.mkdirSync(dest, { recursive: true });
25
-
26
26
  for (const file of fs.readdirSync(src)) {
27
27
  const srcPath = path.join(src, file);
28
28
  const destPath = path.join(dest, file);
29
-
30
29
  if (fs.statSync(srcPath).isDirectory()) {
31
30
  copyDir(srcPath, destPath);
32
31
  } else {
@@ -35,9 +34,24 @@ function copyDir(src, dest) {
35
34
  }
36
35
  }
37
36
 
37
+ function detectPackageManager() {
38
+ try {
39
+ execSync("bun -v", { stdio: "ignore" });
40
+ return "bun";
41
+ } catch {}
42
+ try {
43
+ execSync("pnpm -v", { stdio: "ignore" });
44
+ return "pnpm";
45
+ } catch {}
46
+ try {
47
+ execSync("yarn -v", { stdio: "ignore" });
48
+ return "yarn";
49
+ } catch {}
50
+ return "npm";
51
+ }
52
+
38
53
  try {
39
54
  console.log("šŸ”„ Creating Charcole app...");
40
-
41
55
  copyDir(templateDir, targetDir);
42
56
 
43
57
  const pkgPath = path.join(targetDir, "package.json");
@@ -47,14 +61,26 @@ try {
47
61
  fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
48
62
  }
49
63
 
50
- console.log("āœ… Charcole app created successfully!");
51
- console.log("");
52
- console.log("Next steps:");
64
+ console.log("āœ… Project created successfully!");
65
+
66
+ const pkgManager = detectPackageManager();
67
+ console.log(`šŸ“¦ Installing dependencies using ${pkgManager}...`);
68
+
69
+ const installCmd =
70
+ pkgManager === "bun"
71
+ ? "bun install"
72
+ : pkgManager === "yarn"
73
+ ? "yarn"
74
+ : pkgManager === "pnpm"
75
+ ? "pnpm install"
76
+ : "npm install";
77
+
78
+ execSync(installCmd, { cwd: targetDir, stdio: "inherit" });
79
+
80
+ console.log("\nšŸš€ All set!");
53
81
  console.log(` cd ${projectName}`);
54
- console.log(" npm install");
55
82
  console.log(" npm run dev");
56
- console.log("");
57
- console.log("🧱 Built with Charcole — Express, but engineered.");
83
+ console.log("\n🧱 Built with Charcole — Express, but engineered.");
58
84
  } catch (err) {
59
85
  console.error("āŒ Failed to create Charcole app.");
60
86
  console.error(err.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-charcole",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Production-ready Express backend starter with engineering guardrails.",
5
5
  "license": "MIT",
6
6
  "author": {