@titas_mallick/wedding-site-gen 1.0.8 → 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 +61 -6
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -35,6 +35,34 @@ async function main() {
|
|
|
35
35
|
config.siteUrl = await question("Website URL (e.g., https://ourwedding.com): ") || "https://ourwedding.com";
|
|
36
36
|
config.hashtag = await question("Wedding Hashtag (e.g., #TitasWedsSukanya): ") || `#${config.groomName}Weds${config.brideName}`;
|
|
37
37
|
|
|
38
|
+
console.log("\nChoose a Visual Theme:");
|
|
39
|
+
console.log("1. Classic Pink & Gold (Traditional & Romantic)");
|
|
40
|
+
console.log("2. Royal Blue & Gold (Elegant & Regal)");
|
|
41
|
+
console.log("3. Forest Green & Cream (Nature-inspired & Modern)");
|
|
42
|
+
console.log("4. Deep Red & Champagne (Passionate & Classic)");
|
|
43
|
+
|
|
44
|
+
const themeChoice = await question("Select Theme (1-4) [default: 1]: ") || "1";
|
|
45
|
+
|
|
46
|
+
const themes = {
|
|
47
|
+
"1": { // Pink & Gold
|
|
48
|
+
pink500: "#ec4899",
|
|
49
|
+
gold400: "#d99e43",
|
|
50
|
+
},
|
|
51
|
+
"2": { // Royal Blue & Gold
|
|
52
|
+
pink500: "#1e40af", // Replacing pink with blue
|
|
53
|
+
gold400: "#fbbf24",
|
|
54
|
+
},
|
|
55
|
+
"3": { // Forest Green & Cream
|
|
56
|
+
pink500: "#065f46", // Replacing pink with green
|
|
57
|
+
gold400: "#92400e", // More earthy gold
|
|
58
|
+
},
|
|
59
|
+
"4": { // Deep Red & Champagne
|
|
60
|
+
pink500: "#991b1b", // Replacing pink with red
|
|
61
|
+
gold400: "#d4af37",
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const selectedTheme = themes[themeChoice] || themes["1"];
|
|
38
66
|
const targetDir = await question("Target directory name: ") || "my-wedding-website";
|
|
39
67
|
|
|
40
68
|
rl.close();
|
|
@@ -127,6 +155,16 @@ export default adminCred;
|
|
|
127
155
|
content = JSON.stringify(pkg, null, 2);
|
|
128
156
|
}
|
|
129
157
|
|
|
158
|
+
if (entry.name === 'tailwind.config.js') {
|
|
159
|
+
// Replace the primary colors in the tailwind config
|
|
160
|
+
content = content.replace(/pink:\s*{\s*[^}]*500:\s*'#[a-fA-F0-9]{6}'/g, (match) => {
|
|
161
|
+
return match.replace(/'#[a-fA-F0-9]{6}'/, `'${selectedTheme.pink500}'`);
|
|
162
|
+
});
|
|
163
|
+
content = content.replace(/gold:\s*{\s*[^}]*400:\s*'#[a-fA-F0-9]{6}'/g, (match) => {
|
|
164
|
+
return match.replace(/'#[a-fA-F0-9]{6}'/, `'${selectedTheme.gold400}'`);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
130
168
|
await fs.writeFile(destPath, content, 'utf8');
|
|
131
169
|
} else {
|
|
132
170
|
await fs.copyFile(srcPath, destPath);
|
|
@@ -171,16 +209,33 @@ NEXT_PUBLIC_CLOUDINARY_UPLOAD_PRESET=wedding
|
|
|
171
209
|
// Handle folder renaming for titas/sukanya
|
|
172
210
|
const appDir = path.join(absoluteTargetDir, 'app');
|
|
173
211
|
|
|
174
|
-
const
|
|
175
|
-
|
|
212
|
+
const groomFolderName = config.groomName.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
213
|
+
let brideFolderName = config.brideName.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
176
214
|
|
|
177
|
-
|
|
178
|
-
|
|
215
|
+
// Avoid collision if names are identical
|
|
216
|
+
if (groomFolderName === brideFolderName) {
|
|
217
|
+
brideFolderName = brideFolderName + "_partner";
|
|
179
218
|
}
|
|
180
|
-
|
|
181
|
-
|
|
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
|
+
}
|
|
182
234
|
}
|
|
183
235
|
|
|
236
|
+
await safeRename(path.join(appDir, 'titas'), groomDir);
|
|
237
|
+
await safeRename(path.join(appDir, 'sukanya'), brideDir);
|
|
238
|
+
|
|
184
239
|
console.log(`\nSuccess! Your wedding website is ready in ${targetDir}.`);
|
|
185
240
|
console.log("\nNext steps:");
|
|
186
241
|
console.log(`1. cd ${targetDir}`);
|