File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @h3ravel/shared" ,
3- "version" : " 0.20.5 " ,
3+ "version" : " 0.20.6 " ,
44 "description" : " Shared Utilities." ,
55 "type" : " module" ,
66 "main" : " ./dist/index.js" ,
Original file line number Diff line number Diff line change @@ -2,7 +2,23 @@ import crypto from 'crypto'
22import preferredPM from 'preferred-pm'
33
44export class Resolver {
5- static async getPakageInstallCommand ( pkg : string ) {
5+ static async getPakageInstallCommand ( pkg ?: string ) {
6+ const pm = ( await preferredPM ( process . cwd ( ) ) ) ?. name ?? 'pnpm'
7+
8+ let cmd = 'install '
9+
10+ if ( ! pkg ) {
11+ if ( pm === 'npm' || pm === 'pnpm' || pm === 'bun' )
12+ cmd = 'install'
13+ else
14+ cmd = ''
15+ } else if ( pm === 'yarn' || pm === 'pnpm' || pm === 'bun' )
16+ cmd = 'add '
17+
18+ return `${ pm } ${ cmd } ${ pkg ?? '' } `
19+ }
20+
21+ static async getInstallCommand ( pkg : string ) {
622 const pm = ( await preferredPM ( process . cwd ( ) ) ) ?. name ?? 'pnpm'
723
824 let cmd = 'install'
@@ -14,6 +30,7 @@ export class Resolver {
1430 return `${ pm } ${ cmd } ${ pkg } `
1531 }
1632
33+
1734 /**
1835 * Create a hash for a function or an object
1936 *
You can’t perform that action at this time.
0 commit comments