@@ -8,6 +8,16 @@ const fs = require('fs-extra');
88const path = require ( 'path' ) ;
99const Paths = require ( './paths' ) ;
1010
11+ const NodeVersion = ( versions => {
12+ return { major : versions [ 0 ] , minor : versions [ 1 ] , patch : versions [ 2 ] } ;
13+ } ) (
14+ process . versions . node
15+ . split ( '-' )
16+ . shift ( )
17+ . split ( '.' )
18+ . map ( s => parseInt ( s , 10 ) )
19+ ) ;
20+
1121function getDirectories ( rootDir ) {
1222 return fs . readdirSync ( rootDir ) . filter ( function ( file ) {
1323 return fs . statSync ( path . join ( rootDir , file ) ) . isDirectory ( ) ;
@@ -36,7 +46,12 @@ function setupE2e() {
3646 // that is why we end with the npm install of our bundle
3747 getDirectories ( Paths . e2eWorkTemplatesDir ) . forEach ( tmplDir => {
3848 const dir = path . join ( Paths . e2eWorkTemplatesDir , tmplDir ) ;
39- spawnSync ( 'npm' , [ 'ci' ] , { cwd : dir , stdio : 'inherit' } ) ;
49+ if ( NodeVersion . major >= 8 ) {
50+ spawnSync ( 'npm' , [ 'ci' ] , { cwd : dir , stdio : 'inherit' } ) ;
51+ } else {
52+ // npm coming with node < 8 does not have the `ci` command
53+ spawnSync ( 'npm' , [ 'i' ] , { cwd : dir , stdio : 'inherit' } ) ;
54+ }
4055 spawnSync ( 'npm' , [ 'i' , '-D' , bundle ] , { cwd : dir , stdio : 'inherit' } ) ;
4156 } ) ;
4257
0 commit comments