Skip to content

Commit 605ffa2

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 605ffa2

23 files changed

Lines changed: 39 additions & 21 deletions

packages/shared/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,37 @@
3636
},
3737
"./components/ui/*": {
3838
"types": "./dist/components/ui/*/index.d.ts",
39+
"svelte": "./src/lib/components/ui/*/index.ts",
3940
"default": "./dist/components/ui/*/index.js"
4041
},
4142
"./composables/*": {
4243
"types": "./dist/composables/*.d.ts",
44+
"svelte": "./src/lib/composables/*.ts",
4345
"default": "./dist/composables/*.js"
4446
},
4547
"./constants/*": {
4648
"types": "./dist/constants/*.d.ts",
49+
"svelte": "./src/lib/constants/*.ts",
4750
"default": "./dist/constants/*.js"
4851
},
4952
"./helpers/*": {
5053
"types": "./dist/helpers/*.d.ts",
54+
"svelte": "./src/lib/helpers/*.ts",
5155
"default": "./dist/helpers/*.js"
5256
},
5357
"./schemas/*": {
5458
"types": "./dist/schemas/*.d.ts",
59+
"svelte": "./src/lib/schemas/*.ts",
5560
"default": "./dist/schemas/*.js"
5661
},
5762
"./types/*": {
5863
"types": "./dist/types/*.d.ts",
64+
"svelte": "./src/lib/types/*.ts",
5965
"default": "./dist/types/*.js"
6066
},
6167
"./utils/*": {
6268
"types": "./dist/utils/*.d.ts",
69+
"svelte": "./src/lib/utils/*.ts",
6370
"default": "./dist/utils/*.js"
6471
}
6572
},

packages/shared/src/lib/components/ModeSwitcherButton.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 MoonIcon from '@lucide/svelte/icons/moon';
33
import SunIcon from '@lucide/svelte/icons/sun';
4-
import { Button } from '@repo/shared/components/ui/button';
4+
import { Button } from './ui/button/index.js';
55
import { toggleMode } from 'mode-watcher';
66
</script>
77

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)