Skip to content

Commit

Permalink
Remove yarn.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry committed Nov 4, 2016
1 parent 5225a8f commit 2cf8055
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 39 deletions.
55 changes: 17 additions & 38 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

const async = require('async');
const path = require('path');
var async = require('async');
var path = require('path');

require('shelljs/global');

// Install NPM dependencies, in up to 7 directories at a time
const queue = async.queue((directory, cb) => {
installForDirectory(directory, cb);
var queue = async.queue(function (directory, callback) {
installForDirectory(directory, callback);
}, 7);

queueDirectories('appengine');
Expand All @@ -47,39 +47,16 @@ queue.push('vision');
* Install NPM dependencies within a single directory.
*
* @param {string} directory The name of the directory in which to install dependencies.
* @param {function} cb The callback function.
* @param {function} callback The callback function.
*/
function installForDirectory (directory, cb) {
console.log(`${directory}...installing dependencies`);
exec('yarn install', {
function installForDirectory(directory, callback) {
console.log(directory + '...installing dependencies');
exec('npm install', {
async: true,
cwd: path.join(__dirname, '../', directory)
}, (err) => {
if (err) {
cd(directory);

// Uninstall dependencies
console.log(`Retrying in ${directory} with NPM...`);
rm('-rf', 'node_modules');

// Move out of the directory
cd('..');
exec('npm install', {
async: true,
cwd: path.join(__dirname, '../', directory)
}, (err) => {
if (err) {
console.error(`Failed to install dependencies in ${directory}!`);
throw err;
} else {
console.log(`${directory}...done`);
cb();
}
});
} else {
console.log(`${directory}...done`);
cb();
}
}, function (err) {
console.log(directory + '...done');
callback(err);
});
}

Expand All @@ -88,18 +65,20 @@ function installForDirectory (directory, cb) {
*
* @param {string} directory The name of the directory in which to recursively install dependencies.
*/
function queueDirectories (directory) {
function queueDirectories(directory) {
// Move into the directory
cd(directory);

// List the files in the directory
ls('-dl', '*')
.filter((file) => {
.filter(function (file) {
// Find the directories within the directory
return file.isDirectory() && file.name !== 'test' && file.name !== 'system-test';
})
.forEach((file) => queue.push(`${directory}/${file.name}`));
.forEach(function (file) {
queue.push(directory + '/' + file.name);
});

// Move out of the directory
cd('..');
}
}
2 changes: 1 addition & 1 deletion scripts/uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ function queueDirectories(directory) {

// Move out of the directory
cd('..');
}
}

0 comments on commit 2cf8055

Please sign in to comment.