File size: 1,977 Bytes
08181d8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | Copy-Item -Path "..\contoh\frontend\public\*" -Destination "public\" -Recurse -Force
Copy-Item -Path "..\contoh\frontend\app\components\ui" -Destination "components\" -Recurse -Force
Copy-Item -Path "..\contoh\frontend\app\components\myComponents" -Destination "components\" -Recurse -Force
Copy-Item -Path "..\contoh\frontend\app\landing.css" -Destination "app\landing.css" -Force
New-Item -Path "components\articles" -ItemType Directory -Force
Copy-Item -Path "..\contoh\frontend\app\routes\landing\articles\ArticlePost.tsx" -Destination "components\articles\ArticlePost.tsx" -Force
Copy-Item -Path "..\contoh\frontend\app\routes\landing\home.tsx" -Destination "app\page.tsx" -Force
# Replace ~/ with @/ in page.tsx
(Get-Content "app\page.tsx") -replace '~/', '@/' -replace 'react-router', 'next/link' -replace 'import type { Route } from ''\.\./landing/\+types/home'';', '' -replace 'export function meta.*\}', '' -replace 'import { ScrollSmoother } from ''gsap/ScrollSmoother'';', '' -replace 'import \.\./\.\./landing\.css'';', 'import ''./landing.css'';' -replace 'import ArticlePost.*', 'import ArticlePost, { mockArticlesData } from ''@/components/articles/ArticlePost'';' | Set-Content "app\page.tsx"
# Also remove ScrollSmoother instances in page.tsx
(Get-Content "app\page.tsx") -replace 'const smoother = ScrollSmoother\.create\(\{[\s\S]*?\}\);', '' -replace 'scroller: smoothWrapperRef.current,', '' | Set-Content "app\page.tsx"
# Add "use client" to page.tsx
"use client";
" + (Get-Content "app\page.tsx" | Out-String) | Set-Content "app\page.tsx"
# Fix imports in copied components
Get-ChildItem -Path "components" -Recurse -Filter "*.tsx" | ForEach-Object {
(Get-Content .FullName) -replace '~/', '@/' -replace 'react-router', 'next/link' | Set-Content .FullName
}
Get-ChildItem -Path "components" -Recurse -Filter "*.ts" | ForEach-Object {
(Get-Content .FullName) -replace '~/', '@/' -replace 'react-router', 'next/link' | Set-Content .FullName
}
|