Skip to content

Commit b87198d

Browse files
committed
fix: npm coming with node 6 doesn't talk ci
1 parent 6f16588 commit b87198d

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

scripts/e2e.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ const fs = require('fs-extra');
88
const path = require('path');
99
const 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+
1121
function 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

Comments
 (0)