Files
2026-09-05 12:31:25 +05:30

84 lines
3.4 KiB
JavaScript

const fs = require('fs');
const path = require('path');
const srcAppDir = path.join(__dirname, 'src', 'app');
const featuresDir = path.join(srcAppDir, '(features)');
if (!fs.existsSync(featuresDir)) {
fs.mkdirSync(featuresDir);
}
const foldersToMove = [
'Components',
'ContactPage',
'HomePage',
'Pricing',
'ProductPage',
'ResourcePage',
'SecurityPage',
'SolutionPage'
];
// Move folders to (features)
foldersToMove.forEach(folder => {
const oldPath = path.join(srcAppDir, folder);
const newPath = path.join(featuresDir, folder);
if (fs.existsSync(oldPath)) {
fs.renameSync(oldPath, newPath);
}
});
// Recreate proper lowercase routes
const routes = {
// Home
'page.tsx': `export { default } from "./(features)/HomePage/Index";`,
// Pricing
'pricing/page.tsx': `export { default } from "../(features)/Pricing/index";`,
// Contact
'contact/page.tsx': `export { default } from "../(features)/ContactPage/MainContactPage";`,
'contact-us/page.tsx': `export { default } from "../(features)/ContactPage/MainContactPage";`,
'demo/page.tsx': `export { default } from "../(features)/ContactPage/MainContactPage";`,
'book-a-demo/page.tsx': `export { default } from "../(features)/ContactPage/MainContactPage";`,
// Security
'security/page.tsx': `export { default } from "../(features)/SecurityPage/Index";`,
// Blog / Resources
'blog/page.tsx': `export { default } from "../(features)/ResourcePage/BlogPage";`,
'resources/page.tsx': `export { default } from "../(features)/ResourcePage/BlogPage";`,
'resources/blog/page.tsx': `export { default } from "../../(features)/ResourcePage/BlogPage";`,
'blog/[slug]/page.tsx': `export { default } from "../../(features)/ResourcePage/BlogDetailPage";`,
// Products
'product/platform/page.tsx': `export { default } from "../../(features)/ProductPage/AllProductsPage";`,
'product/drive/page.tsx': `export { default } from "../../(features)/ProductPage/DrivePage";`,
'product/pdf-editor/page.tsx': `export { default } from "../../(features)/ProductPage/PdfEditorPage";`,
'product/workflows/page.tsx': `export { default } from "../../(features)/ProductPage/WorkflowsPage";`,
'product/sign/page.tsx': `export { default } from "../../(features)/ProductPage/SignPage";`,
'product/free-pdf-tools/page.tsx': `export { default } from "../../(features)/ProductPage/AllPdfToolsPage";`,
'product/free-editor/page.tsx': `export { default } from "../../(features)/ProductPage/FreeEditorPages";`,
'product/embed/page.tsx': `export { default } from "../../(features)/ProductPage/EmbedPage";`,
// Solutions
'solutions/page.tsx': `export { default } from "../(features)/SolutionPage/AllSolutionsPage";`,
'solutions/enterprise/page.tsx': `export { default } from "../../(features)/SolutionPage/EnterPrisePage";`,
'solutions/legal/page.tsx': `export { default } from "../../(features)/SolutionPage/LegalPage";`,
'solutions/real-estate/page.tsx': `export { default } from "../../(features)/SolutionPage/RealEstatePage";`,
'solutions/operations/page.tsx': `export { default } from "../../(features)/SolutionPage/OperationsPage";`,
};
for (const [routePath, content] of Object.entries(routes)) {
const fullPath = path.join(srcAppDir, routePath);
const dir = path.dirname(fullPath);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
fs.writeFileSync(fullPath, content, 'utf8');
}
console.log('Restructuring completed.');