diff --git a/packages/shared/package.json b/packages/shared/package.json index 61866ae7c..455134555 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -2,5 +2,9 @@ "name": "@genarrative/shared", "private": true, "version": "0.1.0", - "type": "module" + "type": "module", + "exports": { + ".": "./src/index.ts" + }, + "types": "./src/index.ts" } diff --git a/packages/shared/src/components/PlatformMudPointWalletEntry.test.tsx b/packages/shared/src/components/PlatformMudPointWalletEntry.test.tsx index 25070c10a..01edad980 100644 --- a/packages/shared/src/components/PlatformMudPointWalletEntry.test.tsx +++ b/packages/shared/src/components/PlatformMudPointWalletEntry.test.tsx @@ -4,7 +4,7 @@ import { act, fireEvent, render, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { expect, test, vi } from 'vitest'; -import { formatMudPointCount } from '../index'; +import { formatMudPointCount } from '@genarrative/shared'; import { PlatformMudPointWalletEntry } from './PlatformMudPointWalletEntry.tsx'; const breakdown = { diff --git a/packages/shared/src/components/PlatformMudPointWalletEntry.tsx b/packages/shared/src/components/PlatformMudPointWalletEntry.tsx index 3b519f9b7..4128cd48e 100644 --- a/packages/shared/src/components/PlatformMudPointWalletEntry.tsx +++ b/packages/shared/src/components/PlatformMudPointWalletEntry.tsx @@ -8,9 +8,9 @@ import { useState, } from 'react'; -import type { ProfileMudPointBalance } from '@/packages/shared/src'; -import MUD_POINT_ICON_SRC from '@/packages/shared/src/icons/topbar-wallet.png'; -import { formatMudPointCount } from '@/packages/shared/src/utils/format'; +import type { ProfileMudPointBalance } from '../index'; +import MUD_POINT_ICON_SRC from '../icons/topbar-wallet.png'; +import { formatMudPointCount } from '../utils/format'; export type PlatformMudPointWalletEntryProps = { balance: number | null; diff --git a/src/components/image-editor/ImageCanvasTopbarView.tsx b/src/components/image-editor/ImageCanvasTopbarView.tsx index 113059241..606ab3fb6 100644 --- a/src/components/image-editor/ImageCanvasTopbarView.tsx +++ b/src/components/image-editor/ImageCanvasTopbarView.tsx @@ -8,7 +8,7 @@ import { } from 'lucide-react'; import type { ProfileMudPointBalance } from '../../../packages/shared/src/contracts/runtime'; -import { PlatformMudPointWalletEntry } from '@/packages/shared/src'; +import { PlatformMudPointWalletEntry } from '@genarrative/shared'; import { PlatformStatusMessage } from '../common/PlatformStatusMessage'; import { PlatformTextField } from '../common/PlatformTextField'; import { EditorIconButton } from './ImageCanvasEditorPrimitives'; diff --git a/src/components/platform-entry/PlatformProfileRechargeModal.tsx b/src/components/platform-entry/PlatformProfileRechargeModal.tsx index deb8f3f87..1d535ec70 100644 --- a/src/components/platform-entry/PlatformProfileRechargeModal.tsx +++ b/src/components/platform-entry/PlatformProfileRechargeModal.tsx @@ -15,7 +15,7 @@ import { PlatformSubpanel } from '../common/PlatformSubpanel'; import { formatRechargePrice } from '../rpg-entry/rpgEntryProfileFundsViewModel'; import { PlatformProfileModalShell } from './PlatformProfileModalShell'; import type { NativeWechatPaymentState } from './usePlatformProfileCenterController'; -import { formatMudPointCount } from '@/packages/shared/src'; +import { formatMudPointCount } from '@genarrative/shared'; const WECHAT_NATIVE_PAY_QR_IMAGE_SIZE = 180; export type PlatformProfileRechargeModalProps = { diff --git a/src/components/rpg-entry/RpgEntryHomeView.tsx b/src/components/rpg-entry/RpgEntryHomeView.tsx index 6f17ea58e..7d00dae74 100644 --- a/src/components/rpg-entry/RpgEntryHomeView.tsx +++ b/src/components/rpg-entry/RpgEntryHomeView.tsx @@ -89,7 +89,7 @@ import { PlatformAsyncStatePanel } from '../common/PlatformAsyncStatePanel'; import { PlatformEmptyState } from '../common/PlatformEmptyState'; import { PlatformFilterToolbar } from '../common/PlatformFilterToolbar'; import { PlatformIconButton } from '../common/PlatformIconButton'; -import { PlatformMudPointWalletEntry } from '@/packages/shared/src'; +import { PlatformMudPointWalletEntry } from '@genarrative/shared'; import { PlatformNavigableListItem } from '../common/PlatformNavigableListItem'; import { PlatformPillBadge } from '../common/PlatformPillBadge'; import { diff --git a/tsconfig.json b/tsconfig.json index fb623bd18..42f06c521 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,6 +19,9 @@ "paths": { "@/*": [ "./*" + ], + "@genarrative/shared": [ + "./packages/shared/src/index.ts" ] }, "allowImportingTsExtensions": true, diff --git a/vite.config.ts b/vite.config.ts index afe9b24a4..fdfa8ade2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -53,6 +53,7 @@ export default defineConfig(({mode}) => { resolve: { alias: { '@': path.resolve(__dirname, '.'), + '@genarrative/shared': path.resolve(__dirname, 'packages/shared/src/index.ts'), }, }, optimizeDeps: { diff --git a/vitest.config.ts b/vitest.config.ts index 30f506d44..df50756c6 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -7,6 +7,7 @@ export default defineConfig({ alias: { // Keep shared components' application-root imports resolvable in tests. '@': path.resolve(__dirname, '.'), + '@genarrative/shared': path.resolve(__dirname, 'packages/shared/src/index.ts'), }, }, test: {