diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-09-19 18:13:57 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-09-19 19:12:31 +0200 |
| commit | 2faf2e34331703b3bdea3eb487cb8799c8d65377 (patch) | |
| tree | dedc6557ddaa8fedd42d9bdf77950f8f9168ebcb /src/utils | |
| parent | d1fe9e2164fc5c8fd767b456eecc2a4eb929a33f (diff) | |
refactor(build): replace paths aliases with relative paths
Using paths aliases starting with "@" can be confusing and can lead to
conflict with existings modules. I prefer to use relative paths to
avoid extra configuration in tools because of these aliases.
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/helpers/author.ts | 4 | ||||
| -rw-r--r-- | src/utils/helpers/dates.ts | 2 | ||||
| -rw-r--r-- | src/utils/helpers/i18n.ts | 2 | ||||
| -rw-r--r-- | src/utils/helpers/images.ts | 4 | ||||
| -rw-r--r-- | src/utils/helpers/pages.ts | 12 | ||||
| -rw-r--r-- | src/utils/helpers/projects.ts | 8 | ||||
| -rw-r--r-- | src/utils/helpers/rss.ts | 8 | ||||
| -rw-r--r-- | src/utils/helpers/schema-org.ts | 4 | ||||
| -rw-r--r-- | src/utils/hooks/use-article.tsx | 10 | ||||
| -rw-r--r-- | src/utils/hooks/use-attributes.tsx | 2 | ||||
| -rw-r--r-- | src/utils/hooks/use-breadcrumb.tsx | 4 | ||||
| -rw-r--r-- | src/utils/hooks/use-comments.tsx | 4 | ||||
| -rw-r--r-- | src/utils/hooks/use-github-api.tsx | 2 | ||||
| -rw-r--r-- | src/utils/hooks/use-headings-tree.tsx | 2 | ||||
| -rw-r--r-- | src/utils/hooks/use-local-storage.tsx | 2 | ||||
| -rw-r--r-- | src/utils/hooks/use-pagination.tsx | 4 | ||||
| -rw-r--r-- | src/utils/hooks/use-prism.tsx | 4 | ||||
| -rw-r--r-- | src/utils/hooks/use-settings.tsx | 2 | ||||
| -rw-r--r-- | src/utils/hooks/use-update-ackee-options.tsx | 2 | ||||
| -rw-r--r-- | src/utils/providers/prism-theme.tsx | 6 |
20 files changed, 44 insertions, 44 deletions
diff --git a/src/utils/helpers/author.ts b/src/utils/helpers/author.ts index 40743ca..2892524 100644 --- a/src/utils/helpers/author.ts +++ b/src/utils/helpers/author.ts @@ -1,5 +1,5 @@ -import { type Author, type ContentKind } from '@ts/types/app'; -import { type RawAuthor } from '@ts/types/raw-data'; +import { type Author, type ContentKind } from '../../types/app'; +import { type RawAuthor } from '../../types/raw-data'; /** * Convert author raw data to regular data. diff --git a/src/utils/helpers/dates.ts b/src/utils/helpers/dates.ts index cb56ad2..82c14db 100644 --- a/src/utils/helpers/dates.ts +++ b/src/utils/helpers/dates.ts @@ -1,4 +1,4 @@ -import { settings } from '@utils/config'; +import { settings } from '../config'; /** * Format a date based on a locale. diff --git a/src/utils/helpers/i18n.ts b/src/utils/helpers/i18n.ts index 5d19c8c..35d495e 100644 --- a/src/utils/helpers/i18n.ts +++ b/src/utils/helpers/i18n.ts @@ -1,7 +1,7 @@ import { createIntl, createIntlCache, IntlShape } from '@formatjs/intl'; -import { settings } from '@utils/config'; import { readFile } from 'fs/promises'; import path from 'path'; +import { settings } from '../config'; export type Messages = { [key: string]: string }; diff --git a/src/utils/helpers/images.ts b/src/utils/helpers/images.ts index 30bb8be..bff50c3 100644 --- a/src/utils/helpers/images.ts +++ b/src/utils/helpers/images.ts @@ -1,5 +1,5 @@ -import { Image } from '@ts/types/app'; -import { RawCover } from '@ts/types/raw-data'; +import { Image } from '../../types/app'; +import { RawCover } from '../../types/raw-data'; /** * Retrieve an Image object from raw data. diff --git a/src/utils/helpers/pages.ts b/src/utils/helpers/pages.ts index eb4453b..d6d44d2 100644 --- a/src/utils/helpers/pages.ts +++ b/src/utils/helpers/pages.ts @@ -1,13 +1,13 @@ -import { type Post } from '@components/organisms/layout/posts-list'; -import { type LinksListItems } from '@components/organisms/widgets/links-list-widget'; -import { getArticleFromRawData } from '@services/graphql/articles'; -import { type Article, type PageLink } from '@ts/types/app'; -import { EdgesResponse } from '@ts/types/graphql/queries'; +import { type Post } from '../../components/organisms/layout/posts-list'; +import { type LinksListItems } from '../../components/organisms/widgets/links-list-widget'; +import { getArticleFromRawData } from '../../services/graphql/articles'; +import { type Article, type PageLink } from '../../types/app'; +import { EdgesResponse } from '../../types/graphql/queries'; import { type RawArticle, type RawThematicPreview, type RawTopicPreview, -} from '@ts/types/raw-data'; +} from '../../types/raw-data'; import { getImageFromRawData } from './images'; /** diff --git a/src/utils/helpers/projects.ts b/src/utils/helpers/projects.ts index 88f4516..0e4de7d 100644 --- a/src/utils/helpers/projects.ts +++ b/src/utils/helpers/projects.ts @@ -1,7 +1,7 @@ -import { ProjectCard, ProjectPreview } from '@ts/types/app'; -import { MDXProjectMeta } from '@ts/types/mdx'; -import { readdirSync } from 'fs'; -import path from 'path'; +import { readdirSync } from 'node:fs'; +import path from 'node:path'; +import { ProjectCard, ProjectPreview } from '../../types/app'; +import { MDXProjectMeta } from '../../types/mdx'; /** * Retrieve all the projects filename. diff --git a/src/utils/helpers/rss.ts b/src/utils/helpers/rss.ts index 8ee774c..41a036c 100644 --- a/src/utils/helpers/rss.ts +++ b/src/utils/helpers/rss.ts @@ -1,11 +1,11 @@ +import { Feed } from 'feed'; import { getArticleFromRawData, getArticles, getTotalArticles, -} from '@services/graphql/articles'; -import { Article } from '@ts/types/app'; -import { settings } from '@utils/config'; -import { Feed } from 'feed'; +} from '../../services/graphql/articles'; +import { Article } from '../../types/app'; +import { settings } from '../../utils/config'; /** * Retrieve the data for all the articles. diff --git a/src/utils/helpers/schema-org.ts b/src/utils/helpers/schema-org.ts index cdace00..5d400c8 100644 --- a/src/utils/helpers/schema-org.ts +++ b/src/utils/helpers/schema-org.ts @@ -1,5 +1,3 @@ -import { Dates } from '@ts/types/app'; -import { settings } from '@utils/config'; import { AboutPage, Article, @@ -9,6 +7,8 @@ import { Graph, WebPage, } from 'schema-dts'; +import { Dates } from '../../types/app'; +import { settings } from '../../utils/config'; export type GetBlogSchemaProps = { /** diff --git a/src/utils/hooks/use-article.tsx b/src/utils/hooks/use-article.tsx index e658407..f6512b2 100644 --- a/src/utils/hooks/use-article.tsx +++ b/src/utils/hooks/use-article.tsx @@ -1,9 +1,9 @@ -import { fetchAPI } from '@services/graphql/api'; -import { getArticleFromRawData } from '@services/graphql/articles'; -import { articleBySlugQuery } from '@services/graphql/articles.query'; -import { Article } from '@ts/types/app'; -import { RawArticle } from '@ts/types/raw-data'; import useSWR from 'swr'; +import { fetchAPI } from '../../services/graphql/api'; +import { getArticleFromRawData } from '../../services/graphql/articles'; +import { articleBySlugQuery } from '../../services/graphql/articles.query'; +import { Article } from '../../types/app'; +import { RawArticle } from '../../types/raw-data'; export type UseArticleConfig = { fallback?: Article; diff --git a/src/utils/hooks/use-attributes.tsx b/src/utils/hooks/use-attributes.tsx index 6d18048..35161ed 100644 --- a/src/utils/hooks/use-attributes.tsx +++ b/src/utils/hooks/use-attributes.tsx @@ -1,5 +1,5 @@ -import { fromKebabCaseToCamelCase } from '@utils/helpers/strings'; import { useCallback, useEffect } from 'react'; +import { fromKebabCaseToCamelCase } from '../helpers/strings'; export type useAttributesProps = { /** diff --git a/src/utils/hooks/use-breadcrumb.tsx b/src/utils/hooks/use-breadcrumb.tsx index 130ebf1..dcdf87f 100644 --- a/src/utils/hooks/use-breadcrumb.tsx +++ b/src/utils/hooks/use-breadcrumb.tsx @@ -1,7 +1,7 @@ -import { BreadcrumbItem } from '@components/molecules/nav/breadcrumb'; -import { slugify } from '@utils/helpers/strings'; import { useIntl } from 'react-intl'; import { BreadcrumbList } from 'schema-dts'; +import { BreadcrumbItem } from '../../components/molecules/nav/breadcrumb'; +import { slugify } from '../helpers/strings'; import useSettings from './use-settings'; export type useBreadcrumbProps = { diff --git a/src/utils/hooks/use-comments.tsx b/src/utils/hooks/use-comments.tsx index a695bd7..8281a86 100644 --- a/src/utils/hooks/use-comments.tsx +++ b/src/utils/hooks/use-comments.tsx @@ -1,6 +1,6 @@ -import { getAllComments } from '@services/graphql/comments'; -import { SingleComment } from '@ts/types/app'; import useSWR from 'swr'; +import { getAllComments } from '../../services/graphql/comments'; +import { SingleComment } from '../../types/app'; export type UseCommentsConfig = { contentId?: string | number; diff --git a/src/utils/hooks/use-github-api.tsx b/src/utils/hooks/use-github-api.tsx index edff974..56df01f 100644 --- a/src/utils/hooks/use-github-api.tsx +++ b/src/utils/hooks/use-github-api.tsx @@ -1,5 +1,5 @@ -import { SWRResult } from '@ts/types/swr'; import useSWR, { Fetcher } from 'swr'; +import { SWRResult } from '../../types/swr'; export type RepoData = { created_at: string; diff --git a/src/utils/hooks/use-headings-tree.tsx b/src/utils/hooks/use-headings-tree.tsx index f7ab452..0dc077e 100644 --- a/src/utils/hooks/use-headings-tree.tsx +++ b/src/utils/hooks/use-headings-tree.tsx @@ -1,5 +1,5 @@ -import { slugify } from '@utils/helpers/strings'; import { useCallback, useEffect, useMemo, useState } from 'react'; +import { slugify } from '../helpers/strings'; import { useMutationObserver } from './use-mutation-observer'; export type Heading = { diff --git a/src/utils/hooks/use-local-storage.tsx b/src/utils/hooks/use-local-storage.tsx index da0292b..1809e07 100644 --- a/src/utils/hooks/use-local-storage.tsx +++ b/src/utils/hooks/use-local-storage.tsx @@ -1,4 +1,4 @@ -import { LocalStorage } from '@services/local-storage'; +import { LocalStorage } from '../../services/local-storage'; import { Dispatch, SetStateAction, useEffect, useState } from 'react'; export type UseLocalStorageReturn<T> = { diff --git a/src/utils/hooks/use-pagination.tsx b/src/utils/hooks/use-pagination.tsx index f17b6ff..f47a674 100644 --- a/src/utils/hooks/use-pagination.tsx +++ b/src/utils/hooks/use-pagination.tsx @@ -1,6 +1,6 @@ -import { GraphQLEdgesInput } from '@ts/types/graphql/generics'; -import { EdgesResponse, Search } from '@ts/types/graphql/queries'; import useSWRInfinite, { SWRInfiniteKeyLoader } from 'swr/infinite'; +import { GraphQLEdgesInput } from '../../types/graphql/generics'; +import { EdgesResponse, Search } from '../../types/graphql/queries'; export type UsePaginationProps<T> = { /** diff --git a/src/utils/hooks/use-prism.tsx b/src/utils/hooks/use-prism.tsx index ef1a4c8..05790a3 100644 --- a/src/utils/hooks/use-prism.tsx +++ b/src/utils/hooks/use-prism.tsx @@ -17,7 +17,7 @@ const PRISM_PLUGINS = [ 'toolbar', ] as const; -export type PrismPlugin = typeof PRISM_PLUGINS[number]; +export type PrismPlugin = (typeof PRISM_PLUGINS)[number]; export type DefaultPrismPlugin = Extract< PrismPlugin, @@ -90,7 +90,7 @@ const loadPrismPlugins = async (plugins: PrismPlugin[]) => { for (const plugin of plugins) { try { if (plugin === 'color-scheme') { - await import(`@utils/plugins/prism-${plugin}`); + await import(`../plugins/prism-${plugin}`); } else { await import(`prismjs/plugins/${plugin}/prism-${plugin}.min.js`); } diff --git a/src/utils/hooks/use-settings.tsx b/src/utils/hooks/use-settings.tsx index a1d1a65..edb5b5e 100644 --- a/src/utils/hooks/use-settings.tsx +++ b/src/utils/hooks/use-settings.tsx @@ -1,5 +1,5 @@ -import { settings } from '@utils/config'; import { useRouter } from 'next/router'; +import { settings } from '../config'; export type BlogSettings = { /** diff --git a/src/utils/hooks/use-update-ackee-options.tsx b/src/utils/hooks/use-update-ackee-options.tsx index 7c1d98a..1901588 100644 --- a/src/utils/hooks/use-update-ackee-options.tsx +++ b/src/utils/hooks/use-update-ackee-options.tsx @@ -1,5 +1,5 @@ -import { useAckeeTracker } from '@utils/providers/ackee'; import { useEffect } from 'react'; +import { useAckeeTracker } from '../providers/ackee'; export type AckeeOptions = 'full' | 'partial'; diff --git a/src/utils/providers/prism-theme.tsx b/src/utils/providers/prism-theme.tsx index dd8feb7..6ecbb1d 100644 --- a/src/utils/providers/prism-theme.tsx +++ b/src/utils/providers/prism-theme.tsx @@ -1,6 +1,3 @@ -import useAttributes from '@utils/hooks/use-attributes'; -import useLocalStorage from '@utils/hooks/use-local-storage'; -import useQuerySelectorAll from '@utils/hooks/use-query-selector-all'; import { createContext, FC, @@ -10,6 +7,9 @@ import { useEffect, useState, } from 'react'; +import useAttributes from '../hooks/use-attributes'; +import useLocalStorage from '../hooks/use-local-storage'; +import useQuerySelectorAll from '../hooks/use-query-selector-all'; export type PrismTheme = 'dark' | 'light' | 'system'; export type ResolvedPrismTheme = Exclude<PrismTheme, 'system'>; |
