How to use the ignore-walk.sync function in ignore-walk

To help you get started, we’ve selected a few ignore-walk 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 codecov / codecov-node / lib / codecov.js View on Github external
upload += '<<<<<< ENV\n'
    }
  }

  // List git files
  var root = path.resolve(args.options.root || query.root || '.')
  console.log('==> Building file structure')
  try {
    upload +=
      execSync('git ls-files || hg locate', { cwd: root })
        .toString()
        .trim() + '\n<<<<<< network\n'
  } catch (err) {
    // not a git/hg dir, emulating git/hg ignore behavior
    upload +=
      walk
        .sync({ path: root, ignoreFiles: ['.gitignore', '.hgignore'] })
        .join('\n')
        .trim() + '\n<<<<<< network\n'
  }
  // Make gcov reports
  if ((args.options.disable || '').split(',').indexOf('gcov') === -1) {
    try {
      console.log('==> Generating gcov reports (skip via --disable=gcov)')
      var gcg = args.options['gcov-glob'] || ''
      if (gcg) {
        if (!isWindows) {
          gcg = gcg
            .split(' ')
            .map(function(p) {
              return "-not -path '" + p + "'"
            })
github AdobeXD / xdpm / commands / install.js View on Github external
"error": "Plugin exists already; use -o to overwrite"
                });
            }
            if (opts.clean) {
                cli.debug(`(Cleaning) Removing files inside ${targetFolder}`);
                shell.rm("-Rf", path.join(targetFolder, "*"));
            }
        } else {
            shell.mkdir(targetFolder);
        }

        // the comment below doesn't respect .xdignore (or other ignore files)
        // but this is the gist of what we're trying to accomplish
        // shell.cp("-R", path.join(sourcePath, "*"), targetFolder)

        const files = ignoreWalk.sync({
            path: sourcePath,
            ignoreFiles: [".gitignore", ".xdignore", ".npmignore"],
            includeEmpty: false,
        }).filter(filterAlwaysIgnoredFile);

        files.forEach(file => {
            const srcFile = path.join(sourcePath, file);
            const tgtFile = path.join(targetFolder, file);
            const tgtDir = path.dirname(tgtFile);
            if (!fs.existsSync(tgtDir)) {
                mkdirp.sync(tgtDir);
            }
            shell.cp(srcFile, tgtFile);
        });

        return Object.assign({}, result, {
github jondot / hygen / src / render.ts View on Github external
async function getFiles(dir) {
  const files = walk
    .sync({ path: dir, ignoreFiles: ['.hygenignore'] })
    .map(f => path.join(dir, f))
  return files
}
github jondot / hygen / lib / render.js View on Github external
_getFiles = _asyncToGenerator(function* (dir) {
    const files = walk.sync({
      path: dir,
      ignoreFiles: ['.hygenignore']
    }).map(f => path.join(dir, f));
    return files;
  });
  return _getFiles.apply(this, arguments);
github jondot / hygen / dist / render.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
        const files = walk
            .sync({ path: dir, ignoreFiles: ['.hygenignore'] })
            .map(f => path.join(dir, f));
        return files;
    });
}
github AdobeXD / xdpm / commands / package.js View on Github external
const id = metadata.id;
        if (!id) {
            return Object.assign({}, result, {
                "error": "Can't package a plugin without a plugin ID in the manifest"
            });
        }

        result.targetZip = path.join(sourcePath, '..', path.basename(sourcePath) + ".xdx");

        const zipfile = new yazl.ZipFile();

        zipfile.outputStream.pipe(fs.createWriteStream(result.targetZip)).on("close", function() {
        });

        const files = ignoreWalk.sync({
            path: sourcePath,
            ignoreFiles: [".gitignore", ".xdignore", ".npmignore"],
            includeEmpty: false,
        }).filter(filterAlwaysIgnoredFile);

        files.forEach(file => {
            zipfile.addFile(path.join(sourcePath, file), file);
        });


        zipfile.end();

        result.ok = `"${metadata.name}"@${metadata.version} [${metadata.id}] packaged successfully at ${result.targetZip}`;
        return result;
    });

ignore-walk

Nested/recursive `.gitignore`/`.npmignore` parsing and filtering.

ISC
Latest version published 5 months ago

Package Health Score

87 / 100
Full package analysis