mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-30 16:14:13 +00:00
fix(shadcn): init with src (#4731)
* fix(shadcn): init with src * chore: add changesets
This commit is contained in:
5
.changeset/odd-swans-burn.md
Normal file
5
.changeset/odd-swans-burn.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"shadcn": patch
|
||||
---
|
||||
|
||||
fix routes for src dir
|
||||
@@ -1,6 +1,7 @@
|
||||
import { existsSync, promises as fs } from "fs"
|
||||
import path, { basename } from "path"
|
||||
import { Config } from "@/src/utils/get-config"
|
||||
import { getProjectInfo } from "@/src/utils/get-project-info"
|
||||
import { highlighter } from "@/src/utils/highlighter"
|
||||
import { logger } from "@/src/utils/logger"
|
||||
import {
|
||||
@@ -37,7 +38,12 @@ export async function updateFiles(
|
||||
const filesCreatedSpinner = spinner(`Updating files.`, {
|
||||
silent: options.silent,
|
||||
})?.start()
|
||||
const baseColor = await getRegistryBaseColor(config.tailwind.baseColor)
|
||||
|
||||
const [projectInfo, baseColor] = await Promise.all([
|
||||
getProjectInfo(config.resolvedPaths.cwd),
|
||||
getRegistryBaseColor(config.tailwind.baseColor),
|
||||
])
|
||||
|
||||
const filesCreated = []
|
||||
const filesUpdated = []
|
||||
const filesSkipped = []
|
||||
@@ -52,7 +58,9 @@ export async function updateFiles(
|
||||
let filePath = path.join(targetDir, fileName)
|
||||
|
||||
if (file.target) {
|
||||
filePath = path.join(config.resolvedPaths.cwd, file.target)
|
||||
filePath = projectInfo?.isSrcDir
|
||||
? path.join(config.resolvedPaths.cwd, "src", file.target)
|
||||
: path.join(config.resolvedPaths.cwd, file.target)
|
||||
targetDir = path.dirname(filePath)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user