11import { Config } from "@/src/utils/get-config"
2- import { getPackageInfo } from "@/src/utils/get-package-info"
32import { getPackageManager } from "@/src/utils/get-package-manager"
4- import { logger } from "@/src/utils/logger"
53import { RegistryItem } from "@/src/utils/registry/schema"
64import { spinner } from "@/src/utils/spinner"
75import { execa } from "execa"
8- import prompts from "prompts"
96
107export async function updateDependencies (
118 dependencies : RegistryItem [ "dependencies" ] ,
@@ -29,52 +26,12 @@ export async function updateDependencies(
2926 } ) ?. start ( )
3027 const packageManager = await getPackageManager ( config . resolvedPaths . cwd )
3128
32- // Offer to use --force or --legacy-peer-deps if using React 19 with npm.
33- let flag = ""
34- 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 (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- ] )
50-
51- if ( confirmation ) {
52- flag = confirmation . flag
53- }
54- }
55-
56- dependenciesSpinner ?. start ( )
57-
5829 await execa (
5930 packageManager ,
60- [
61- packageManager === "npm" ? "install" : "add" ,
62- ...( packageManager === "npm" && flag ? [ `--${ flag } ` ] : [ ] ) ,
63- ...dependencies ,
64- ] ,
31+ [ packageManager === "npm" ? "install" : "add" , ...dependencies ] ,
6532 {
6633 cwd : config . resolvedPaths . cwd ,
6734 }
6835 )
6936 dependenciesSpinner ?. succeed ( )
7037}
71-
72- function isUsingReact19 ( config : Config ) {
73- const packageInfo = getPackageInfo ( config . resolvedPaths . cwd )
74-
75- if ( ! packageInfo ?. dependencies ?. react ) {
76- return false
77- }
78-
79- return / ^ (?: \^ | ~ ) ? 1 9 (?: \. \d + ) * (?: - .* ) ? $ / . test ( packageInfo . dependencies . react )
80- }
0 commit comments