refactor: absolute paths

This commit is contained in:
2025-12-13 20:07:10 +01:00
parent 3b801c97ff
commit 68fd923d2e
18 changed files with 65 additions and 48 deletions

View File

@@ -10,6 +10,7 @@
"format": "prettier --write --cache ." "format": "prettier --write --cache ."
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^25.0.1",
"@types/three": "^0.182.0", "@types/three": "^0.182.0",
"prettier": "^3.7.4", "prettier": "^3.7.4",
"typescript": "~5.9.3", "typescript": "~5.9.3",

26
pnpm-lock.yaml generated
View File

@@ -14,6 +14,9 @@ importers:
specifier: ^0.182.0 specifier: ^0.182.0
version: 0.182.0 version: 0.182.0
devDependencies: devDependencies:
"@types/node":
specifier: ^25.0.1
version: 25.0.1
"@types/three": "@types/three":
specifier: ^0.182.0 specifier: ^0.182.0
version: 0.182.0 version: 0.182.0
@@ -25,7 +28,7 @@ importers:
version: 5.9.3 version: 5.9.3
vite: vite:
specifier: npm:rolldown-vite@7.2.5 specifier: npm:rolldown-vite@7.2.5
version: rolldown-vite@7.2.5 version: rolldown-vite@7.2.5(@types/node@25.0.1)
packages: packages:
"@dimforge/rapier3d-compat@0.12.0": "@dimforge/rapier3d-compat@0.12.0":
@@ -214,6 +217,12 @@ packages:
integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==, integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==,
} }
"@types/node@25.0.1":
resolution:
{
integrity: sha512-czWPzKIAXucn9PtsttxmumiQ9N0ok9FrBwgRWrwmVLlp86BrMExzvXRLFYRJ+Ex3g6yqj+KuaxfX1JTgV2lpfg==,
}
"@types/stats.js@0.17.4": "@types/stats.js@0.17.4":
resolution: resolution:
{ {
@@ -504,6 +513,12 @@ packages:
engines: { node: ">=14.17" } engines: { node: ">=14.17" }
hasBin: true hasBin: true
undici-types@7.16.0:
resolution:
{
integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==,
}
snapshots: snapshots:
"@dimforge/rapier3d-compat@0.12.0": {} "@dimforge/rapier3d-compat@0.12.0": {}
@@ -587,6 +602,10 @@ snapshots:
tslib: 2.8.1 tslib: 2.8.1
optional: true optional: true
"@types/node@25.0.1":
dependencies:
undici-types: 7.16.0
"@types/stats.js@0.17.4": {} "@types/stats.js@0.17.4": {}
"@types/three@0.182.0": "@types/three@0.182.0":
@@ -679,7 +698,7 @@ snapshots:
prettier@3.7.4: {} prettier@3.7.4: {}
rolldown-vite@7.2.5: rolldown-vite@7.2.5(@types/node@25.0.1):
dependencies: dependencies:
"@oxc-project/runtime": 0.97.0 "@oxc-project/runtime": 0.97.0
fdir: 6.5.0(picomatch@4.0.3) fdir: 6.5.0(picomatch@4.0.3)
@@ -689,6 +708,7 @@ snapshots:
rolldown: 1.0.0-beta.50 rolldown: 1.0.0-beta.50
tinyglobby: 0.2.15 tinyglobby: 0.2.15
optionalDependencies: optionalDependencies:
"@types/node": 25.0.1
fsevents: 2.3.3 fsevents: 2.3.3
rolldown@1.0.0-beta.50: rolldown@1.0.0-beta.50:
@@ -724,3 +744,5 @@ snapshots:
optional: true optional: true
typescript@5.9.3: {} typescript@5.9.3: {}
undici-types@7.16.0: {}

View File

@@ -2,7 +2,7 @@ import "./style.css";
import * as THREE from "three"; import * as THREE from "three";
import { OrbitControls } from "three/addons/controls/OrbitControls.js"; import { OrbitControls } from "three/addons/controls/OrbitControls.js";
import { NDS } from "./nds"; import { NDS } from "~/nds";
// initialize scene // initialize scene
const scene = new THREE.Scene(); const scene = new THREE.Scene();

View File

@@ -1,6 +1,6 @@
import * as THREE from "three"; import * as THREE from "three";
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js"; import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
import { ScreenManager } from "./screen-manager"; import { ScreenManager } from "~/screen-manager";
const SCREEN_SOURCE_TEX_SIZE = 1024; const SCREEN_SOURCE_TEX_SIZE = 1024;
const TOP_SCREEN_SOURCE_TEX_HEIGHT = SCREEN_SOURCE_TEX_SIZE / 404; const TOP_SCREEN_SOURCE_TEX_HEIGHT = SCREEN_SOURCE_TEX_SIZE / 404;

View File

@@ -1,5 +1,5 @@
import type { Screen } from "./screen"; import type { Screen } from "~/screen";
import { HomeScreen } from "./screens/home"; import { HomeScreen } from "~/screens/home";
export class ScreenManager { export class ScreenManager {
private currentScreen: Screen; private currentScreen: Screen;

View File

@@ -1,22 +0,0 @@
import type { Screen, ScreenContext } from "../screen";
import { HomeScreen } from "./home";
export class ContactScreen implements Screen {
renderTop(ctx: CanvasRenderingContext2D) {
ctx;
}
renderBottom(ctx: CanvasRenderingContext2D) {
ctx.fillStyle = "#ffffff";
ctx.font = "10px NDS10";
ctx.textAlign = "left";
ctx.textBaseline = "bottom";
ctx.fillText("< Back", 1, 191);
}
handleTouch(x: number, y: number, context: ScreenContext): void {
if (x >= 0 && x <= 51 && y >= 178 && y <= 192) {
context.navigate(new HomeScreen());
}
}
}

View File

@@ -1,8 +1,8 @@
import { ImageLoader } from "../../../utils/loadImages"; import { ImageLoader } from "~/utils/loadImages";
import { ButtonNavigation } from "../../../utils/buttonNavigation"; import { ButtonNavigation } from "~/utils/buttonNavigation";
import { ButtonSelector } from "../../../utils/buttonSelector"; import { ButtonSelector } from "~/utils/buttonSelector";
import { HomeScreen } from "../../home"; import { HomeScreen } from "~/screens/home";
import type { ContactScreenContext } from "../index"; import type { ContactScreenContext } from "~/screens/contact";
type ContactButton = "github" | "email" | "website" | "cv"; type ContactButton = "github" | "email" | "website" | "cv";

View File

@@ -1,4 +1,4 @@
import type { Screen, ScreenContext } from "../../screen"; import type { Screen, ScreenContext } from "~/screen";
import { ContactTopScreen } from "./top"; import { ContactTopScreen } from "./top";
import { ContactBottomScreen } from "./bottom"; import { ContactBottomScreen } from "./bottom";

View File

@@ -1,4 +1,4 @@
import { ImageLoader } from "../../../utils/loadImages"; import { ImageLoader } from "~/utils/loadImages";
export class ContactTopScreen { export class ContactTopScreen {
private images = new ImageLoader({ private images = new ImageLoader({

View File

@@ -1,8 +1,8 @@
import { ImageLoader } from "../../../utils/loadImages"; import { ImageLoader } from "~/utils/loadImages";
import { ButtonNavigation } from "../../../utils/buttonNavigation"; import { ButtonNavigation } from "~/utils/buttonNavigation";
import { ButtonSelector } from "../../../utils/buttonSelector"; import { ButtonSelector } from "~/utils/buttonSelector";
import type { ScreenContext } from "../../../screen"; import type { ScreenContext } from "~/screen";
import { ContactScreen } from "../../contact"; import { ContactScreen } from "~/screens/contact";
type HomeButton = "projects" | "contact" | "downloadPlay" | "settings"; type HomeButton = "projects" | "contact" | "downloadPlay" | "settings";

View File

@@ -1,4 +1,4 @@
import type { Screen, ScreenContext } from "../../screen"; import type { Screen, ScreenContext } from "~/screen";
import { HomeTopScreen } from "./top"; import { HomeTopScreen } from "./top";
import { HomeBottomScreen } from "./bottom"; import { HomeBottomScreen } from "./bottom";

View File

@@ -1,4 +1,4 @@
import { ImageLoader } from "../../../utils/loadImages"; import { ImageLoader } from "~/utils/loadImages";
export class Calendar { export class Calendar {
private images = new ImageLoader({ private images = new ImageLoader({

View File

@@ -1,4 +1,4 @@
import { ImageLoader } from "../../../utils/loadImages"; import { ImageLoader } from "~/utils/loadImages";
const CENTER_X = 63; const CENTER_X = 63;
const CENTER_Y = 95; const CENTER_Y = 95;

View File

@@ -1,4 +1,4 @@
import { ImageLoader } from "../../../utils/loadImages"; import { ImageLoader } from "~/utils/loadImages";
import { StatusBar } from "./statusBar"; import { StatusBar } from "./statusBar";
import { Clock } from "./clock"; import { Clock } from "./clock";
import { Calendar } from "./calendar"; import { Calendar } from "./calendar";

View File

@@ -1,4 +1,4 @@
import { ImageLoader } from "../../../utils/loadImages"; import { ImageLoader } from "~/utils/loadImages";
export class StatusBar { export class StatusBar {
private images = new ImageLoader({ private images = new ImageLoader({

View File

@@ -1,5 +1,5 @@
import { ImageLoader } from "./loadImages"; import { ImageLoader } from "~/utils/loadImages";
import type { ButtonRect } from "./buttonNavigation"; import type { ButtonRect } from "~/utils/buttonNavigation";
const ANIMATION_SPEED = 0.25; const ANIMATION_SPEED = 0.25;

View File

@@ -20,7 +20,13 @@
"noUnusedParameters": true, "noUnusedParameters": true,
"erasableSyntaxOnly": true, "erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true "noUncheckedSideEffectImports": true,
"baseUrl": ".",
"paths": {
"~/*": ["./src/*"],
"~/": ["./src/index.ts"]
}
}, },
"include": ["src"] "include": ["src"]
} }

10
vite.config.ts Normal file
View File

@@ -0,0 +1,10 @@
import { defineConfig } from "vite";
import { resolve } from "path";
export default defineConfig({
resolve: {
alias: {
"~": resolve(__dirname, "./src"),
},
},
});