From 354882e983b7697e95ec10728fb885e31a91d5d5 Mon Sep 17 00:00:00 2001 From: olli <144932831+OLILHR@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:53:42 +0100 Subject: [PATCH] refactor: Configure path aliases for more consistent imports (#100) * Configure path aliases for `$server` and `$src` imports * Add include patterns to ensure all source files are considered * Replace kit aliases with paths in tsconfig --- src/auth/authService.ts | 4 ++-- src/lib/components/index.ts | 22 +++++++++---------- src/lib/components/shared/login-button.svelte | 5 ++--- src/routes/+layout.server.ts | 4 ++-- src/routes/+layout.svelte | 9 ++++---- src/routes/+page.svelte | 7 +++--- src/routes/ebd/+layout.svelte | 2 +- src/routes/ebd/+page.server.ts | 5 +++-- src/routes/ebd/[...ebd]/+layout.svelte | 2 +- src/routes/ebd/[...ebd]/+page.server.ts | 16 ++++++++++---- src/server/prerender-entries.ts | 4 ++-- tsconfig.json | 11 ++++++++-- vite.config.ts | 7 ++++++ 13 files changed, 59 insertions(+), 39 deletions(-) diff --git a/src/auth/authService.ts b/src/auth/authService.ts index 798d799..40b7281 100644 --- a/src/auth/authService.ts +++ b/src/auth/authService.ts @@ -1,8 +1,8 @@ import type { LogoutOptions } from "@auth0/auth0-spa-js"; import { Auth0Client, createAuth0Client, User } from "@auth0/auth0-spa-js"; -import { isAuthenticated, user } from "../store"; -import config from "./auth_config"; +import config from "$src/auth/auth_config"; +import { isAuthenticated, user } from "$src/store"; let auth0Client: Auth0Client; diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts index 93ac890..07b73d4 100644 --- a/src/lib/components/index.ts +++ b/src/lib/components/index.ts @@ -1,14 +1,14 @@ // shared components -export { default as Footer } from "./shared/footer.svelte"; -export { default as Header } from "./shared/header.svelte"; -export { default as IconLogin } from "./shared/icon-login.svelte"; -export { default as IconLogo } from "./shared/icon-logo.svelte"; -export { default as IconLogout } from "./shared/icon-logout.svelte"; -export { default as LoginButton } from "./shared/login-button.svelte"; -export { default as ToolsBanner } from "./shared/tools-banner.svelte"; +export { default as Footer } from "$lib/components/shared/footer.svelte"; +export { default as Header } from "$lib/components/shared/header.svelte"; +export { default as IconLogin } from "$lib/components/shared/icon-login.svelte"; +export { default as IconLogo } from "$lib/components/shared/icon-logo.svelte"; +export { default as IconLogout } from "$lib/components/shared/icon-logout.svelte"; +export { default as LoginButton } from "$lib/components/shared/login-button.svelte"; +export { default as ToolsBanner } from "$lib/components/shared/tools-banner.svelte"; // features -export { default as EbdFormHeader } from "./features/ebd-form-header.svelte"; -export { default as EbdSelect } from "./features/ebd-select.svelte"; -export { default as ExportButton } from "./features/export-button.svelte"; -export { default as FormatVersionSelect } from "./features/format-version-select.svelte"; +export { default as EbdFormHeader } from "$lib/components/features/ebd-form-header.svelte"; +export { default as EbdSelect } from "$lib/components/features/ebd-select.svelte"; +export { default as ExportButton } from "$lib/components/features/export-button.svelte"; +export { default as FormatVersionSelect } from "$lib/components/features/format-version-select.svelte"; diff --git a/src/lib/components/shared/login-button.svelte b/src/lib/components/shared/login-button.svelte index 96359a8..f562f32 100644 --- a/src/lib/components/shared/login-button.svelte +++ b/src/lib/components/shared/login-button.svelte @@ -2,9 +2,8 @@ import { onMount } from "svelte"; import { IconLogin, IconLogout } from "$lib/components"; - - import auth from "../../../auth/authService"; - import { isAuthenticated, user } from "../../../store"; + import auth from "$src/auth/authService"; + import { isAuthenticated, user } from "$src/store"; let userEmail: string = ""; diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts index 7b3b609..0869b79 100644 --- a/src/routes/+layout.server.ts +++ b/src/routes/+layout.server.ts @@ -1,5 +1,5 @@ -import { getEbds } from "../server/ebd-loader"; -import { getFormatVersions } from "../server/format-version-loader"; +import { getEbds } from "$server/ebd-loader"; +import { getFormatVersions } from "$server/format-version-loader"; export const load = async () => { const formatVersions = getFormatVersions(); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 7e28228..2d2b791 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,5 +1,5 @@