File tree Expand file tree Collapse file tree 1 file changed +0
-37
lines changed Expand file tree Collapse file tree 1 file changed +0
-37
lines changed Original file line number Diff line number Diff line change 1
- #!/usr/bin/env node
2
-
3
- const execSync = require ( 'child_process' ) . execSync ;
4
- const fs = require ( 'fs' ) ;
5
- const path = require ( 'path' ) ;
6
-
7
- /**
8
- * Use Yarn if available, it's much faster than the npm client.
9
- * Return the version of yarn installed on the system, null if yarn is not available.
10
- */
11
- function getYarnVersionIfAvailable ( ) {
12
- let yarnVersion ;
13
- try {
14
- // execSync returns a Buffer -> convert to string
15
- yarnVersion = ( execSync ( 'yarn --version' , {
16
- stdio : [ 0 , 'pipe' , 'ignore' ] ,
17
- } ) . toString ( ) || '' ) . trim ( ) ;
18
- } catch ( error ) {
19
- return null ;
20
- }
21
- return yarnVersion ;
22
- }
23
-
24
- function installDevDependencies ( ) {
25
- console . log ( 'Adding dev dependencies for the project...' ) ;
26
-
27
- if ( getYarnVersionIfAvailable ( ) ) {
28
- execSync ( `yarn install` , { stdio : 'inherit' } ) ;
29
- } else {
30
- execSync ( `npm install` ) ;
31
- }
32
- }
33
-
34
- installDevDependencies ( ) ;
35
- createScripts ( ) ;
36
-
37
- console . log ( "This is post init script" ) ;
You can’t perform that action at this time.
0 commit comments