How to use findup-sync - 10 common examples

To help you get started, we’ve selected a few findup-sync 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 denali-js / core / test / acceptance / runtime / addons.js View on Github external
let options = {
    populateWithDummy: false,
    env: { DENALI_ENV: 'development' }
  };
  // Generate a nested addon graph: my-denali-app -> my-denali-addon -> my-nested-denali-addon
  let app = new CommandAcceptanceTest('new my-denali-app --use-npm', options);
  let addon = new CommandAcceptanceTest('addon my-denali-addon --use-npm', options);
  let nestedAddon = new CommandAcceptanceTest('addon my-nested-denali-addon --use-npm', options);
  let appPath = path.join(app.dir, 'my-denali-app');
  let addonPath = path.join(addon.dir, 'my-denali-addon');
  let nestedAddonPath = path.join(nestedAddon.dir, 'my-nested-denali-addon');
  await Promise.all([ app.run(), addon.run(), nestedAddon.run() ]);

  // Symlink this version of denali into each
  let denaliPath = path.dirname(path.dirname(findup('package.json')));
  linkDependency(appPath, 'denali', denaliPath);
  linkDependency(addonPath, 'denali', denaliPath);
  linkDependency(nestedAddonPath, 'denali', denaliPath);
  // Symlink the generated addons into a dependency graph, a la npm link
  addDependency(appPath, 'my-denali-addon', '*');
  linkDependency(appPath, 'my-denali-addon', addonPath);
  addDependency(addonPath, 'my-nested-denali-addon', '*');
  linkDependency(addonPath, 'my-nested-denali-addon', nestedAddonPath);
  // Add our signal flag, an initializer that just logs something out
  fs.writeFileSync(path.join(addonPath, 'config', 'initializers', 'my-initializer.js'), `
    export default {
      name: 'my-initializer',
      initialize() {
        console.log('shallow');
      }
    }
github broccolijs / broccoli / lib / load_brocfile.ts View on Github external
export = function loadBrocfile(options: LoadBrocfileOptions = {}) {
  let brocfilePath;
  if (options.brocfilePath) {
    brocfilePath = path.resolve(options.brocfilePath);
  } else {
    brocfilePath = findup('Brocfile.{ts,js}', {
      nocase: true,
    });
  }

  if (!brocfilePath) {
    throw new Error('Brocfile.[js|ts] not found');
  }

  const baseDir = options.cwd || path.dirname(brocfilePath);

  // The chdir should perhaps live somewhere else and not be a side effect of
  // this function, or go away entirely
  process.chdir(baseDir);

  const brocfile = requireBrocfile(brocfilePath);
github denali-js / core / lib / cli / commands / index.js View on Github external
import findKey from 'lodash/findKey';
import forIn from 'lodash/forIn';

import AddonCommand from './addon';
import BuildCommand from './build';
import ConsoleCommand from './console';
import RoutesCommand from './routes';
import RootCommand from './root';
import DestroyCommand from './destroy';
import GenerateCommand from './generate';
import InstallCommand from './install';
import NewCommand from './new';
import ServerCommand from './server';
import TestCommand from './test';

let projectPkgPath = findup('package.json');
let isDenaliPkg = false;
let projectPkg;
if (projectPkgPath) {
  projectPkg = require(path.resolve(projectPkgPath));
  isDenaliPkg = projectPkg.keywords && (projectPkg.keywords.includes('denali-addon') || projectPkg.dependencies.denali);
}

let commands = {};

if (isDenaliPkg) {
  // Load the available addon commands by recusring through the dependency graph
  // and loading the 'commands.js' file for each addon
  let addons = discoverAddons(process.cwd());
  addons = topsort(addons, { valueKey: 'value' });

  // Merge the depedency graph so that later addons take precedence over earlier
github JPeer264 / node-semantic-git-commit-cli / lib / getConfig.js View on Github external
const getConfig = (altPath, fileName = '.sgcrc') => {
  const pathString = findup(fileName, { cwd: altPath || cwd });
  const localeConfigJS = safeRequire(findup('sgc.config.js', { cwd }));
  const localeConfig = json.readToObjSync(pathString);
  const globalConfigJS = safeRequire(path.join(homedir, 'sgc.config.js'));
  const globalConfig = json.readToObjSync(path.join(homedir, '.sgcrc'));
  const packageConfig = json.readToObjSync(findup('package.json', { cwd })).sgc;
  const sgcrcDefaultConfig = json.readToObjSync(path.join(__dirname, '..', '.sgcrc'));
  const sgcrcTestDefaultConfig = json.readToObjSync(path.join(__dirname, '..', '.sgcrc_default'));

  const sgcrcDefault = sgcrcDefaultConfig || sgcrcTestDefaultConfig;

  // priority order (1. highest priority):
  // 1. local config
  //   - 1. sgc.config.js
  //   - 2. .sgcrc
  //   - 3. (package.json).sgc
  // 2. global config
github alienfast / gulp-pipeline / src / util / file.js View on Github external
findup(glob, options = {}, fullPath = true) {
    let f = findup(glob, options)
    if (f && fullPath) {
      return path.resolve(f)
    }
    else {
      return f
    }
  }
github alienfast / gulp-pipeline / dist / gulp-pipeline.es.js View on Github external
throw new Error(`Task ${t} is listed more than once. This is probably a typo.`)
        }
        foundTasks[t] = true
      }

      if (isArray) {
        if (t.length === 0) {
          throw new Error(`An empty array was provided as a task set`)
        }
        this.verifyTaskSets(t, true, foundTasks)
      }
    }
  }
}

const node_modules$1 = findup('node_modules')


const Default$7 = {
  debug: false,
  presetType: 'javascripts',
  task: {
    name: 'rollup:es'
  },

  watch: {
    glob: '**/*.js',
    options: {
      //cwd: ** resolved from preset **
    }
  },
  //source: { }, ** resolved from preset **
github hammerframework / hammer / packages / hammer-core / src / main.ts View on Github external
export const getHammerConfigPath = (): string => {
  const configPath = findUp(HAMMER_CONFIG_FILE)
  if (!configPath) {
    throw new Error(
      `Could not find a "${HAMMER_CONFIG_FILE}" file, are you in a hammer project?`
    )
  }
  return configPath
}
github amazeeio / lagoon / cli / src / config / index.js View on Github external
function readConfig(): LagoonConfig | null {
  const configPath = findup('.lagoon.yml');

  if (configPath == null) {
    return null;
  }

  const yamlContent = fs.readFileSync(configPath);
  return parseConfig(yamlContent.toString());
}
github schovi / create-chrome-extension / src / manifest / processor / package_json.js View on Github external
export default function(manifest) {
  const packagePath = findupSync('package.json')

  const packageConfig = fs.readJSONSync(packagePath)

  const { name, description, version } = packageConfig

  manifest = {
    name,
    description,
    version,
    ...manifest
  }

  return {manifest}
}
github alienfast / gulp-pipeline / dist / gulp-pipeline.es.js View on Github external
findup(glob, options = {}, fullPath = true) {
    let f = findup(glob, options)
    if(this.config.debug) {
      this.debug(`findup-sync(${glob}, ${this.dump(options)}): ${this.dump(f)}`)
    }
    if (f && fullPath) {
      return path.resolve(f)
    }
    else {
      return f
    }
  }

findup-sync

Find the first file matching a given pattern in the current directory or the nearest ancestor directory.

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis

Popular findup-sync functions