@titas_mallick/wedding-site-gen 1.0.9 → 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.
- package/cli.mjs +23 -6
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -209,16 +209,33 @@ NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET=wedding
|
|
|
209
209
|
// Handle folder renaming for titas/sukanya
|
|
210
210
|
const appDir = path.join(absoluteTargetDir, 'app');
|
|
211
211
|
|
|
212
|
-
const
|
|
213
|
-
|
|
212
|
+
const groomFolderName = config.groomName.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
213
|
+
let brideFolderName = config.brideName.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
// Avoid collision if names are identical
|
|
216
|
+
if (groomFolderName === brideFolderName) {
|
|
217
|
+
brideFolderName = brideFolderName + "_partner";
|
|
217
218
|
}
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
|
|
220
|
+
const groomDir = path.join(appDir, groomFolderName);
|
|
221
|
+
const brideDir = path.join(appDir, brideFolderName);
|
|
222
|
+
|
|
223
|
+
// Helper for robust rename (Windows fix)
|
|
224
|
+
async function safeRename(oldPath, newPath) {
|
|
225
|
+
if (await fs.stat(oldPath).catch(() => null)) {
|
|
226
|
+
// Check if destination exists
|
|
227
|
+
if (await fs.stat(newPath).catch(() => null)) {
|
|
228
|
+
await fs.rm(newPath, { recursive: true, force: true });
|
|
229
|
+
}
|
|
230
|
+
// Small delay to let OS release handles
|
|
231
|
+
await new Promise(r => setTimeout(r, 100));
|
|
232
|
+
await fs.rename(oldPath, newPath);
|
|
233
|
+
}
|
|
220
234
|
}
|
|
221
235
|
|
|
236
|
+
await safeRename(path.join(appDir, 'titas'), groomDir);
|
|
237
|
+
await safeRename(path.join(appDir, 'sukanya'), brideDir);
|
|
238
|
+
|
|
222
239
|
console.log(`\nSuccess! Your wedding website is ready in ${targetDir}.`);
|
|
223
240
|
console.log("\nNext steps:");
|
|
224
241
|
console.log(`1. cd ${targetDir}`);
|