How to use the find-up.bind function in find-up

To help you get started, we’ve selected a few find-up examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anticoders / gagarin / packages / gagarin-cli / lib / index.js View on Github external
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);

find-up

Find a file or directory by walking up parent directories

MIT
Latest version published 12 months ago

Package Health Score

77 / 100
Full package analysis