How to use the globby function in globby

To help you get started, we’ve selected a few globby 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 elastic / kibana / src / optimize / watch / watch_cache.ts View on Github external
public async reset() {
    this.logWithMetadata(['info', 'optimize:watch_cache'], 'The optimizer watch cache will reset');

    // start by deleting the state file to lower the
    // amount of time that another process might be able to
    // successfully read it once we decide to delete it
    await del(this.statePath, { force: true });

    // delete everything in optimize/.cache directory
    await del(await globby([normalizePosixPath(this.cachePath)], { dot: true }));

    // delete some empty folder that could be left
    // from the previous cache path reset action
    await deleteEmpty(this.cachePath);

    // delete dlls
    await del(this.dllsPath);

    // re-write new cache state file
    await this.write();

    this.logWithMetadata(['info', 'optimize:watch_cache'], 'The optimizer watch cache has reset');
  }
github GitbookIO / bipbip / src / bin.js View on Github external
async function main() {
    const inputFiles = program.args.length == 0 ? DEFAULT_FILES : program.args;
    const paths = await globby([...inputFiles, ...IGNORED_FILES]);

    paths.forEach(filePath => {
        // $FlowFixMe: flow doesn't accept dynamic require
        require(path.resolve(process.cwd(), filePath));
    });

    // Get all suites to run
    const input = getBenchmark();
    const previous = program.compare
        ? await loadResult(path.resolve(process.cwd(), program.compare))
        : null;

    const reporter = new BackgroundReporter();

    // Setup options for scenarios
    const options = {
github wireapp / wire-desktop / bin / deploy-tools / lib / deploy-utils.ts View on Github external
export async function find(fileGlob: string, options?: FindOptions): Promise {
  const findOptions: Required = {
    cwd: '.',
    safeGuard: true,
    ...options,
  };
  const matches = await globby(`**/${fileGlob}`, {cwd: findOptions.cwd, followSymbolicLinks: false, onlyFiles: true});

  if (matches.length > 0) {
    const file = path.resolve(matches[0]);
    return {fileName: path.basename(file), filePath: file};
  }

  if (findOptions.safeGuard) {
    throw new Error(`Could not find "${fileGlob}".`);
  }

  return null;
}
github ant-ife / apfe-cli / src / lib / git-diff.js View on Github external
async function searchGitFile (dir) {
  let deps = 10
  while (!(await globby('.git', { cwd: dir })).length && deps > 0) {
    dir = path.resolve(dir, '..')
    --deps
  }

  if (!(await globby('.git', { cwd: dir })).length) {
    throw new Error('Could not find .git file')
  } else {
    return path.resolve(dir)
  }
}
github ant-ife / apfe-cli / src / bin / apfe-bizapp-compose.js View on Github external
if (!Object.keys(config).length) {
    const DEFAULT_CONFIG_PATH = 'build/config/compose-biz-apps.js'
    config = await globby(DEFAULT_CONFIG_PATH)
    if (config && config.length) {
      config = config[0]
      config = require(join(cwd, config))
    } else {
      warn(`${DEFAULT_CONFIG_PATH} is not exist, default will compose all biz-apps under src`)
    }
  }

  let options = config.options || {}
  let bizapps = config['biz-apps'] || []

  if (!bizapps.length) {
    bizapps = await globby('*', { cwd: join(cwd, 'src/biz-apps/') })
  }

  log(`composing biz-apps: ${bizapps.join(', ')}`)
  options = { ...defaultOptions, ...options }
  await composeApps(resolve(cwd, './src'), options, ...bizapps)
}
github skpm / skpm / packages / builder / src / build.js View on Github external
async function getAssets(_skpmConfig) {
  if (!_skpmConfig.assets || !_skpmConfig.assets.length) {
    return []
  }

  const assets = await globby(_skpmConfig.assets, { dot: true })
  return assets
}
github bentonam / fakeit / packages / fakeit-core / src / orchestrator.js View on Github external
resolveFiles(dependencies, true)

          models.push({
            file: model.file,
            root: model.root,
            is_dependency: model.is_dependency,
            dependencies: model.settings.dependencies,
            inputs: model.settings.inputs,
            dependants: [],
            status: new RunStatus(),
          })
        }
      }
    }

    this.api.settings.models = await globby(this.api.resolveGlobs(globs), {
      cwd: this.api.settings.root,
    })
    resolveFiles(this.api.settings.models)

    models = resolveDependenciesOrder(models)
    models = resolveDependants(models)

    return models
  }
github guigrpa / jest-html / src / server / extractor.js View on Github external
const loadCommonCss = async (story: StoryT = mainStory): Promise => {
  story.info('extractor', 'Extracting common CSS...');
  const cssPaths = await globby(_config.cssPatterns);
  _commonCss = cssPaths.map(cssPath => {
    story.info('extractor', `Processing ${chalk.cyan.bold(cssPath)}...`);
    return fs.readFileSync(cssPath, 'utf8');
  });
};

globby

User-friendly glob matching

MIT
Latest version published 3 months ago

Package Health Score

83 / 100
Full package analysis