@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.
- package/cli.js +18 -20
- 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(
|
|
75
|
+
console.log("š ļø Injecting Marvinel Template files...");
|
|
76
76
|
|
|
77
|
-
const
|
|
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
|
-
|
|
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).
|
|
88
|
-
fs.copyFileSync(fromPath, toPath);
|
|
89
|
-
} else {
|
|
88
|
+
if (fs.lstatSync(fromPath).isDirectory()) {
|
|
90
89
|
// Recursive call for subdirectories
|
|
91
|
-
|
|
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
|
|
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
|
-
//
|
|
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
|
-
|
|
107
|
-
console.log("ā
Root configuration
|
|
104
|
+
mergeFolderSync(rootTemplateDir, projectPath);
|
|
105
|
+
console.log("ā
Root configuration merged.");
|
|
108
106
|
}
|
|
109
107
|
|
|
110
|
-
// 2. Copy
|
|
108
|
+
// 2. Copy CONTENTS of src-files to project/src (e.g., middleware.ts)
|
|
111
109
|
if (fs.existsSync(srcTemplateDir)) {
|
|
112
|
-
|
|
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(
|