Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lifecycleScripts/preinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,26 @@ module.exports = function prepareForBuild() {
return exec("npm -v")
.then(function(npmVersion) {
if (npmVersion.split(".")[0] < 3) {
console.log("[nodegit] npm@2 installed, pre-loading required packages");
console.log("[nodegit] npm@2 installed, " +
"pre-loading required packages");
return exec("npm install --ignore-scripts");
}

return Promise.resolve();
})
.catch(function(err) {
console.log("npm install failed, change to yarn install");
return exec("yarn --version")
.then(function(yarnVersion) {
if (yarnVersion.split(".")[0] < 1) {
console.log("[nodegit] yarn installed, " +
"pre-loading required packages");
return exec("yarn install --ignore-scripts");
}

return Promise.resolve();
});
})
.then(function() {
if (buildFlags.isGitRepo) {
var submodules = require(local("submodules"));
Expand Down