How to use globule - 10 common examples

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 tivac / yui-configger / lib / configger.js View on Github external
.filter(function(file) {
                // All files are cool if CSS is enabled
                if(options.css) {
                    return true;
                }

                // Otherwise filter out CSS modules
                return globule.isMatch(options.extensions.js, file);
            })
            .map(function(file) {
github AtomLinter / linter-jscs / src / linter-jscs.js View on Github external
editorHandlers.add(editor.getBuffer().onWillSave(() => {
        const scope = editor.getGrammar().scopeName;
        if (
          (
            atom.workspace.getActiveTextEditor().id === editor.id
            && (grammarScopes.indexOf(scope) !== -1 && scope !== 'text.html.basic')
          )
          || this.testFixOnSave
        ) {
          // Exclude `excludeFiles` for fix on save
          const config = getConfig(filePath);
          const exclude = globule.isMatch(
            config && config.excludeFiles,
            getFilePath(filePath),
          );

          if ((fixOnSave && !exclude) || this.testFixOnSave) {
            fixString(editor);
          }
        }
      }));
      // Remove all disposables associated with this editor
github shama / gaze / lib / gaze.js View on Github external
helper.forEachSeries(current, function(file, next) {
      var filepath = path.join(dir, file);
      if (!fs.existsSync(filepath)) return next();
      var stat = fs.lstatSync(filepath);
      if ((dirstat.mtime - stat.mtime) <= 0) {
        var relpath = path.relative(self.options.cwd, filepath);
        if (stat.isDirectory()) {
          // If it was a dir, watch the dir and emit that it was added
          platform(filepath, self._trigger.bind(self));
          if (globule.isMatch(self._patterns, relpath, self.options)) {
            self._emitAll('added', filepath);
          }
          self._wasAddedSub(filepath);
        } else if (globule.isMatch(self._patterns, relpath, self.options)) {
          // Otherwise if the file matches, emit added
          platform(filepath, self._trigger.bind(self));
          if (globule.isMatch(self._patterns, relpath, self.options)) {
            self._emitAll('added', filepath);
          }
        }
      }
      next();
    });
  });
github waigo / waigo / src / loader.js View on Github external
throw new Error(`Unable to find package.json`);
        }
      }

      try {
        config = loader.__require(path.resolve(pathToConfig));
      } catch (err) {
        throw new Error(`Unable to load config file: ${pathToConfig}`);
      }
    }

    let names = scope.reduce(function (result, prop) {
      return result.concat(Object.keys(config[prop] || {}));
    }, []);

    options.plugins.names = _.uniq(globule.match(pattern, names));
  }
  
  debug(`Plugins to load: ${options.plugins.names.join(', ')}`);

  // what paths will we search?
  let sourcePaths = loader[$SOURCE_PATHS] = {
    waigo: WAIGO_FOLDER,
    app: appFolder
  };

  _.each(options.plugins.names, function(name) {
    let fullPath;

    try {
      fullPath = path.dirname(require.resolve(name));
    } catch (err) {
github verbose / verb / lib / utils / expandMapping.js View on Github external
module.exports = function(patterns, dest, options) {
  // Options defaults
  var opts = _.defaults({cwd: 'docs', ext: '.md'}, options);

  // Globule defaults
  var globOpts = {
    flatten: true,
    matchBase: true,
    prefixBase: false,
    srcBase: opts.cwd,
    destBase: dest,
    ext: opts.ext
  };

  return glob.findMapping(patterns, globOpts);
};
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']);

globule

An easy-to-use wildcard globbing library.

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis