How to use the fs-jetpack.inspect function in fs-jetpack

To help you get started, we’ve selected a few fs-jetpack 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 infinitered / gluegun / src / loaders / plugin-loader.ts View on Github external
plugin.hidden = Boolean(options.hidden)

  if (!strings.isBlank(name)) {
    plugin.name = name
  }

  // directory check
  if (filesystem.isNotDirectory(directory)) {
    throw new Error(`Error: couldn't load plugin (not a directory): ${directory}`)
  }

  plugin.directory = directory

  // the directory is the default name (unless we were told what it was)
  if (strings.isBlank(name)) {
    plugin.name = jetpack.inspect(directory).name
  }

  const jetpackPlugin = jetpack.cwd(plugin.directory)

  // load any default commands passed in
  plugin.commands = (options.preloadedCommands || []).map(loadCommandFromPreload)

  // load the commands found in the commands sub-directory
  const commandSearchDirectories = ['commands', 'build/commands']
  commandSearchDirectories.map(dir => {
    if (jetpackPlugin.exists(dir) === 'dir') {
      const commands = jetpackPlugin.cwd(dir).find({ matching: commandFilePattern, recursive: true })

      plugin.commands = plugin.commands.concat(
        commands.map(file => loadCommandFromFile(path.join(directory, dir, file))),
      )
github apache / incubator-weex-cli / packages / @weex / core / src / loaders / plugin-loader.ts View on Github external
plugin.hidden = Boolean(options.hidden)

  if (!strings.isBlank(name)) {
    plugin.name = name
  }

  // directory check
  if (fs.isNotDirectory(directory)) {
    throw new Error(`Error: couldn't load plugin (not a directory): ${directory}`)
  }

  plugin.directory = directory

  // the directory is the default name (unless we were told what it was)
  if (strings.isBlank(name)) {
    plugin.name = jetpack.inspect(directory).name
  }

  const jetpackPlugin = jetpack.cwd(plugin.directory)

  // load any default commands passed in
  plugin.commands = map(loadCommandFromPreload, options.preloadedCommands || [])

  // load the commands found in the commands sub-directory
  if (jetpackPlugin.exists('commands') === 'dir') {
    const commands = jetpackPlugin.cwd('commands').find({ matching: commandFilePattern, recursive: true })

    plugin.commands = plugin.commands.concat(
      map(file => loadCommandFromFile(`${directory}/commands/${file}`), commands),
    )
  }
github misega / HTML5-Banners / gulpfile.js View on Github external
files.forEach(function(file) {
            if (fso.statSync(dir + '/' + file).isDirectory()) {
                filelist = utils.walkDirectory(dir + '/' + file, filelist);
            }
            else {
                if (!/(\.DS_Store|\.keep)/.test(file)) {
                    filelist.push(fs.inspect(dir + '/' + file, {times: true}));
                }
            }
        });
github DaanBroekhof / JoroDox / app / utils / tasks / WatchDirectoryTask.js View on Github external
this.watcher = fs.watch(args.rootDir, {recursive: true}, (rawEventType, filename) => {
      if (!filename) {
        return;
      }

      const info = jetpack.inspect(path.join(args.rootDir, filename));

      let eventType = rawEventType;
      if (!info && rawEventType === 'rename') {
        eventType = 'delete';
      } else if (info && info.type === 'file' && rawEventType === 'change') {
        eventType = 'fileChange';
      } else if (info && info.type === 'file' && rawEventType === 'rename') {
        eventType = 'fileRename';
      } else if (info && info.type === 'dir' && rawEventType === 'change') {
        eventType = 'dirChange';
      } else if (info && info.type === 'dir' && rawEventType === 'rename') {
        eventType = 'dirRename';
      } else {
        eventType = 'unknown';
      }
github z-edit / zedit / src / javascripts / helpers / fileHelpers.js View on Github external
fh.getFileSize = function(filePath) {
    return jetpack.inspect(filePath).size;
};
github ebu / pi-list / apps / listwebserver / util / filesystem.js View on Github external
            .map(folder => jetpack.inspect(folder))
            .map(dir => ({ id: dir.name }));
github jscomplete / reactful / packages / reactful / lib / copy.js View on Github external
overwrite: (src, dest) => {
      if (
        inspect(src.absolutePath, { checksum: 'md5' }).md5 !==
        inspect(dest.absolutePath, { checksum: 'md5' }).md5
      ) {
        const answer = prompt(`Replace ${src.name}? [y|n] `);
        return answer.match(/(yes|yep|y|sure)/, 'i');
      }
      return true;
    },
  });
github z-edit / zedit / src / javascripts / helpers / fileHelpers.js View on Github external
fh.getDateModified = function(filePath) {
    return jetpack.inspect(filePath, {times: true}).modifyTime;
};