Skip to content

Commit 69fc8e2

Browse files
jherrshadcn
andauthored
fix: allow silent mode with npm on React 19 (#6965)
* fix: allow silent mode with npm on React 19 * chore: changeset * style: format --------- Co-authored-by: shadcn <m@shadcn.com>
1 parent 84ec2f6 commit 69fc8e2

2 files changed

Lines changed: 26 additions & 17 deletions

File tree

.changeset/curly-impalas-give.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"shadcn": patch
3+
---
4+
5+
allow silent mode with npm

packages/shadcn/src/utils/updaters/update-dependencies.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,28 @@ export async function updateDependencies(
3232
// Offer to use --force or --legacy-peer-deps if using React 19 with npm.
3333
let flag = ""
3434
if (isUsingReact19(config) && packageManager === "npm") {
35-
dependenciesSpinner.stopAndPersist()
36-
logger.warn(
37-
"\nIt looks like you are using React 19. \nSome packages may fail to install due to peer dependency issues in npm (see https://ui.shadcn.com/react-19).\n"
38-
)
39-
const confirmation = await prompts([
40-
{
41-
type: "select",
42-
name: "flag",
43-
message: "How would you like to proceed?",
44-
choices: [
45-
{ title: "Use --force", value: "force" },
46-
{ title: "Use --legacy-peer-deps", value: "legacy-peer-deps" },
47-
],
48-
},
49-
])
35+
if (options.silent) {
36+
flag = "force"
37+
} else {
38+
dependenciesSpinner.stopAndPersist()
39+
logger.warn(
40+
"\nIt looks like you are using React 19. \nSome packages may fail to install due to peer dependency issues in npm (see https://ui.shadcn.com/react-19).\n"
41+
)
42+
const confirmation = await prompts([
43+
{
44+
type: "select",
45+
name: "flag",
46+
message: "How would you like to proceed?",
47+
choices: [
48+
{ title: "Use --force", value: "force" },
49+
{ title: "Use --legacy-peer-deps", value: "legacy-peer-deps" },
50+
],
51+
},
52+
])
5053

51-
if (confirmation) {
52-
flag = confirmation.flag
54+
if (confirmation) {
55+
flag = confirmation.flag
56+
}
5357
}
5458
}
5559

0 commit comments

Comments
 (0)