From 54583ae58d152384e8aaeaac1dc6a2218e9b1fbf Mon Sep 17 00:00:00 2001 From: DeMineArchiver Date: Fri, 22 Nov 2024 19:56:49 +0300 Subject: [PATCH] Change relative to absolute paths --- apps/frontend/package.json | 1 + .../src/components/section-hello/section-hello.tsx | 7 +++---- apps/frontend/src/routes/(auth)/_auth.lazy.tsx | 2 +- apps/frontend/src/routes/__root.tsx | 11 +---------- apps/frontend/src/routes/index.lazy.tsx | 4 ++-- apps/frontend/src/styles/theme.css.ts | 2 +- apps/frontend/tsconfig.app.json | 4 ++++ apps/frontend/vite.config.ts | 6 ++++++ yarn.lock | 3 ++- 9 files changed, 21 insertions(+), 19 deletions(-) diff --git a/apps/frontend/package.json b/apps/frontend/package.json index 4bdd391..1de5d54 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -33,6 +33,7 @@ "devDependencies": { "@tanstack/router-devtools": "^1.82.2", "@tanstack/router-plugin": "^1.81.9", + "@types/node": "^22.9.1", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@vanilla-extract/vite-plugin": "^4.0.17", diff --git a/apps/frontend/src/components/section-hello/section-hello.tsx b/apps/frontend/src/components/section-hello/section-hello.tsx index 83aaa1b..7b23f67 100644 --- a/apps/frontend/src/components/section-hello/section-hello.tsx +++ b/apps/frontend/src/components/section-hello/section-hello.tsx @@ -1,9 +1,8 @@ import { memo } from "react"; -import { Button } from "../button"; -import { BurgerMenu } from "../burger-menu"; -import { Menu } from "../menu"; +import { Button } from "~/components/button"; +import { Menu } from "~/components/menu"; -import img from "../../assets/images/sectionHello.png"; +import img from "~/assets/images/sectionHello.png"; import "./_section-hello.sass"; const SectionHelloComponent = function SectionHello() { diff --git a/apps/frontend/src/routes/(auth)/_auth.lazy.tsx b/apps/frontend/src/routes/(auth)/_auth.lazy.tsx index ee30be3..5dbf162 100644 --- a/apps/frontend/src/routes/(auth)/_auth.lazy.tsx +++ b/apps/frontend/src/routes/(auth)/_auth.lazy.tsx @@ -11,7 +11,7 @@ import { useState } from "react"; import styles from "./_auth.module.sass"; import clsx from "clsx"; -import { OutletWithPresence } from "../../components/outlet"; +import { OutletWithPresence } from "~/components/outlet"; export const Route = createLazyFileRoute("/(auth)/_auth")({ component: RouteComponent, diff --git a/apps/frontend/src/routes/__root.tsx b/apps/frontend/src/routes/__root.tsx index cf62b3d..4ae2611 100644 --- a/apps/frontend/src/routes/__root.tsx +++ b/apps/frontend/src/routes/__root.tsx @@ -1,5 +1,5 @@ import { Lenis } from "@star4/react"; -import { createRootRoute, Link, Outlet } from "@tanstack/react-router"; +import { createRootRoute, Outlet } from "@tanstack/react-router"; import { lazy, Suspense } from "react"; const TanStackRouterDevtools = @@ -14,15 +14,6 @@ const TanStackRouterDevtools = export const Route = createRootRoute({ component: () => ( <> - {/*
- - Home - {' '} - - About - -
-
*/} diff --git a/apps/frontend/src/routes/index.lazy.tsx b/apps/frontend/src/routes/index.lazy.tsx index fa2790a..ca3405d 100644 --- a/apps/frontend/src/routes/index.lazy.tsx +++ b/apps/frontend/src/routes/index.lazy.tsx @@ -1,6 +1,6 @@ import { createLazyFileRoute } from "@tanstack/react-router"; -import { SectionHello } from "../components/section-hello"; -import { Hero } from "../components/hero"; +import { SectionHello } from "~/components/section-hello"; +import { Hero } from "~/components/hero"; export const Route = createLazyFileRoute("/")({ component: Index, diff --git a/apps/frontend/src/styles/theme.css.ts b/apps/frontend/src/styles/theme.css.ts index cb3a777..5b230a1 100644 --- a/apps/frontend/src/styles/theme.css.ts +++ b/apps/frontend/src/styles/theme.css.ts @@ -1,5 +1,5 @@ import { assignVars, createGlobalTheme, globalStyle } from "@vanilla-extract/css"; -import { theme, THEME } from "../theme"; +import { theme, THEME } from "~/theme"; const LIGHT_THEME = theme("light"); const DARK_THEME = theme("dark"); diff --git a/apps/frontend/tsconfig.app.json b/apps/frontend/tsconfig.app.json index 00b13ce..c402338 100644 --- a/apps/frontend/tsconfig.app.json +++ b/apps/frontend/tsconfig.app.json @@ -20,6 +20,10 @@ "strict": true, "noImplicitOverride": true, "forceConsistentCasingInFileNames": true, + + "paths": { + "~/*": ["./src/*"], + }, }, "include": ["src"] } diff --git a/apps/frontend/vite.config.ts b/apps/frontend/vite.config.ts index 3dbc9b1..8a636b1 100644 --- a/apps/frontend/vite.config.ts +++ b/apps/frontend/vite.config.ts @@ -1,4 +1,5 @@ import { defineConfig } from "vite"; +import { resolve } from "path"; // Renaming all imported plugins to follow our naming convention import { TanStackRouterVite as tanStackRouter } from "@tanstack/router-plugin/vite"; @@ -14,4 +15,9 @@ export default defineConfig({ vanillaExtract(), react(), ], + resolve: { + alias: { + "~": resolve(__dirname, "src"), + }, + }, }) diff --git a/yarn.lock b/yarn.lock index 1acaf7a..3eb4c71 100644 --- a/yarn.lock +++ b/yarn.lock @@ -275,6 +275,7 @@ __metadata: "@tanstack/react-router": "npm:^1.82.2" "@tanstack/router-devtools": "npm:^1.82.2" "@tanstack/router-plugin": "npm:^1.81.9" + "@types/node": "npm:^22.9.1" "@types/react": "npm:^18.3.12" "@types/react-dom": "npm:^18.3.1" "@vanilla-extract/css": "npm:^1.16.0" @@ -1516,7 +1517,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*": +"@types/node@npm:*, @types/node@npm:^22.9.1": version: 22.9.1 resolution: "@types/node@npm:22.9.1" dependencies: