mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-23 04:35:46 +00:00
fix(cli): Update package.json name property when init next-monorepo (#7742)
* fix(cli): Update package.json name property when init next-monorepo * test(cli): Fix failing test * fix(cli): Remove unnecessary git changes * chore: add changeset --------- Co-authored-by: shadcn <m@shadcn.com>
This commit is contained in:
5
.changeset/salty-hands-jog.md
Normal file
5
.changeset/salty-hands-jog.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"shadcn": minor
|
||||
---
|
||||
|
||||
rename monorepo project on init
|
||||
@@ -236,6 +236,16 @@ async function createMonorepoProject(
|
||||
await execa(options.packageManager, ["install"], {
|
||||
cwd: projectPath,
|
||||
})
|
||||
// await execa("cd", [cwd])
|
||||
|
||||
// Write project name to the package.json
|
||||
const packageJsonPath = path.join(projectPath, "package.json")
|
||||
if (fs.existsSync(packageJsonPath)) {
|
||||
const packageJsonContent = await fs.readFile(packageJsonPath, "utf8")
|
||||
const packageJson = JSON.parse(packageJsonContent)
|
||||
packageJson.name = projectPath.split("/").pop()
|
||||
await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
||||
}
|
||||
|
||||
// Try git init.
|
||||
const cwd = process.cwd()
|
||||
@@ -245,7 +255,6 @@ async function createMonorepoProject(
|
||||
await execa("git", ["commit", "-m", "Initial commit"], {
|
||||
cwd: projectPath,
|
||||
})
|
||||
// await execa("cd", [cwd])
|
||||
|
||||
createSpinner?.succeed("Creating a new Next.js monorepo.")
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user