@marvs13/marvinel-nextjs-supabase-starting-kit 1.0.12 → 1.0.14

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 +18 -20
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -72,48 +72,46 @@ try {
72
72
  });
73
73
 
74
74
  // 5. Copy Template Files
75
- console.log(`šŸ“‚ Injecting Marvinel's Template files...`);
75
+ console.log("šŸ› ļø Injecting Marvinel Template files...");
76
76
 
77
- const copyFolderSync = (from, to) => {
77
+ const mergeFolderSync = (from, to) => {
78
+ // Ensure the destination folder exists
78
79
  if (!fs.existsSync(to)) fs.mkdirSync(to, { recursive: true });
79
80
 
80
- // Read the items INSIDE the folder
81
+ // Read the items INSIDE the folder (not the folder itself)
81
82
  const items = fs.readdirSync(from);
82
83
 
83
- items.forEach((item) => {
84
+ for (const item of items) {
84
85
  const fromPath = path.join(from, item);
85
86
  const toPath = path.join(to, item);
86
87
 
87
- if (fs.lstatSync(fromPath).isFile()) {
88
- fs.copyFileSync(fromPath, toPath);
89
- } else {
88
+ if (fs.lstatSync(fromPath).isDirectory()) {
90
89
  // Recursive call for subdirectories
91
- copyFolderSync(fromPath, toPath);
90
+ mergeFolderSync(fromPath, toPath);
91
+ } else {
92
+ // Direct file copy
93
+ fs.copyFileSync(fromPath, toPath);
92
94
  }
93
- });
95
+ }
94
96
  };
95
97
 
96
- // Define the Source (your CLI's template)
98
+ // Define your paths
97
99
  const rootTemplateDir = path.join(templatePath, "root-files");
98
100
  const srcTemplateDir = path.join(templatePath, "src-files");
99
101
 
100
- // Define the Destination (the user's new project)
101
- const rootDestination = projectPath;
102
- const srcDestination = path.join(projectPath, "src");
103
-
104
- // 1. Copy contents of root-files to project root
102
+ // 1. Copy CONTENTS of root-files to project root (e.g., .env.local.example)
105
103
  if (fs.existsSync(rootTemplateDir)) {
106
- copyFolderSync(rootTemplateDir, rootDestination);
107
- console.log("āœ… Root configuration files merged.");
104
+ mergeFolderSync(rootTemplateDir, projectPath);
105
+ console.log("āœ… Root configuration merged.");
108
106
  }
109
107
 
110
- // 2. Copy contents of src-files to project/src
108
+ // 2. Copy CONTENTS of src-files to project/src (e.g., middleware.ts)
111
109
  if (fs.existsSync(srcTemplateDir)) {
112
- copyFolderSync(srcTemplateDir, srcDestination);
110
+ mergeFolderSync(srcTemplateDir, path.join(projectPath, "src"));
113
111
  console.log("āœ… Source logic merged into /src.");
114
112
  }
115
113
 
116
- copyFolderSync(templatePath, path.join(projectPath, "src"));
114
+ // copyFolderSync(templatePath, path.join(projectPath, "src"));
117
115
 
118
116
  console.log(`\nāœ… Setup complete! Project is ready.`);
119
117
  console.log(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marvs13/marvinel-nextjs-supabase-starting-kit",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "A modern Next.js + Supabase starting kit with Tailwind, Zod, and shadcn/ui.",
5
5
  "main": "cli.js",
6
6
  "bin": {