Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(transform): Support aliases that are longer than one character #5678

Merged
merged 4 commits into from
Nov 12, 2024

Conversation

Tobbe
Copy link
Contributor

@Tobbe Tobbe commented Nov 2, 2024

Trying to add a component generated by v0 I noticed that my import aliases were wrong. This PR fixes that for me.

This is the json that v0 gave me

{
  "name": "b_5IaISTjKuul",
  "type": "registry:block",
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [],
  "files": [
    {
      "path": "components/app-architecture-accessibility-page.tsx",
      "type": "registry:block",
      "content": "'use client'\n\nimport DocLayout from \"@/components/doc-layout\"\n\nexport function Page() {\n  return (\n    \u003CDocLayout title=\"Accessibility\" section=\"Architecture\"\u003E\n      \u003Cp\u003EThis is the accessibility page. Add your content about accessibility features here.\u003C/p\u003E\n    \u003C/DocLayout\u003E\n  )\n}"
    }
  ],
  "tailwind": {

  },
  "cssVars": {

  },
  "meta": {
    "importSpecifier": "Page",
    "moduleSpecifier": "@/components/app-architecture-accessibility-page"
  },
  "docs": "Please review v0-generated code before incorporating it into your project to ensure completeness and accuracy."
}

Without fix:
import DocLayout from "@/components/doc-layout"

With fix:
import DocLayout from "@shad/components/doc-layout"

Copy link

vercel bot commented Nov 2, 2024

@Tobbe is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Nov 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
ui ⬜️ Ignored (Inspect) Visit Preview Nov 12, 2024 6:10pm

@shadcn shadcn merged commit fb36ca4 into shadcn-ui:main Nov 12, 2024
6 checks passed
@Tobbe Tobbe deleted the tobbe-local-import-alias-word branch November 12, 2024 18:30
niktekusho pushed a commit to niktekusho/shadcnui that referenced this pull request Nov 21, 2024
…hadcn-ui#5678)

* fix(transform): Support aliases that are longer than one character

* feat(shadcn): update handling of aliases

* chore: add changeset

---------

Co-authored-by: shadcn <m@shadcn.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants