How to use the fast-glob.sync 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 astroboy-lab / astroboy / loader / AstroboyControllerLoader.js View on Github external
load() {
    const app = this.app;
    let controllers = {};
    const entries = glob.sync([`${app.ROOT_PATH}${this.config.pattern}`], {
      dot: true,
    });
    entries
      .filter(i => !i.includes('.d.ts'))
      .forEach(entry => {
        const key = this.resolveExtensions(entry.split('controllers/')[1], true);
        controllers[key] = require(entry);
      });
    app.controllers = controllers;
  }
}
github youzan / vant / packages / vant-cli / src / compiler / gen-site-desktop-shared.ts View on Github external
docs.push({
          name: formatName(component, lang),
          path: join(SRC_DIR, component, fileName)
        });
      });
    });
  } else {
    components.forEach(component => {
      docs.push({
        name: formatName(component),
        path: join(SRC_DIR, component, 'README.md')
      });
    });
  }

  const staticDocs = glob.sync(join(DOCS_DIR, '**/*.md')).map(path => {
    const pairs = parse(path).name.split('.');
    return {
      name: formatName(pairs[0], pairs[1] || defaultLang),
      path
    };
  });

  return [...staticDocs, ...docs.filter(item => existsSync(item.path))];
}
github airbnb / lunar / styleguide.config.js View on Github external
const upperFirst = require('lodash/upperFirst');
const docgenTypescript = require('react-docgen-typescript');

const sections = [
  {
    name: 'Lunar',
    content: './guide/README.md',
  },
];

const aliases = {
  ':core': path.join(__dirname, 'packages/core/src'),
  ':icons': path.join(__dirname, 'packages/icons/src'),
};

glob
  .sync('./packages/*/', {
    absolute: true,
    onlyDirectories: true,
  })
  .forEach(filePath => {
    const folder = path.basename(filePath);
    const { name } = require(path.join(filePath, 'package.json'));

    if (filePath.includes('metrics') || filePath.includes('test-utils')) {
      return;
    }

    sections.push({
      name: upperFirst(camelCase(folder)),
      content: `packages/${folder}/GUIDE.md`,
      components: `packages/${folder}/src/components/!(private)/+([a-zA-Z]).tsx`,
github milesj / boost / packages / core / src / ConfigLoader.ts View on Github external
findConfigInLocalFiles(root: string): ConfigPathOrObject | null {
    const configName = this.getConfigName();
    const relPath = `configs/${configName}.{js,json,json5}`;
    const configPaths = glob
      .sync(relPath, {
        absolute: true,
        cwd: root,
        onlyFiles: true,
      })
      .map(filePath => String(filePath));

    this.debug.invariant(
      configPaths.length === 1,
      `Looking for local config file: ${relPath}`,
      'Found',
      'Not found',
    );

    if (configPaths.length === 1) {
      this.debug('Found %s', chalk.cyan(path.basename(configPaths[0])));
github milesj / babel-plugin-typescript-to-proptypes / src / typeChecker.ts View on Github external
export function loadProgram(pattern: true | string, root: string): ts.Program {
  if (program) {
    return program;
  }

  program = ts.createProgram(
    glob.sync(pattern === true ? './src/**/*.ts' : pattern, { absolute: true, cwd: root }),
    loadTSConfig(),
  );

  return program;
}
github doczjs / docz / core / docz-core / src / bundler / machine / actions.ts View on Github external
export const ensureFiles = ({ args }: ServerMachineCtx) => {
  const appPath = path.join(paths.root, args.themesDir)
  const themeNames = glob.sync('gatsby-theme-**', {
    cwd: appPath,
    onlyDirectories: true,
  })
  themeNames.forEach(themeName => {
    fs.copySync(
      path.join(appPath, themeName),
      path.join(paths.docz, 'src', themeName)
    )
  })
  copyDoczRc(args.config)
  ensureFile('gatsby-browser.js')
  ensureFile('gatsby-ssr.js')
  ensureFile('gatsby-node.js')
  ensureFile('gatsby-config.js', 'gatsby-config.custom.js')

  const publicPath = path.join(paths.docz, '..', args.public)
github jasmine / jasmine / ci.js View on Github external
return function toHtml() {
    const files = fg.sync(patterns, {ignore});
    return template({files});
  }
}
github pangolinjs / core / lib / html / page-list.js View on Github external
function prototypes (context) {
  const files = glob.sync('*.njk', {
    cwd: path.join(context, 'src/prototypes')
  })

  return files.map(file => path.basename(file, '.njk'))
}
github milesj / boost / packages / core / src / ConfigLoader.ts View on Github external
findConfigInLocalFiles(root: PortablePath): ConfigPathOrObject | null {
    const configName = this.getConfigName();
    const relPath = `configs/${configName}.{js,json,json5}`;
    const configPaths = glob.sync(relPath, {
      absolute: true,
      cwd: String(root),
      onlyFiles: true,
    });

    this.debug.invariant(
      configPaths.length === 1,
      `Looking for local config file: ${relPath}`,
      'Found',
      'Not found',
    );

    if (configPaths.length === 1) {
      const localPath = new Path(configPaths[0]);

      this.debug('Found %s', color.filePath(localPath.name()));
github juicycleff / ultimate-backend / libs / nestjs-graphql-gateway / src / graphql-types.loader copy.ts View on Github external
public async getTypesFromPaths(paths: string | string[]): Promise {
    const filePaths = await glob.sync(paths, {
      ignore: ['node_modules'],
    });
    const fileContentsPromises = filePaths.map((filePath) => {
      return readFile(filePath.toString(), 'utf8');
    });

    return Promise.all(fileContentsPromises);
  }
}

fast-glob

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

MIT
Latest version published 1 year ago

Package Health Score

87 / 100
Full package analysis