Skip to content

Commit c6fac50

Browse files
committed
Cleaned up folders
1 parent 7fb671a commit c6fac50

31 files changed

Lines changed: 195 additions & 66 deletions

organize.ps1

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# This script organizes your Svelte project files and automatically updates import paths.
2+
# It is safe to run on a partially-organized project.
3+
4+
Write-Host "Starting complete project organization and path updates..." -ForegroundColor Green
5+
6+
$basePath = Resolve-Path "src/lib"
7+
8+
# --- Define the new structure and file moves ---
9+
# This list contains all components, including those already moved.
10+
$moves = @{
11+
# Layout Components
12+
"$basePath/components/Header.svelte" = "$basePath/components/layout/Header.svelte";
13+
"$basePath/components/Footer.svelte" = "$basePath/components/layout/Footer.svelte";
14+
"$basePath/components/Nav.svelte" = "$basePath/components/layout/Nav.svelte";
15+
"$basePath/components/ScrollToTop.svelte" = "$basePath/components/layout/ScrollToTop.svelte";
16+
17+
# UI Components
18+
"$basePath/components/GlitchText.svelte" = "$basePath/components/ui/GlitchText.svelte";
19+
"$basePath/components/Section.svelte" = "$basePath/components/ui/Section.svelte";
20+
"$basePath/components/CRTFilter.svelte" = "$basePath/components/ui/CRTFilter.svelte";
21+
"$basePath/components/CRTControl.svelte" = "$basePath/components/ui/CRTControl.svelte";
22+
"$basePath/components/Typewriter.svelte" = "$basePath/components/ui/Typewriter.svelte";
23+
"$basePath/components/Timeline.svelte" = "$basePath/components/ui/Timeline.svelte";
24+
"$basePath/components/ThemeSwitch.svelte" = "$basePath/components/ui/ThemeSwitch.svelte";
25+
"$basePath/components/ProjectCard.svelte" = "$basePath/components/ui/ProjectCard.svelte";
26+
"$basePath/components/SkillCard.svelte" = "$basePath/components/ui/SkillCard.svelte";
27+
"$basePath/components/SkillIcon.svelte" = "$basePath/components/ui/SkillIcon.svelte";
28+
"$basePath/components/BlinkingCursor.svelte" = "$basePath/components/ui/BlinkingCursor.svelte";
29+
"$basePath/components/Kirby.svelte" = "$basePath/components/ui/Kirby.svelte";
30+
31+
# Feature Components & Folders
32+
"$basePath/components/AboutSection.svelte" = "$basePath/components/features/AboutSection.svelte";
33+
"$basePath/components/SkillsSection.svelte" = "$basePath/components/features/SkillsSection.svelte";
34+
"$basePath/components/ProjectsSection.svelte" = "$basePath/components/features/ProjectsSection.svelte";
35+
"$basePath/components/ExperienceSection.svelte" = "$basePath/components/features/ExperienceSection.svelte";
36+
"$basePath/components/EducationSection.svelte" = "$basePath/components/features/EducationSection.svelte";
37+
"$basePath/components/terminal" = "$basePath/components/features/terminal";
38+
"$basePath/components/skills" = "$basePath/components/features/skills";
39+
40+
# Other Lib Files
41+
"$basePath/i18n.js" = "$basePath/utils/i18n.js";
42+
"$basePath/transitions/print.ts" = "$basePath/transitions/transitions.ts";
43+
}
44+
45+
# --- Create new directories ---
46+
$moves.Values | ForEach-Object {
47+
$dir = Split-Path $_ -Parent
48+
if (-not (Test-Path $dir)) {
49+
New-Item -ItemType Directory -Path $dir -Force | Out-Null
50+
Write-Host "Created directory: $dir"
51+
}
52+
}
53+
54+
# --- Move remaining files and folders ---
55+
Write-Host "Checking for files to move..."
56+
$moves.GetEnumerator() | ForEach-Object {
57+
# THE FIX: This `if` statement makes the script robust.
58+
# It checks if the file exists at the *original* source location before trying to move it.
59+
# If a file was already moved by the previous script, this check will fail and the script
60+
# will safely skip it without causing an error.
61+
if (Test-Path $_.Name) {
62+
Move-Item -Path $_.Name -Destination $_.Value -Force
63+
Write-Host "Moved: $($_.Name) -> $($_.Value)"
64+
}
65+
}
66+
67+
# --- Update import paths ---
68+
# This section will run over all files and fix any remaining incorrect import paths.
69+
Write-Host "Updating all import paths in project files..."
70+
$filesToUpdate = Get-ChildItem -Path "src" -Recurse -Include *.svelte, *.ts, *.js
71+
72+
# Define all possible path replacements, from old to new.
73+
$pathUpdates = @{
74+
# Layout
75+
"from '$lib/components/Header.svelte'" = "from '$lib/components/layout/Header.svelte'";
76+
"from '$lib/components/Footer.svelte'" = "from '$lib/components/layout/Footer.svelte'";
77+
"from '$lib/components/Nav.svelte'" = "from '$lib/components/layout/Nav.svelte'";
78+
"from '$lib/components/ScrollToTop.svelte'" = "from '$lib/components/layout/ScrollToTop.svelte'";
79+
# UI
80+
"from '$lib/components/GlitchText.svelte'" = "from '$lib/components/ui/GlitchText.svelte'";
81+
"from '../GlitchText.svelte'" = "from '$lib/components/ui/GlitchText.svelte'";
82+
"from '$lib/components/Section.svelte'" = "from '$lib/components/ui/Section.svelte'";
83+
"from '$lib/components/CRTFilter.svelte'" = "from '$lib/components/ui/CRTFilter.svelte'";
84+
"from '$lib/components/CRTControl.svelte'" = "from '$lib/components/ui/CRTControl.svelte'";
85+
"from '$lib/components/Typewriter.svelte'" = "from '$lib/components/ui/Typewriter.svelte'";
86+
"from '$lib/components/Timeline.svelte'" = "from '$lib/components/ui/Timeline.svelte'";
87+
"from '$lib/components/ThemeSwitch.svelte'" = "from '$lib/components/ui/ThemeSwitch.svelte'";
88+
"from '$lib/components/ProjectCard.svelte'" = "from '$lib/components/ui/ProjectCard.svelte'";
89+
"from '$lib/components/SkillCard.svelte'" = "from '$lib/components/ui/SkillCard.svelte'";
90+
"from '$lib/components/SkillIcon.svelte'" = "from '$lib/components/ui/SkillIcon.svelte'";
91+
"from '$lib/components/skills/SkillIcon.svelte'" = "from '$lib/components/ui/SkillIcon.svelte'";
92+
"from '$lib/components/BlinkingCursor.svelte'" = "from '$lib/components/ui/BlinkingCursor.svelte'";
93+
"from './BlinkingCursor.svelte'" = "from '$lib/components/ui/BlinkingCursor.svelte'";
94+
# Features
95+
"from '$lib/components/terminal/Terminal.svelte'" = "from '$lib/components/features/terminal/Terminal.svelte'";
96+
"from './BootSequence.svelte'" = "from '$lib/components/features/terminal/BootSequence.svelte'";
97+
"from './FileExplorer.svelte'" = "from '$lib/components/features/terminal/FileExplorer.svelte'";
98+
"from './ProjectView.svelte'" = "from '$lib/components/features/terminal/ProjectView.svelte'";
99+
"from './ProjectFile.svelte'" = "from '$lib/components/features/terminal/ProjectFile.svelte'";
100+
# Utils, Transitions, etc.
101+
"from '$lib/i18n'" = "from '$lib/utils/i18n'";
102+
"from '$lib/transitions/print'" = "from '$lib/transitions/transitions'";
103+
"from '$lib/transitions/transitions'" = "from '$lib/transitions/transitions'";
104+
}
105+
106+
foreach ($file in $filesToUpdate) {
107+
$content = Get-Content $file.FullName -Raw
108+
$originalContent = $content
109+
110+
$pathUpdates.GetEnumerator() | ForEach-Object {
111+
$content = $content -replace [regex]::Escape($_.Name), $_.Value
112+
}
113+
114+
if ($content -ne $originalContent) {
115+
Set-Content -Path $file.FullName -Value $content
116+
Write-Host "Updated paths in: $($file.FullName)" -ForegroundColor Cyan
117+
}
118+
}
119+
120+
Write-Host "----------------------------------------------------" -ForegroundColor Green
121+
Write-Host "Project successfully organized and paths updated!" -ForegroundColor Green
122+
Write-Host "----------------------------------------------------" -ForegroundColor Green

src/lib/components/AboutSection.svelte renamed to src/lib/components/features/AboutSection.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
22
import { t } from "$lib/stores/language";
3-
import Section from "$lib/components/Section.svelte";
3+
import Section from "$lib/components/ui/Section.svelte";
44
</script>
55

66
<Section id="about" title={$t("about.title")}>

src/lib/components/EducationSection.svelte renamed to src/lib/components/features/EducationSection.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { t } from "$lib/stores/language";
3-
import Section from "$lib/components/Section.svelte";
4-
import Timeline from "$lib/components/Timeline.svelte";
3+
import Section from "$lib/components/ui/Section.svelte";
4+
import Timeline from "$lib/components/ui/Timeline.svelte";
55
</script>
66

77
<Section id="education" title={$t("education.title")}>

src/lib/components/ExperienceSection.svelte renamed to src/lib/components/features/ExperienceSection.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { t } from "$lib/stores/language";
3-
import Section from "$lib/components/Section.svelte";
4-
import Timeline from "$lib/components/Timeline.svelte";
3+
import Section from "$lib/components/ui/Section.svelte";
4+
import Timeline from "$lib/components/ui/Timeline.svelte";
55
</script>
66

77
<Section id="experience" title={$t("experience.title")}>

src/lib/components/ProjectsSection.svelte renamed to src/lib/components/features/ProjectsSection.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { t } from "$lib/stores/language";
3-
import Section from "$lib/components/Section.svelte";
4-
import ProjectCard from "$lib/components/ProjectCard.svelte";
3+
import Section from "$lib/components/ui/Section.svelte";
4+
import ProjectCard from "$lib/components/ui/ProjectCard.svelte";
55
</script>
66

77
<Section id="projects" title={$t("projects.title")}>

src/lib/components/SkillsSection.svelte renamed to src/lib/components/features/SkillsSection.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script>
22
import { t } from "$lib/stores/language";
3-
import Section from "$lib/components/Section.svelte";
4-
import SkillCard from "$lib/components/SkillCard.svelte";
5-
import SkillIcon from "$lib/components/SkillIcon.svelte";
6-
import BlinkingCursor from "$lib/components/BlinkingCursor.svelte";
3+
import Section from "$lib/components/ui/Section.svelte";
4+
import SkillCard from "$lib/components/ui/SkillCard.svelte";
5+
import SkillIcon from "$lib/components/ui/SkillIcon.svelte";
6+
import BlinkingCursor from "$lib/components/ui/BlinkingCursor.svelte";
77
</script>
88

99
<Section id="skills" title={$t("skills.title")}>
File renamed without changes.

src/lib/components/terminal/FileExplorer.svelte renamed to src/lib/components/features/terminal/FileExplorer.svelte

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
import type { Project } from "$lib/data/projects";
33
import ProjectFile from "./ProjectFile.svelte";
44
import { viewProject } from "$lib/stores/terminalStore";
5-
import BlinkingCursor from "../BlinkingCursor.svelte";
5+
import BlinkingCursor from "../../ui/BlinkingCursor.svelte";
66
export let projects: Project[];
77
</script>
88

99
<div>
1010
<p>> ls -l</p>
1111
<div class="my-4 flex flex-col gap-1">
12-
{#each projects as project (project.id)}
12+
{#each projects as project, index ((project.id, index))}
1313
<button
1414
class="ascii-file-container w-full text-left"
1515
on:click={() => viewProject(project)}
@@ -19,7 +19,9 @@
1919
{/each}
2020
</div>
2121
<div class="flex items-center">
22-
<span>>&nbsp;</span>
23-
<BlinkingCursor />
22+
<p class="flex items-baseline">
23+
<span>>&nbsp;</span>
24+
<BlinkingCursor />
25+
</p>
2426
</div>
2527
</div>
File renamed without changes.

src/lib/components/terminal/ProjectView.svelte renamed to src/lib/components/features/terminal/ProjectView.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import type { Project } from "$lib/data/projects";
33
import { closeProject } from "$lib/stores/terminalStore";
4-
import GlitchText from "../GlitchText.svelte";
4+
import GlitchText from "../../ui/GlitchText.svelte";
55
import { fade } from "svelte/transition";
66
77
export let project: Project;

0 commit comments

Comments
 (0)