Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iipanda committed Oct 26, 2024
1 parent 1b5a6ac commit 051edc7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/www/lib/rehype-npm-command.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/* eslint-disable turbo/no-undeclared-env-vars */
import { UnistNode, UnistTree } from "types/unist"
import { visit } from "unist-util-visit"

import { siteConfig } from "@/config/site"
const SITE_URL = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: "https://shadcn-chatbot-kit.vercel.app"

export function rehypeNpmCommand() {
return (tree: UnistTree) => {
Expand Down Expand Up @@ -54,7 +57,7 @@ export function rehypeNpmCommand() {
const npmCommand = node.properties?.["__rawString__"]
const parts = npmCommand.split(" ")
const componentName = parts.pop()
parts.push(`${siteConfig.url}/r/${componentName}.json`)
parts.push(`${SITE_URL}/r/${componentName}.json`)
const modifiedCommand = parts.join(" ")

node.properties["__npmCommand__"] = modifiedCommand
Expand Down

0 comments on commit 051edc7

Please sign in to comment.