How to use the fast-glob.async function in fast-glob

To help you get started, weā€™ve selected a few fast-glob 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 airbnb / lunar / scripts / convertMarkdownToStories.js View on Github external
});

    story.unshift(createHeader(packageName, componentName, imports));

    return fs.writeFile(storyPath, story.join(''), 'utf8').then(() => fs.remove(filePath));
  });
}

const cwd = process.argv[2];

if (!cwd) {
  console.error(chalk.red('Please provide a folder path to convert.'));
  process.exit(1);
}

glob
  .async('**/components/*/README.md', {
    absolute: true,
    cwd: path.join(process.cwd(), cwd),
    ignore: ['node_modules'],
  })
  .then(filePaths => Promise.all(filePaths.map(filePath => convertToStory(String(filePath)))));
github supermodel / supermodel / packages / fs / src / utils.ts View on Github external
export const schemaReadDir = async (schemaPath: string) => {
  const files = await fg.async(resolve(schemaPath, '**/*.{yml,yaml,json}'));

  if (files.length === 0) {
    throw new Error(
      `Schema directory '${schemaPath}' does not contain any schema file`,
    );
  }

  return Promise.all(files.map(async file => schemaReadFile(file.toString())));
};
github seek-oss / braid-design-system / lib / componentDocs / globsToReactDocgen.js View on Github external
module.exports = async ({ include = '', exclude: ignore = [] } = {}) => {
  const files = await fastGlob(include, { ignore });
  return parseTs(files);
};
github 11ty / eleventy / src / TemplateWriter.js View on Github external
TemplateWriter.prototype._getAllPaths = async function() {
  debug("Searching for: %o", this.templateGlobsWithIgnores);
  if (!this.cachedPaths) {
    this.cachedPaths = TemplatePath.addLeadingDotSlashArray(
      await fastglob.async(this.templateGlobsWithIgnores)
    );
  }

  return this.cachedPaths;
};

fast-glob

It's a very fast and efficient glob library for Node.js

MIT
Latest version published 6 months ago

Package Health Score

88 / 100
Full package analysis