diff --git a/packages/backend/src/app.ts b/packages/backend/src/app.ts index a3b2f7c..ae2a8fa 100644 --- a/packages/backend/src/app.ts +++ b/packages/backend/src/app.ts @@ -1,7 +1,7 @@ import axios from 'axios'; import dotenv from 'dotenv'; -import { config } from './config.js'; +import { config } from '@/config.js'; export type { AppRouter } from '@/server/api/index.js'; @@ -14,6 +14,6 @@ axios.defaults.headers['Content-Type'] = 'application/json'; axios.defaults.validateStatus = (stat) => stat < 500; (async () => { - await (await import('./boot/server.js')).default(); - (await import('./boot/worker.js')).default(); + await (await import('@/boot/server.js')).default(); + (await import('@/boot/worker.js')).default(); })(); diff --git a/packages/backend/src/server/api/index.ts b/packages/backend/src/server/api/index.ts index 47b5dd9..4a77773 100644 --- a/packages/backend/src/server/api/index.ts +++ b/packages/backend/src/server/api/index.ts @@ -1,7 +1,6 @@ -import { accountRouter } from './routers/account.js'; -import { announcementsRouter } from './routers/announcements.js'; -import { metaRouter } from './routers/meta.js'; - +import { accountRouter } from '@/server/api/routers/account.js'; +import { announcementsRouter } from '@/server/api/routers/announcements.js'; +import { metaRouter } from '@/server/api/routers/meta.js'; import { router } from '@/server/api/trpc.js'; export const appRouter = router({ diff --git a/packages/backend/src/server/api/routers/account.ts b/packages/backend/src/server/api/routers/account.ts index 1b5ad44..607c541 100644 --- a/packages/backend/src/server/api/routers/account.ts +++ b/packages/backend/src/server/api/routers/account.ts @@ -1,10 +1,9 @@ import { z } from 'zod'; -import { accountDtoSchema, toAccountDto } from '../dto/account'; -import { misskeySessionDtoSchema } from '../dto/misskey-session'; - import { prisma } from '@/libs/prisma'; +import { accountDtoSchema, toAccountDto } from '@/server/api/dto/account'; +import { misskeySessionDtoSchema } from '@/server/api/dto/misskey-session'; import { sessionProcedure } from '@/server/api/procedures/session.js'; import { router } from '@/server/api/trpc.js'; diff --git a/packages/backend/src/server/api/routers/meta.ts b/packages/backend/src/server/api/routers/meta.ts index 99297fd..72e2fd6 100644 --- a/packages/backend/src/server/api/routers/meta.ts +++ b/packages/backend/src/server/api/routers/meta.ts @@ -1,8 +1,7 @@ import { currentTokenVersion } from 'tools-shared/dist/const.js'; -import { metaDtoSchema } from '../dto/meta'; - import { meta } from '@/config'; +import { metaDtoSchema } from '@/server/api/dto/meta'; import { procedure, router } from '@/server/api/trpc'; export const metaRouter = router({ diff --git a/packages/backend/src/types/misskey-error.ts b/packages/backend/src/types/misskey-error.ts index 127dad2..05de584 100644 --- a/packages/backend/src/types/misskey-error.ts +++ b/packages/backend/src/types/misskey-error.ts @@ -1,4 +1,4 @@ -import { MisskeyErrorObject } from './misskey-error-object.js'; +import { MisskeyErrorObject } from '@/types/misskey-error-object.js'; export class MisskeyError extends Error { constructor(public error: MisskeyErrorObject) { diff --git a/packages/frontend/src/components/HeaderBar.tsx b/packages/frontend/src/components/HeaderBar.tsx index 87e9316..473b8c4 100644 --- a/packages/frontend/src/components/HeaderBar.tsx +++ b/packages/frontend/src/components/HeaderBar.tsx @@ -2,12 +2,11 @@ import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; -import { PopupMenu } from './primitives/PopupMenu'; - import { Centered } from '@/components/layouts/Centered.js'; import { Button } from '@/components/primitives/Button.js'; +import { PopupMenu } from '@/components/primitives/PopupMenu.js'; import { styled } from '@/libs/stitches.js'; -import { MenuItem } from '@/models/menu'; +import { MenuItem } from '@/models/menu.js'; const Container = styled('header', { diff --git a/packages/frontend/src/components/domains/dashboard/def.tsx b/packages/frontend/src/components/domains/dashboard/def.tsx index 2b82f57..40cf9ac 100644 --- a/packages/frontend/src/components/domains/dashboard/def.tsx +++ b/packages/frontend/src/components/domains/dashboard/def.tsx @@ -1,8 +1,7 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; -import { WidgetBase } from './WidgetBase'; - +import { WidgetBase } from '@/components/domains/dashboard/WidgetBase'; import { SuspenseView } from '@/components/primitives/SuspenseView'; export interface WidgetDef { diff --git a/packages/frontend/src/components/domains/dashboard/widgets/announcements.tsx b/packages/frontend/src/components/domains/dashboard/widgets/announcements.tsx index a2b8f9d..81c7f6c 100644 --- a/packages/frontend/src/components/domains/dashboard/widgets/announcements.tsx +++ b/packages/frontend/src/components/domains/dashboard/widgets/announcements.tsx @@ -1,5 +1,4 @@ import dayjs from 'dayjs'; -import { useAtomValue } from 'jotai'; import React, { useMemo } from 'react'; import { Link } from 'react-router-dom'; @@ -8,7 +7,7 @@ import { VStack } from '@/components/layouts/VStack'; import { Badge } from '@/components/primitives/Badge'; import { Text } from '@/components/primitives/Text'; import { styled } from '@/libs/stitches'; -import { announcementListAtom } from '@/store/api/announcements'; +import { trpc } from '@/libs/trpc'; const Container = styled(Link, { display: 'block', @@ -29,7 +28,7 @@ const Title = styled('div', { }); export default widget('announcements', 'ti ti-speakerphone', false, () => { - const announcements = useAtomValue(announcementListAtom); + const [announcements] = trpc.announcements.getAll.useSuspenseQuery(); const data = useMemo(() => announcements.map(d => ({ id: d.id, diff --git a/packages/frontend/src/components/primitives/PopupMenu.tsx b/packages/frontend/src/components/primitives/PopupMenu.tsx index f98887b..76efed0 100644 --- a/packages/frontend/src/components/primitives/PopupMenu.tsx +++ b/packages/frontend/src/components/primitives/PopupMenu.tsx @@ -2,11 +2,10 @@ import * as $ from '@radix-ui/react-dropdown-menu'; import React, { PropsWithChildren } from 'react'; import { Link } from 'react-router-dom'; -import { slideDownAndFade } from '../keyframes/slide-down-and-fade'; -import { slideLeftAndFade } from '../keyframes/slide-left-and-fade'; -import { slideRightAndFade } from '../keyframes/slide-right-and-fade'; -import { slideUpAndFade } from '../keyframes/slide-up-and-fade'; - +import { slideDownAndFade } from '@/components/keyframes/slide-down-and-fade'; +import { slideLeftAndFade } from '@/components/keyframes/slide-left-and-fade'; +import { slideRightAndFade } from '@/components/keyframes/slide-right-and-fade'; +import { slideUpAndFade } from '@/components/keyframes/slide-up-and-fade'; import { css, styled } from '@/libs/stitches'; import { MenuItem } from '@/models/menu'; diff --git a/packages/frontend/src/components/primitives/SuspenseView.tsx b/packages/frontend/src/components/primitives/SuspenseView.tsx index 2179b06..c0b2561 100644 --- a/packages/frontend/src/components/primitives/SuspenseView.tsx +++ b/packages/frontend/src/components/primitives/SuspenseView.tsx @@ -1,9 +1,8 @@ import React, { Suspense } from 'react'; -import { Spinner } from './Spinner'; - import { slideUpAndFade } from '@/components/keyframes/slide-up-and-fade'; import { Centered } from '@/components/layouts/Centered'; +import { Spinner } from '@/components/primitives/Spinner'; import { styled } from '@/libs/stitches'; const Content = styled('div', { diff --git a/packages/frontend/src/global-effects.ts b/packages/frontend/src/global-effects.ts index dc0e969..6e1013e 100644 --- a/packages/frontend/src/global-effects.ts +++ b/packages/frontend/src/global-effects.ts @@ -2,10 +2,9 @@ import { useAtomValue } from 'jotai'; import { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; -import { languageAtom } from './store/client-settings'; - import { globalStyles } from '@/libs/stitches.js'; import { useTheme } from '@/misc/theme.js'; +import { languageAtom } from '@/store/client-settings'; /** * Misskey Tools アプリ全体に及ぶ副作用。 diff --git a/packages/frontend/src/langs/index.ts b/packages/frontend/src/langs/index.ts index a023071..e516d1d 100644 --- a/packages/frontend/src/langs/index.ts +++ b/packages/frontend/src/langs/index.ts @@ -1,13 +1,13 @@ import deepmerge from 'deepmerge'; -import enUS from './en-US.json'; -import itIT from './it-IT.json'; -import jaCR from './ja-cr.json'; -import jaJP from './ja-JP.json'; -import jaKS from './ja-KS.json'; -import koKR from './ko-KR.json'; -import zhCN from './zh-CN.json'; -import zhTW from './zh-TW.json'; +import enUS from '@/langs/en-US.json'; +import itIT from '@/langs/it-IT.json'; +import jaCR from '@/langs/ja-cr.json'; +import jaJP from '@/langs/ja-JP.json'; +import jaKS from '@/langs/ja-KS.json'; +import koKR from '@/langs/ko-KR.json'; +import zhCN from '@/langs/zh-CN.json'; +import zhTW from '@/langs/zh-TW.json'; const merge = (baseData: Record, newData: Record) => { diff --git a/packages/shared/src/types/user.ts b/packages/shared/src/types/user.ts index 710c2bb..fd14d54 100644 --- a/packages/shared/src/types/user.ts +++ b/packages/shared/src/types/user.ts @@ -1,5 +1,5 @@ -import { AlertMode } from './alert-mode.js'; -import { Visibility } from './visibility.js'; +import { AlertMode } from '@/types/alert-mode.js'; +import { Visibility } from '@/types/visibility.js'; export interface IUser { id: number; diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index ce69623..f04e0be 100644 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json @@ -4,6 +4,10 @@ "module": "esnext", "outDir": "./dist/", "rootDir": "./src/", + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } }, "exclude": ["node_modules"], "extends": "tools-tsconfig/base.json",