fpAI-komposin / fe /copy_script.ps1
orang-sukses
Initial commit: Upload seluruh project FE, BE, dan Model
08181d8
Raw
History Blame Contribute Delete
1.98 kB
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
}