File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ const which = require ( 'npm-which' ) ( process . cwd ( ) ) ;
2+
3+ function isAvailable ( bin ) {
4+ try {
5+ return which . sync ( bin ) ;
6+ } catch ( e ) {
7+ return false ;
8+ }
9+ }
10+
11+ module . exports = async function ( {
12+ unattended, prompts, run
13+ } ) {
14+ if ( unattended ) return ;
15+
16+ const choices = [
17+ { value : 'npm i' , title : 'Yes, use npm' }
18+ ] ;
19+
20+ if ( isAvailable ( 'yarn' ) ) {
21+ choices . unshift ( { value : 'yarn' , title : 'Yes, use yarn' } ) ;
22+ }
23+
24+ if ( isAvailable ( 'pnpm' ) ) {
25+ choices . unshift ( { value : 'pnpm i' , title : 'Yes, use pnpm' } ) ;
26+ }
27+
28+ choices . unshift ( { title : 'No' } ) ;
29+
30+ const result = await prompts . select ( {
31+ message : 'Do you want to install dependencies?' ,
32+ choices
33+ } ) ;
34+
35+ if ( result ) {
36+ await run ( result ) ;
37+ }
38+ } ;
Original file line number Diff line number Diff line change 1414 "del" : " ^4.1.0" ,
1515 "puppeteer" : " ^1.15.0" ,
1616 "standard-changelog" : " ^2.0.7"
17+ },
18+ "dependencies" : {
19+ "npm-which" : " ^3.0.1"
1720 }
1821}
You can’t perform that action at this time.
0 commit comments