Skip to content

Commit 70eea05

Browse files
committed
fix: update component URL fetching logic
1 parent 28815b1 commit 70eea05

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/commands/init.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
possibilityUtilsPath,
2626
} from "@/utils/helpers"
2727
import { error, grayText, highlight, info } from "@/utils/logging"
28-
import { getRepoUrlForComponent } from "@/utils/repo"
28+
import { getPrimitiveComponentUrl } from "@/utils/repo"
2929
import ora from "ora"
3030
import stripJsonComments from "strip-json-comments"
3131

@@ -302,7 +302,7 @@ export async function init(flags: {
302302
})
303303
})
304304

305-
const fileUrl = getRepoUrlForComponent("primitive", "intentui")
305+
const fileUrl = getPrimitiveComponentUrl()
306306
const response = await fetch(fileUrl)
307307

308308
if (!response.ok) throw new Error(`Failed to fetch component: ${response.statusText}`)

src/utils/repo.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ export const getThemesRepoUrl = (gray: string): string => {
2929
return selectedGray
3030
}
3131

32+
/**
33+
* This function is used to get the URL for the primitive.tsx component
34+
* @returns string
35+
*/
36+
export const getPrimitiveComponentUrl = () => {
37+
if(branchWorkingOn === "1.x") return getRepoUrlForComponent("primitive", "intentui")
38+
return `${REPO}/${BRANCH}/lib/primitive.tsx`
39+
}
40+
3241
/**
3342
* This function is used to get the URL for a component
3443
* @param componentName string

0 commit comments

Comments
 (0)