@@ -13,7 +13,7 @@ export type PackageManagers = 'npm' | 'yarn' | 'pnpm';
1313 * @export
1414 * @template e A type parameter that extends boolean
1515 */
16- export type FindUp < e extends boolean > = e extends true ? string [ ] | undefined : string | undefined
16+ export type FindUp < e extends boolean > = e extends true ? string [ ] | undefined : string | undefined ;
1717/**
1818 * Find and return file paths by searching parent directories based on the given names list and current working directory (cwd) path.
1919 * Optionally return a single path or multiple paths.
@@ -28,7 +28,12 @@ export type FindUp<e extends boolean> = e extends true ? string[] | undefined :
2828 * @param [result=[]] An array of strings representing the accumulated results used in multiple results
2929 * @returns Path(s) to a specific file or folder within the directory or parent directories
3030 */
31- export function findUp < e extends boolean = false > ( names : string [ ] , cwd : string = process . cwd ( ) , multiple : e = false as e , result : string [ ] = [ ] ) : FindUp < e > {
31+ export function findUp < e extends boolean = false > (
32+ names : string [ ] ,
33+ cwd : string = process . cwd ( ) ,
34+ multiple : e = false as e ,
35+ result : string [ ] = [ ]
36+ ) : FindUp < e > {
3237 if ( ! names . some ( ( name ) => ! ! name ) ) return undefined ;
3338 const target = names . find ( ( name ) => fs . existsSync ( path . join ( cwd , name ) ) ) ;
3439 if ( multiple == false && target ) return path . join ( cwd , target ) as FindUp < e > ;
@@ -38,7 +43,6 @@ export function findUp<e extends boolean = false>(names: string[], cwd: string =
3843 return findUp ( names , up , multiple , result ) ;
3944}
4045
41-
4246/**
4347 * Find a Node module/file given its name in a specific directory, with a fallback to the current working directory.
4448 * If the name is empty, return undefined.
@@ -54,11 +58,11 @@ export function findNodeModulesFile(name: string, cwd: string = process.cwd()) {
5458 if ( ! name ) return undefined ;
5559 try {
5660 // Use require.resolve to find the module/file. The paths option allows specifying the directory to start from.
57- const resolvedPath = require . resolve ( name , { paths : [ cwd ] } )
58- return resolvedPath
61+ const resolvedPath = require . resolve ( name , { paths : [ cwd ] } ) ;
62+ return resolvedPath ;
5963 } catch ( error ) {
6064 // If require.resolve fails to find the module/file, it will throw an error.
61- return undefined
65+ return undefined ;
6266 }
6367}
6468
@@ -86,7 +90,7 @@ export function installPackage(
8690 projectPath = '.' ,
8791 exactVersion = true
8892) {
89- const manager = pkgManager ?? getPackageManager ( projectPath ) ;
93+ const manager = pkgManager ?? getPackageManager ( projectPath ) . packageManager ;
9094 console . log ( `Installing package "${ pkg } @${ tag } " with ${ manager } ` ) ;
9195 switch ( manager ) {
9296 case 'yarn' :
0 commit comments