mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-14 19:31:35 +00:00
Compare commits
8 Commits
shadcn@2.6
...
shadcn@2.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf1851ca09 | ||
|
|
c86c27a2ff | ||
|
|
8847126c65 | ||
|
|
65350857a4 | ||
|
|
40c7473c7e | ||
|
|
4698ee960f | ||
|
|
2ae0e5a07b | ||
|
|
431af4f7ff |
20
.github/workflows/issue-stale.yml
vendored
20
.github/workflows/issue-stale.yml
vendored
@@ -18,15 +18,15 @@ jobs:
|
||||
repo-token: ${{ secrets.STALE_TOKEN }}
|
||||
ascending: true
|
||||
days-before-issue-close: 7
|
||||
days-before-issue-stale: 365 # ~2 years
|
||||
days-before-issue-stale: 365
|
||||
days-before-pr-stale: -1
|
||||
days-before-pr-close: -1
|
||||
remove-issue-stale-when-updated: true
|
||||
stale-issue-label: "stale?"
|
||||
exempt-issue-labels: "roadmap,next,bug"
|
||||
stale-issue-message: "This issue has been automatically marked as stale due to one year of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you."
|
||||
close-issue-message: "This issue has been automatically closed due to one year of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding!"
|
||||
operations-per-run: 300 # 1 operation per 100 issues, the rest is to label/comment/close
|
||||
exempt-issue-labels: "roadmap,next"
|
||||
stale-issue-message: "This issue has been automatically marked as stale due to one year of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you. (This is an automated message)"
|
||||
close-issue-message: "This issue has been automatically closed due to one year of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding! (This is an automated message)"
|
||||
operations-per-run: 300
|
||||
- uses: actions/stale@v9
|
||||
id: pr-state
|
||||
name: "Mark stale PRs, close stale PRs"
|
||||
@@ -36,10 +36,10 @@ jobs:
|
||||
days-before-issue-close: -1
|
||||
days-before-issue-stale: -1
|
||||
days-before-pr-close: 7
|
||||
days-before-pr-stale: 365 # PRs with no activity in over 90 days will be marked as stale
|
||||
days-before-pr-stale: 365
|
||||
remove-pr-stale-when-updated: true
|
||||
exempt-pr-labels: "roadmap,nex,awaiting-approval,work-in-progress"
|
||||
exempt-pr-labels: "roadmap,next,bug"
|
||||
stale-pr-label: "stale?"
|
||||
stale-pr-message: "This PR has been automatically marked as stale due to one year of inactivity. It will be closed in 7 days unless there’s further input. If you believe this PR is still relevant, please leave a comment or provide updated details. Thank you."
|
||||
close-pr-message: "This PR has been automatically closed due to one year of inactivity. Thank you for your understanding!"
|
||||
operations-per-run: 300 # 1 operation per 100 issues, the rest is to label/comment/close
|
||||
stale-pr-message: "This PR has been automatically marked as stale due to one year of inactivity. It will be closed in 7 days unless there’s further input. If you believe this PR is still relevant, please leave a comment or provide updated details. Thank you. (This is an automated message)"
|
||||
close-pr-message: "This PR has been automatically closed due to one year of inactivity. Thank you for your understanding! (This is an automated message)"
|
||||
operations-per-run: 300
|
||||
|
||||
@@ -13,7 +13,7 @@ export function OpenInV0Cta({ className }: React.ComponentProps<"div">) {
|
||||
Deploy your shadcn/ui app on Vercel
|
||||
</div>
|
||||
<div className="text-muted-foreground">
|
||||
Trusted by OpenAI, Sonos, Chick-fil-A, and more.
|
||||
Trusted by OpenAI, Sonos, Adobe, and more.
|
||||
</div>
|
||||
<div className="text-muted-foreground">
|
||||
Vercel provides tools and infrastructure to deploy apps and features at
|
||||
|
||||
@@ -41,7 +41,7 @@ npx shadcn@latest add calendar
|
||||
<Step>Install the following dependencies:</Step>
|
||||
|
||||
```bash
|
||||
npm install react-day-picker@8.10.1 date-fns
|
||||
npm install react-day-picker date-fns
|
||||
```
|
||||
|
||||
<Step>Add the `Button` component to your project.</Step>
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
"recharts": "2.15.1",
|
||||
"rehype-pretty-code": "^0.14.1",
|
||||
"rimraf": "^6.0.1",
|
||||
"shadcn": "2.6.2",
|
||||
"shadcn": "2.6.4",
|
||||
"shiki": "^1.10.1",
|
||||
"sonner": "^2.0.0",
|
||||
"tailwind-merge": "^3.0.1",
|
||||
|
||||
@@ -39,7 +39,7 @@ npx shadcn@latest add calendar
|
||||
<Step>Install the following dependencies:</Step>
|
||||
|
||||
```bash
|
||||
npm install react-day-picker@8.10.1 date-fns
|
||||
npm install react-day-picker date-fns
|
||||
```
|
||||
|
||||
<Step>Add the `Button` component to your project.</Step>
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
"react-resizable-panels": "^2.0.22",
|
||||
"react-wrap-balancer": "^0.4.1",
|
||||
"recharts": "2.12.7",
|
||||
"shadcn": "2.6.2",
|
||||
"shadcn": "2.6.4",
|
||||
"sharp": "^0.32.6",
|
||||
"sonner": "^1.2.3",
|
||||
"swr": "2.2.6-beta.3",
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
{
|
||||
"name": "calendar",
|
||||
"dependencies": [
|
||||
"react-day-picker@8.10.1",
|
||||
"react-day-picker",
|
||||
"date-fns"
|
||||
],
|
||||
"registryDependencies": [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "calendar",
|
||||
"dependencies": [
|
||||
"react-day-picker@8.10.1",
|
||||
"react-day-picker",
|
||||
"date-fns"
|
||||
],
|
||||
"registryDependencies": [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "calendar",
|
||||
"dependencies": [
|
||||
"react-day-picker@8.10.1",
|
||||
"react-day-picker",
|
||||
"date-fns"
|
||||
],
|
||||
"registryDependencies": [
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @shadcn/ui
|
||||
|
||||
## 2.6.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#7601](https://github.com/shadcn-ui/ui/pull/7601) [`c86c27a2ffb8d186770afa42bfb62ab46e3db975`](https://github.com/shadcn-ui/ui/commit/c86c27a2ffb8d186770afa42bfb62ab46e3db975) Thanks [@schiller-manuel](https://github.com/schiller-manuel)! - fix tanstack start detection
|
||||
|
||||
## 2.6.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#7594](https://github.com/shadcn-ui/ui/pull/7594) [`431af4f7ff294af032c0687b8b655ed6db2e690f`](https://github.com/shadcn-ui/ui/commit/431af4f7ff294af032c0687b8b655ed6db2e690f) Thanks [@shadcn](https://github.com/shadcn)! - fix: semicolon in code style
|
||||
|
||||
## 2.6.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "shadcn",
|
||||
"version": "2.6.2",
|
||||
"version": "2.6.4",
|
||||
"description": "Add components to your apps.",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@@ -88,7 +88,7 @@ import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectPrimitive.Root`
|
||||
|
||||
const expected = `import { Dialog as DialogPrimitive, Select as SelectPrimitive } from "radix-ui";
|
||||
const expected = `import { Dialog as DialogPrimitive, Select as SelectPrimitive } from "radix-ui"
|
||||
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectPrimitive.Root`
|
||||
@@ -109,7 +109,7 @@ export const DialogRoot = Root
|
||||
export const DialogTrigger = Trigger
|
||||
export const SelectContent = Content`
|
||||
|
||||
const expected = `import { Root, Trigger, Content } from "radix-ui";
|
||||
const expected = `import { Root, Trigger, Content } from "radix-ui"
|
||||
|
||||
export const DialogRoot = Root
|
||||
export const DialogTrigger = Trigger
|
||||
@@ -131,7 +131,7 @@ import { useState } from "react"
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectRoot`
|
||||
|
||||
const expected = `import { Dialog as DialogPrimitive, Root as SelectRoot } from "radix-ui";
|
||||
const expected = `import { Dialog as DialogPrimitive, Root as SelectRoot } from "radix-ui"
|
||||
|
||||
import { useState } from "react"
|
||||
|
||||
@@ -184,7 +184,7 @@ export const Dialog = DialogPrimitive.Root`
|
||||
|
||||
const expected = `"use client"
|
||||
|
||||
import { Dialog as DialogPrimitive } from "radix-ui";
|
||||
import { Dialog as DialogPrimitive } from "radix-ui"
|
||||
import { useState } from "react"
|
||||
|
||||
export const Dialog = DialogPrimitive.Root`
|
||||
@@ -206,7 +206,7 @@ export const Dialog = DialogPrimitive.Root`
|
||||
|
||||
const expected = `"use client"
|
||||
|
||||
import { DropdownMenu as DropdownMenuPrimitive, Dialog as DialogPrimitive } from "radix-ui";
|
||||
import { DropdownMenu as DropdownMenuPrimitive, Dialog as DialogPrimitive } from "radix-ui"
|
||||
|
||||
import { useState } from "react"
|
||||
|
||||
@@ -228,7 +228,7 @@ import * as SelectPrimitive from '@radix-ui/react-select'
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectPrimitive.Root`
|
||||
|
||||
const expected = `import { Dialog as DialogPrimitive, Select as SelectPrimitive } from 'radix-ui';
|
||||
const expected = `import { Dialog as DialogPrimitive, Select as SelectPrimitive } from 'radix-ui'
|
||||
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectPrimitive.Root`
|
||||
@@ -248,7 +248,7 @@ import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectPrimitive.Root`
|
||||
|
||||
const expected = `import { Dialog as DialogPrimitive, Select as SelectPrimitive } from 'radix-ui';
|
||||
const expected = `import { Dialog as DialogPrimitive, Select as SelectPrimitive } from 'radix-ui'
|
||||
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectPrimitive.Root`
|
||||
@@ -270,7 +270,7 @@ export type MyDialogProps = ComponentProps
|
||||
export type MySelectProps = SelectProps
|
||||
export const Dialog = DialogPrimitive.Root`
|
||||
|
||||
const expected = `import { type ComponentProps, type SelectProps, Root, Dialog as DialogPrimitive } from "radix-ui";
|
||||
const expected = `import { type ComponentProps, type SelectProps, Root, Dialog as DialogPrimitive } from "radix-ui"
|
||||
|
||||
export type MyDialogProps = ComponentProps
|
||||
export type MySelectProps = SelectProps
|
||||
@@ -291,7 +291,7 @@ import { Root, Trigger } from "@radix-ui/react-dialog"
|
||||
export type Props = DialogProps
|
||||
export const DialogRoot = Root`
|
||||
|
||||
const expected = `import { type DialogProps, Root, Trigger } from "radix-ui";
|
||||
const expected = `import { type DialogProps, Root, Trigger } from "radix-ui"
|
||||
|
||||
export type Props = DialogProps
|
||||
export const DialogRoot = Root`
|
||||
@@ -308,7 +308,7 @@ import * as DialogPrimitive from "@radix-ui/react-dialog"
|
||||
export type Props = DialogTypes.ComponentProps
|
||||
export const Dialog = DialogPrimitive.Root`
|
||||
|
||||
const expected = `import { type Dialog as DialogTypes, Dialog as DialogPrimitive } from "radix-ui";
|
||||
const expected = `import { type Dialog as DialogTypes, Dialog as DialogPrimitive } from "radix-ui"
|
||||
|
||||
export type Props = DialogTypes.ComponentProps
|
||||
export const Dialog = DialogPrimitive.Root`
|
||||
@@ -327,7 +327,7 @@ export const Dialog = DialogPrimitive.Root
|
||||
export const ChevronDown = ChevronDownIcon`
|
||||
|
||||
const expected = `import { ChevronDownIcon, Cross2Icon } from "@radix-ui/react-icons"
|
||||
import { Dialog as DialogPrimitive, Root } from "radix-ui";
|
||||
import { Dialog as DialogPrimitive, Root } from "radix-ui"
|
||||
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const ChevronDown = ChevronDownIcon`
|
||||
@@ -349,7 +349,7 @@ export type MyIconProps = IconProps
|
||||
export type MyDialogProps = ComponentProps`
|
||||
|
||||
const expected = `import type { IconProps } from "@radix-ui/react-icons/dist/types"
|
||||
import { type ComponentProps, Root } from "radix-ui";
|
||||
import { type ComponentProps, Root } from "radix-ui"
|
||||
|
||||
export type MyIconProps = IconProps
|
||||
export type MyDialogProps = ComponentProps`
|
||||
@@ -373,7 +373,7 @@ export type Props = IconProps`
|
||||
const expected = `import * as Icons from "@radix-ui/react-icons"
|
||||
import { ChevronDownIcon } from "@radix-ui/react-icons"
|
||||
import type { IconProps } from "@radix-ui/react-icons/dist/types"
|
||||
import { Dialog as DialogPrimitive, Root } from "radix-ui";
|
||||
import { Dialog as DialogPrimitive, Root } from "radix-ui"
|
||||
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Icon = ChevronDownIcon
|
||||
@@ -401,7 +401,7 @@ import {
|
||||
export const DialogRoot = Root
|
||||
export const SelectValue = Value`
|
||||
|
||||
const expected = `import { Root, Trigger, Content, Value, Item } from "radix-ui";
|
||||
const expected = `import { Root, Trigger, Content, Value, Item } from "radix-ui"
|
||||
|
||||
export const DialogRoot = Root
|
||||
export const SelectValue = Value`
|
||||
@@ -425,7 +425,7 @@ import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
export const Dialog = DialogRoot
|
||||
export const Select = SelectPrimitive.Root`
|
||||
|
||||
const expected = `import { Root as DialogRoot, Trigger, Content, Select as SelectPrimitive } from "radix-ui";
|
||||
const expected = `import { Root as DialogRoot, Trigger, Content, Select as SelectPrimitive } from "radix-ui"
|
||||
|
||||
export const Dialog = DialogRoot
|
||||
export const Select = SelectPrimitive.Root`
|
||||
@@ -450,7 +450,7 @@ import {
|
||||
|
||||
export type Props = DialogProps`
|
||||
|
||||
const expected = `import { type ComponentProps, type DialogProps, type SelectProps, Root } from "radix-ui";
|
||||
const expected = `import { type ComponentProps, type DialogProps, type SelectProps, Root } from "radix-ui"
|
||||
|
||||
export type Props = DialogProps`
|
||||
|
||||
@@ -472,7 +472,7 @@ export type Props = DialogProps`
|
||||
|
||||
export const DialogRoot = Root`
|
||||
|
||||
const expected = `import { Root, Trigger, Content } from "radix-ui";
|
||||
const expected = `import { Root, Trigger, Content } from "radix-ui"
|
||||
|
||||
export const DialogRoot = Root`
|
||||
|
||||
@@ -490,7 +490,7 @@ export const DialogRoot = Root`
|
||||
|
||||
export const DialogRoot = Root`
|
||||
|
||||
const expected = `import { Root, Trigger, Content } from "radix-ui";
|
||||
const expected = `import { Root, Trigger, Content } from "radix-ui"
|
||||
|
||||
export const DialogRoot = Root`
|
||||
|
||||
@@ -532,7 +532,7 @@ export const Accordion = AccordionPrimitive.Root
|
||||
export const AlertDialog = AlertDialogPrimitive.Root
|
||||
export const Button = Slot`
|
||||
|
||||
const expected = `import { Accordion as AccordionPrimitive, AlertDialog as AlertDialogPrimitive, AspectRatio as AspectRatioPrimitive, Avatar as AvatarPrimitive, Slot as SlotPrimitive, Checkbox as CheckboxPrimitive, Collapsible as CollapsiblePrimitive, ContextMenu as ContextMenuPrimitive, Dialog as DialogPrimitive, DropdownMenu as DropdownMenuPrimitive, HoverCard as HoverCardPrimitive, Label as LabelPrimitive, Menubar as MenubarPrimitive, NavigationMenu as NavigationMenuPrimitive, Popover as PopoverPrimitive, Progress as ProgressPrimitive, RadioGroup as RadioGroupPrimitive, ScrollArea as ScrollAreaPrimitive, Select as SelectPrimitive, Separator as SeparatorPrimitive, Slider as SliderPrimitive, Switch as SwitchPrimitive, Tabs as TabsPrimitive, Toggle as TogglePrimitive, ToggleGroup as ToggleGroupPrimitive, Tooltip as TooltipPrimitive } from "radix-ui";
|
||||
const expected = `import { Accordion as AccordionPrimitive, AlertDialog as AlertDialogPrimitive, AspectRatio as AspectRatioPrimitive, Avatar as AvatarPrimitive, Slot as SlotPrimitive, Checkbox as CheckboxPrimitive, Collapsible as CollapsiblePrimitive, ContextMenu as ContextMenuPrimitive, Dialog as DialogPrimitive, DropdownMenu as DropdownMenuPrimitive, HoverCard as HoverCardPrimitive, Label as LabelPrimitive, Menubar as MenubarPrimitive, NavigationMenu as NavigationMenuPrimitive, Popover as PopoverPrimitive, Progress as ProgressPrimitive, RadioGroup as RadioGroupPrimitive, ScrollArea as ScrollAreaPrimitive, Select as SelectPrimitive, Separator as SeparatorPrimitive, Slider as SliderPrimitive, Switch as SwitchPrimitive, Tabs as TabsPrimitive, Toggle as TogglePrimitive, ToggleGroup as ToggleGroupPrimitive, Tooltip as TooltipPrimitive } from "radix-ui"
|
||||
|
||||
export const Accordion = AccordionPrimitive.Root
|
||||
export const AlertDialog = AlertDialogPrimitive.Root
|
||||
@@ -578,7 +578,7 @@ import { cn } from "@/lib/utils"
|
||||
export const Sheet = SheetPrimitive.Root
|
||||
export const SheetTrigger = SheetPrimitive.Trigger`
|
||||
|
||||
const expected = `import { Dialog as SheetPrimitive } from "radix-ui";
|
||||
const expected = `import { Dialog as SheetPrimitive } from "radix-ui"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
export const Sheet = SheetPrimitive.Root
|
||||
@@ -597,7 +597,7 @@ import { Slot } from "@radix-ui/react-slot"
|
||||
export const FormLabel = LabelPrimitive.Root
|
||||
export const FormControl = Slot`
|
||||
|
||||
const expected = `import { Label as LabelPrimitive, Slot as SlotPrimitive } from "radix-ui";
|
||||
const expected = `import { Label as LabelPrimitive, Slot as SlotPrimitive } from "radix-ui"
|
||||
|
||||
export const FormLabel = LabelPrimitive.Root
|
||||
export const FormControl = SlotPrimitive.Slot`
|
||||
@@ -664,7 +664,7 @@ export const FormControl = SlotPrimitive.Slot`
|
||||
expect(result.replacedPackages.sort()).toEqual(allPackages.sort())
|
||||
|
||||
// Should be a single unified import from radix-ui
|
||||
expect(result.content).toContain('from "radix-ui";')
|
||||
expect(result.content).toContain('from "radix-ui"')
|
||||
expect(result.content.startsWith("import {")).toBe(true)
|
||||
expect(result.content).toContain("Slot as SlotPrimitive") // Slot should be aliased as SlotPrimitive
|
||||
expect(result.content).toContain("Accordion as AccordionPrimitive") // Namespace should be aliased
|
||||
@@ -685,7 +685,7 @@ const Button = ({ asChild, children }) => {
|
||||
return <Comp>{children}</Comp>
|
||||
}`
|
||||
|
||||
const expected = `import { Slot as SlotPrimitive } from "radix-ui";
|
||||
const expected = `import { Slot as SlotPrimitive } from "radix-ui"
|
||||
|
||||
const Button = ({ asChild, children }) => {
|
||||
const Comp = asChild ? SlotPrimitive.Slot : "button"
|
||||
@@ -708,7 +708,7 @@ const Button = ({ asChild }) => {
|
||||
return null
|
||||
}`
|
||||
|
||||
const expected = `import { Slot as SlotPrimitive } from "radix-ui";
|
||||
const expected = `import { Slot as SlotPrimitive } from "radix-ui"
|
||||
|
||||
const Button = ({ asChild }) => {
|
||||
const Comp1 = asChild ? SlotPrimitive.Slot : "button"
|
||||
@@ -731,7 +731,7 @@ const Button = ({ asChild }) => {
|
||||
return null
|
||||
}`
|
||||
|
||||
const expected = `import { Slot as SlotComponent } from "radix-ui";
|
||||
const expected = `import { Slot as SlotComponent } from "radix-ui"
|
||||
|
||||
const Button = ({ asChild }) => {
|
||||
const Comp = asChild ? Slot : "button"
|
||||
@@ -754,7 +754,7 @@ const Button = ({ asChild }) => {
|
||||
return <Slot />
|
||||
}`
|
||||
|
||||
const expected = `import { Slot as SlotPrimitive } from "radix-ui";
|
||||
const expected = `import { Slot as SlotPrimitive } from "radix-ui"
|
||||
|
||||
const Button = ({ asChild }) => {
|
||||
const SlotName = "Slot"
|
||||
@@ -781,7 +781,7 @@ const Button = ({ asChild, ...props }: ButtonProps) => {
|
||||
return <Comp {...props} />
|
||||
}`
|
||||
|
||||
const expected = `import { Slot as SlotPrimitive } from "radix-ui";
|
||||
const expected = `import { Slot as SlotPrimitive } from "radix-ui"
|
||||
import React from "react"
|
||||
|
||||
type ButtonProps = React.ComponentProps<typeof SlotPrimitive.Slot> & {
|
||||
@@ -811,7 +811,7 @@ const Button = ({ asChild, ...props }: ButtonProps) => {
|
||||
return <Comp {...props} />
|
||||
}`
|
||||
|
||||
const expected = `import { Slot as SlotPrimitive } from "radix-ui";
|
||||
const expected = `import { Slot as SlotPrimitive } from "radix-ui"
|
||||
import { ComponentProps } from "react"
|
||||
|
||||
type ButtonProps = ComponentProps<typeof SlotPrimitive.Slot> & {
|
||||
@@ -827,6 +827,46 @@ const Button = ({ asChild, ...props }: ButtonProps) => {
|
||||
expect(result.content.trim()).toBe(expected.trim())
|
||||
expect(result.replacedPackages).toEqual(["@radix-ui/react-slot"])
|
||||
})
|
||||
|
||||
it("should not add double semicolons when import already ends with semicolon", async () => {
|
||||
const input = `import * as DialogPrimitive from "@radix-ui/react-dialog";
|
||||
import * as SelectPrimitive from "@radix-ui/react-select";
|
||||
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectPrimitive.Root`
|
||||
|
||||
const expected = `import { Dialog as DialogPrimitive, Select as SelectPrimitive } from "radix-ui";
|
||||
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectPrimitive.Root`
|
||||
|
||||
const result = await migrateRadixFile(input)
|
||||
expect(result.content.trim()).toBe(expected.trim())
|
||||
expect(result.replacedPackages).toEqual([
|
||||
"@radix-ui/react-dialog",
|
||||
"@radix-ui/react-select",
|
||||
])
|
||||
})
|
||||
|
||||
it("should not add semicolon when original imports don't have semicolons", async () => {
|
||||
const input = `import * as DialogPrimitive from "@radix-ui/react-dialog"
|
||||
import * as SelectPrimitive from "@radix-ui/react-select"
|
||||
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectPrimitive.Root`
|
||||
|
||||
const expected = `import { Dialog as DialogPrimitive, Select as SelectPrimitive } from "radix-ui"
|
||||
|
||||
export const Dialog = DialogPrimitive.Root
|
||||
export const Select = SelectPrimitive.Root`
|
||||
|
||||
const result = await migrateRadixFile(input)
|
||||
expect(result.content.trim()).toBe(expected.trim())
|
||||
expect(result.replacedPackages).toEqual([
|
||||
"@radix-ui/react-dialog",
|
||||
"@radix-ui/react-select",
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe("migrateRadix - package.json updates", () => {
|
||||
|
||||
@@ -215,13 +215,15 @@ export async function migrateRadixFile(
|
||||
content: string
|
||||
): Promise<{ content: string; replacedPackages: string[] }> {
|
||||
// Enhanced regex to handle type-only imports, but exclude react-icons
|
||||
// Also capture optional semicolon at the end
|
||||
const radixImportPattern =
|
||||
/import\s+(?:(type)\s+)?(?:\*\s+as\s+(\w+)|{([^}]+)})\s+from\s+(["'])@radix-ui\/react-([^"']+)\4/g
|
||||
/import\s+(?:(type)\s+)?(?:\*\s+as\s+(\w+)|{([^}]+)})\s+from\s+(["'])@radix-ui\/react-([^"']+)\4(;?)/g
|
||||
|
||||
const imports: Array<{ name: string; alias?: string; isType?: boolean }> = []
|
||||
const linesToRemove: string[] = []
|
||||
const replacedPackages: string[] = []
|
||||
let quoteStyle = '"' // Default to double quotes
|
||||
let hasSemicolon = false // Track if any import had a semicolon
|
||||
|
||||
let result = content
|
||||
let match
|
||||
@@ -235,6 +237,7 @@ export async function migrateRadixFile(
|
||||
namedImports,
|
||||
quote,
|
||||
packageName,
|
||||
semicolon,
|
||||
] = match
|
||||
|
||||
// Skip react-icons package and any sub-paths (like react-icons/dist/types)
|
||||
@@ -244,9 +247,10 @@ export async function migrateRadixFile(
|
||||
|
||||
linesToRemove.push(fullMatch)
|
||||
|
||||
// Use the quote style from the first import
|
||||
// Use the quote style and semicolon style from the first import
|
||||
if (linesToRemove.length === 1) {
|
||||
quoteStyle = quote
|
||||
hasSemicolon = semicolon === ";"
|
||||
}
|
||||
|
||||
// Track which package we're replacing
|
||||
@@ -301,7 +305,9 @@ export async function migrateRadixFile(
|
||||
})
|
||||
.join(", ")
|
||||
|
||||
const unifiedImport = `import { ${importList} } from ${quoteStyle}radix-ui${quoteStyle};`
|
||||
const unifiedImport = `import { ${importList} } from ${quoteStyle}radix-ui${quoteStyle}${
|
||||
hasSemicolon ? ";" : ""
|
||||
}`
|
||||
|
||||
// Replace first import with unified import, remove the rest
|
||||
result = linesToRemove.reduce((acc, line, index) => {
|
||||
|
||||
@@ -121,11 +121,10 @@ export async function getProjectInfo(cwd: string): Promise<ProjectInfo | null> {
|
||||
|
||||
// TanStack Start.
|
||||
if (
|
||||
configFiles.find((file) => file.startsWith("app.config."))?.length &&
|
||||
[
|
||||
...Object.keys(packageJson?.dependencies ?? {}),
|
||||
...Object.keys(packageJson?.devDependencies ?? {}),
|
||||
].find((dep) => dep.startsWith("@tanstack/start"))
|
||||
].find((dep) => dep.startsWith("@tanstack/react-start"))
|
||||
) {
|
||||
type.framework = FRAMEWORKS["tanstack-start"]
|
||||
return type
|
||||
|
||||
4
pnpm-lock.yaml
generated
4
pnpm-lock.yaml
generated
@@ -322,7 +322,7 @@ importers:
|
||||
specifier: ^6.0.1
|
||||
version: 6.0.1
|
||||
shadcn:
|
||||
specifier: 2.6.2
|
||||
specifier: 2.6.4
|
||||
version: link:../../packages/shadcn
|
||||
shiki:
|
||||
specifier: ^1.10.1
|
||||
@@ -602,7 +602,7 @@ importers:
|
||||
specifier: 2.12.7
|
||||
version: 2.12.7(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
shadcn:
|
||||
specifier: 2.6.2
|
||||
specifier: 2.6.4
|
||||
version: link:../../packages/shadcn
|
||||
sharp:
|
||||
specifier: ^0.32.6
|
||||
|
||||
3
templates/monorepo-next/.vscode/settings.json
vendored
Normal file
3
templates/monorepo-next/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"tailwindCSS.experimental.configFile": "packages/ui/src/styles/globals.css"
|
||||
}
|
||||
Reference in New Issue
Block a user