Skip to content

Commit 4de2349

Browse files
committed
🔧 Replace $lib alias with relative paths in shared package
- @sveltejs/package does not resolve $lib alias when imported by other packages - Convert all $lib imports to relative paths for proper resolution - Add Vite alias configuration for development - Update turbo.json to ensure shared package builds before web app
1 parent 1d509b8 commit 4de2349

23 files changed

Lines changed: 42 additions & 22 deletions

packages/shared/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,42 @@
3232
"./app.css": "./src/app.css",
3333
"./components/*.svelte": {
3434
"types": "./dist/components/*.svelte.d.ts",
35-
"svelte": "./dist/components/*.svelte"
35+
"svelte": "./src/lib/components/*.svelte",
36+
"default": "./dist/components/*.svelte"
3637
},
3738
"./components/ui/*": {
3839
"types": "./dist/components/ui/*/index.d.ts",
40+
"svelte": "./src/lib/components/ui/*/index.ts",
3941
"default": "./dist/components/ui/*/index.js"
4042
},
4143
"./composables/*": {
4244
"types": "./dist/composables/*.d.ts",
45+
"svelte": "./src/lib/composables/*.ts",
4346
"default": "./dist/composables/*.js"
4447
},
4548
"./constants/*": {
4649
"types": "./dist/constants/*.d.ts",
50+
"svelte": "./src/lib/constants/*.ts",
4751
"default": "./dist/constants/*.js"
4852
},
4953
"./helpers/*": {
5054
"types": "./dist/helpers/*.d.ts",
55+
"svelte": "./src/lib/helpers/*.ts",
5156
"default": "./dist/helpers/*.js"
5257
},
5358
"./schemas/*": {
5459
"types": "./dist/schemas/*.d.ts",
60+
"svelte": "./src/lib/schemas/*.ts",
5561
"default": "./dist/schemas/*.js"
5662
},
5763
"./types/*": {
5864
"types": "./dist/types/*.d.ts",
65+
"svelte": "./src/lib/types/*.ts",
5966
"default": "./dist/types/*.js"
6067
},
6168
"./utils/*": {
6269
"types": "./dist/utils/*.d.ts",
70+
"svelte": "./src/lib/utils/*.ts",
6371
"default": "./dist/utils/*.js"
6472
}
6573
},

packages/shared/src/lib/components/ModeSwitcherButton.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<script lang="ts">
22
import MoonIcon from '@lucide/svelte/icons/moon';
33
import SunIcon from '@lucide/svelte/icons/sun';
4-
import { Button } from '@repo/shared/components/ui/button';
54
import { toggleMode } from 'mode-watcher';
5+
6+
import { Button } from './ui/button/index.js';
67
</script>
78

89
<Button onclick={toggleMode} variant="outline" size="icon">

packages/shared/src/lib/components/ui/button/button.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
33
import { tv, type VariantProps } from 'tailwind-variants';
44
5-
import { cn, type WithElementRef } from '$lib/utils/shadcnUtils.js';
5+
import { cn, type WithElementRef } from '../../../utils/shadcnUtils.js';
66
77
export const buttonVariants = tv({
88
base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",

packages/shared/src/lib/components/ui/card/card-action.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import type { HTMLAttributes } from 'svelte/elements';
33
4-
import { cn, type WithElementRef } from '$lib/utils/shadcnUtils.js';
4+
import { cn, type WithElementRef } from '../../../utils/shadcnUtils.js';
55
66
let {
77
ref = $bindable(null),

packages/shared/src/lib/components/ui/card/card-content.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import type { HTMLAttributes } from 'svelte/elements';
33
4-
import { cn, type WithElementRef } from '$lib/utils/shadcnUtils.js';
4+
import { cn, type WithElementRef } from '../../../utils/shadcnUtils.js';
55
66
let {
77
ref = $bindable(null),

packages/shared/src/lib/components/ui/card/card-description.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import type { HTMLAttributes } from 'svelte/elements';
33
4-
import { cn, type WithElementRef } from '$lib/utils/shadcnUtils.js';
4+
import { cn, type WithElementRef } from '../../../utils/shadcnUtils.js';
55
66
let {
77
ref = $bindable(null),

packages/shared/src/lib/components/ui/card/card-footer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import type { HTMLAttributes } from 'svelte/elements';
33
4-
import { cn, type WithElementRef } from '$lib/utils/shadcnUtils.js';
4+
import { cn, type WithElementRef } from '../../../utils/shadcnUtils.js';
55
66
let {
77
ref = $bindable(null),

packages/shared/src/lib/components/ui/card/card-header.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import type { HTMLAttributes } from 'svelte/elements';
33
4-
import { cn, type WithElementRef } from '$lib/utils/shadcnUtils.js';
4+
import { cn, type WithElementRef } from '../../../utils/shadcnUtils.js';
55
66
let {
77
ref = $bindable(null),

packages/shared/src/lib/components/ui/card/card-title.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import type { HTMLAttributes } from 'svelte/elements';
33
4-
import { cn, type WithElementRef } from '$lib/utils/shadcnUtils.js';
4+
import { cn, type WithElementRef } from '../../../utils/shadcnUtils.js';
55
66
let {
77
ref = $bindable(null),

packages/shared/src/lib/components/ui/card/card.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import type { HTMLAttributes } from 'svelte/elements';
33
4-
import { cn, type WithElementRef } from '$lib/utils/shadcnUtils.js';
4+
import { cn, type WithElementRef } from '../../../utils/shadcnUtils.js';
55
66
let {
77
ref = $bindable(null),

0 commit comments

Comments
 (0)