File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
packages/create-react-admin/src Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -53,16 +53,17 @@ const getAuthProvider = (flags: typeof cli.flags) => {
5353 return 'none' ;
5454} ;
5555
56- const getDefaultInstaller = ( processExec : string ) => {
57- if ( processExec . includes ( 'yarn' ) ) return 'yarn' ;
58- if ( processExec . includes ( 'bun' ) ) return 'bun' ;
59- return 'npm' ;
56+ const getDefaultInstaller = ( userAgent : string ) => {
57+ if ( ! userAgent ) return undefined ;
58+ const pkgSpec = userAgent . split ( ' ' ) [ 0 ] ;
59+ const pkgSpecArr = pkgSpec . split ( '/' ) ;
60+ return pkgSpecArr [ 0 ] ;
6061} ;
6162
62- const getInstall = ( flags : typeof cli . flags , processExec : string ) => {
63+ const getInstall = ( flags : typeof cli . flags , userAgent : string ) => {
6364 if ( flags . install ) return flags . install ;
6465 if ( flags . interactive ) return undefined ;
65- return getDefaultInstaller ( processExec ) ;
66+ return getDefaultInstaller ( userAgent ) ;
6667} ;
6768
6869const getResources = ( flags : typeof cli . flags ) => {
@@ -133,7 +134,7 @@ if (cli.flags.h) {
133134 }
134135 const dataProvider = getDataProvider ( cli . flags ) ;
135136 const authProvider = getAuthProvider ( cli . flags ) ;
136- const install = getInstall ( cli . flags , process . execPath ) ;
137+ const install = getInstall ( cli . flags , process . env . npm_config_user_agent ) ;
137138 const resources = getResources ( cli . flags ) ;
138139
139140 render (
You can’t perform that action at this time.
0 commit comments