Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.run = function (basedir) {
// TODO: change the name to "gagarin" when the meta package is ready
var packageName = 'gagarin-core';
utils.stopOnFirstSuccess([
resolve.bind({}, packageName, { basedir: basedir }),
resolve.bind({}, packageName, { basedir: path.join(basedir, 'tests') }),
resolve.bind({}, packageName, { basedir: path.join(basedir, 'test') }),
utils.promiseAsThunk(findUp.bind({}, 'lib/gagarin.js')),
], function (err, pathToGagarin) {
if (err || !pathToGagarin) {
console.log(chalk.red('gagarin-cli:'), 'Unable to find local gagarin.');
if (err) {
console.log(chalk.red('gagarin-cli:'), err.stack);
}
return;
}
console.log(chalk.green('gagarin-cli:'),
'Found local gagarin at: ' + chalk.magenta(pathToGagarin));
require(pathToGagarin).cli(basedir).catch(function (err) {
console.log(chalk.red('gagarin-cli:'), err.stack);