How to use the globule.find function in globule

To help you get started, we’ve selected a few globule 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 silphid / silphid.unity / Sources / symlynx / index.js View on Github external
function createLinks(args) {
    const glob = (args.recursive ? '**/' : '') + args.input;
    const configFiles = globule.find(glob);

    var generated = [];

    if (configFiles.length == 0) {
        console.log("No config files found!");
        return;
    }

    if (args.verbose)
        console.log("Using config files: " + configFiles.join("\n"));

    configFiles.forEach(function(configFile) {

        // Get config file's directory
        const configDir = configFile.substring(0, configFile.lastIndexOf("/"));
github oxygenhq / oxygen / src / core / OxygenCore.js View on Github external
_loadServices() {
        const oxServicesDirPath = path.resolve(this.oxBaseDir, './ox_services');
        const serviceFiles = globule.find('service-*.js', { srcBase: oxServicesDirPath });
        // initialize all services
        log.debug('Loading services...');
        
        for (var i = 0; i < serviceFiles.length; i++) {
            const serviceFileName = serviceFiles[i];
            const serviceFilePath = path.join(oxServicesDirPath, serviceFileName);
            const result = serviceFileName.match(SERVICE_NAME_MATCH_REGEX);
            const serviceName = result[1];
    
            try {
                const service = this._loadService(serviceName, serviceFilePath);
                service.init();
                this.services[serviceName] = service;
            } catch (e) {
                log.error('Error initializing service "' + serviceName + '": ' + e.message + EOL + (e.stacktrace ? e.stacktrace : ''));
            }
github flovan / headstart / gulpfile.js View on Github external
gulp.task('templates', ['clean-rev'], function (cb) {
	
	verbose(chalk.grey('Running task "templates"'));

	// If assebly is off, export all folders and files
	if (!config.assemble_templates) {
		gulp.src(['templates/**/*', '!templates/*.*', '!_*'])
			.pipe(gulp.dest(config.export_templates));
	}

	// Find number of "root" templates to parse and keep count
	var numTemplates = globule.find(['templates/*.*', '!_*']).length,
		count = 0,
		unvalidatedFiles = [];

	// Go over all root template files
	gulp.src(['templates/*.*', '!_*'])
		.pipe(plugins.tap(function (htmlFile) {

			var
				// Extract bits from filename
				baseName =     path.basename(htmlFile.path),
				nameParts =    baseName.split('.'),
				ext =          _.without(nameParts, _.first(nameParts)).join('.'),
				viewBaseName = _.last(nameParts[0].split('view-')),
				// Make sure Windows paths work down below
				cwdParts =     cwd.replace(/\\/g, '/').split('/'),
github DefinitelyTyped / DefinitelyTyped / globule / globule-tests.ts View on Github external
import * as globule from 'globule';

let filepaths: string[];

filepaths = globule.find('**/*.js');
filepaths = globule.find(['**/*.js']);
filepaths = globule.find('**/*.js', '**/*.less');
filepaths = globule.find('*.js', { matchBase: true });
filepaths = globule.find('**/*.js', '**/*.less', { filter: 'isFile' });
filepaths = globule.find('**/*.js', '**/*.less', { filter: /jQuery/i.test });
filepaths = globule.find({ src: '**/*.js' });

filepaths = globule.match('*.js', '/home/code');
filepaths = globule.match('*.js', '/home/code', { matchBase: true });

let bResult: boolean;
bResult = globule.isMatch('*.js', '/home/code');
bResult = globule.isMatch('*.js', '/home/code', { matchBase: true });

let mappings = globule.mapping(['*.js']);
const len = mappings.length;
github DefinitelyTyped / DefinitelyTyped / types / globule / globule-tests.ts View on Github external
import * as globule from 'globule';

let filepaths: string[];

filepaths = globule.find('**/*.js');
filepaths = globule.find(['**/*.js']);
filepaths = globule.find('**/*.js', '**/*.less');
filepaths = globule.find('*.js', { matchBase: true });
filepaths = globule.find('**/*.js', '**/*.less', { filter: 'isFile' });
filepaths = globule.find('**/*.js', '**/*.less', { filter: /jQuery/i.test });
filepaths = globule.find({ src: '**/*.js' });

filepaths = globule.match('*.js', '/home/code');
filepaths = globule.match('*.js', '/home/code', { matchBase: true });

let bResult: boolean;
bResult = globule.isMatch('*.js', '/home/code');
bResult = globule.isMatch('*.js', '/home/code', { matchBase: true });

let mappings = globule.mapping(['*.js']);
const len = mappings.length;
const src = mappings[0].src;
const dest = mappings[0].dest;

mappings = globule.mapping(['*.js'], { srcBase: '/home/code' });
mappings = globule.mapping(['*.js', '*.less']);
mappings = globule.mapping(['*.js'], ['*.less']);
github DefinitelyTyped / DefinitelyTyped / types / globule / globule-tests.ts View on Github external
import * as globule from 'globule';

let filepaths: string[];

filepaths = globule.find('**/*.js');
filepaths = globule.find(['**/*.js']);
filepaths = globule.find('**/*.js', '**/*.less');
filepaths = globule.find('*.js', { matchBase: true });
filepaths = globule.find('**/*.js', '**/*.less', { filter: 'isFile' });
filepaths = globule.find('**/*.js', '**/*.less', { filter: /jQuery/i.test });
filepaths = globule.find({ src: '**/*.js' });

filepaths = globule.match('*.js', '/home/code');
filepaths = globule.match('*.js', '/home/code', { matchBase: true });

let bResult: boolean;
bResult = globule.isMatch('*.js', '/home/code');
bResult = globule.isMatch('*.js', '/home/code', { matchBase: true });

let mappings = globule.mapping(['*.js']);
const len = mappings.length;
const src = mappings[0].src;
const dest = mappings[0].dest;

mappings = globule.mapping(['*.js'], { srcBase: '/home/code' });
mappings = globule.mapping(['*.js', '*.less']);
github shama / gaze / lib / gaze04.js View on Github external
Gaze.prototype._internalAdd = function(file, done) {
  var files = [];
  if (helper.isDir(file)) {
    files = [helper.markDir(file)].concat(globule.find(this._patterns, this.options));
  } else {
    if (globule.isMatch(this._patterns, file, this.options)) {
      files = [file];
    }
  }
  if (files.length > 0) {
    this._addToWatched(files);
    this.close(false);
    this._initWatched(done);
  }
};
github google / WebFundamentals / gulp-tasks / build.js View on Github external
gulp.task('build:announcement', function() {
  const globOpts = {
    srcBase: 'src/content/en/',
    prefixBase: true,
  };
  const dumpYamlOpts = {lineWidth: 1000};
  const projectYamlFiles = glob.find('**/_project.yaml', globOpts);
  const file = 'src/data/announcement.yaml';
  const announcementYaml = jsYaml.safeLoad(fs.readFileSync(file, 'utf8'));
  const showAnnouncement = announcementYaml['enabled'];
  projectYamlFiles.forEach((file) => {
    let projYaml = jsYaml.safeLoad(fs.readFileSync(file, 'utf8'));
    if (showAnnouncement) {
      projYaml.announcement = {};
      projYaml.announcement.description = announcementYaml.description;
      if (announcementYaml.background) {
        projYaml.announcement.background = announcementYaml.background;
      }
    } else {
      delete projYaml['announcement'];
    }
    fs.writeFileSync(file, jsYaml.safeDump(projYaml, dumpYamlOpts));
  });
github kaola-fed / foxman / packages / foxman-plugin-automount / index.js View on Github external
initRouters(base, sync) {
        const formatPattern = this.formatPattern.bind(this);
        const files = globule.find(formatPattern(base, sync));
        const methodGetter = this.methodGetter;
        const urlMatch = sync
            ? filePath => {
                let url = this.tplUrlMap[filePath];
                if (url) {
                    return url;
                }
                return this.syncDataMatch(filePath);
            }
            : this.asyncDataMatch;

        const routers = files.reduce((prev, file) => {
            const filePath =  this.transformSep(
                this.removeExtense(path.relative(base, file), sync)
            );
            let urls = urlMatch(filePath);
github Andyliwr / FE-learning-load / task08 / lidikang / styles / node_modules / gaze / lib / gaze.js View on Github external
Gaze.prototype.add = function (files, done) {
  if (typeof files === 'string') { files = [files]; }
  this._patterns = helper.unique.apply(null, [this._patterns, files]);
  files = globule.find(this._patterns, this.options);
  this._addToWatched(files);
  this.close(false);
  this._initWatched(done);
};

globule

An easy-to-use wildcard globbing library.

MIT
Latest version published 2 years ago

Package Health Score

68 / 100
Full package analysis