npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

del-paths

v0.1.0

Published

Create an array of ignore paths suitable for use with the 'del' module from a file or folder path.

Downloads

2

Readme

del-paths

Create an array of ignore paths suitable for use with the del module from a file or folder path.

Installation

npm install del-paths

Usage

const del = require('del');
const delPaths = require('del-paths')({ debug: true });
const gulp = require('gulp');
const minimist = require('minimist');

const argv = minimist(process.argv.slice(2));

gulp.task('clean', function taskClean() {
  const BOWER_PATH = '.tmp/assets/bower_components';
  const CLEAN_EXCEPTIONS = (argv.cleanTempVendor === true);
  const VENDOR_PATH = '.tmp/assets/vendor';
  var sourceGlobs = ['.tmp/**'];
  if (CLEAN_EXCEPTIONS !== true) {
    sourceGlobs = sourceGlobs.concat(
      delPaths.ignore([BOWER_PATH, VENDOR_PATH]).paths(),
      // delPaths doesn't know if a path is to a file or folder, so it
      // can't automatically ignore all descendants. So, manually add
      // descendant ignoring for folders.
      '!' + BOWER_PATH + '/**',
      '!' + VENDOR_PATH + '/**'
    );
  }
  return del(sourceGlobs);
})

// delPaths.ignore([BOWER_PATH, VENDOR_PATH]).paths() =>
// [
//   '!.tmp',
//   '!.tmp/assets',
//   '!.tmp/assets/bower_components',
//   '!.tmp/assets/vendor'
// ]

API

delPaths([options])

options

Type: Object

options.debug

Type: Boolean

Default: false

The initial state for debug mode. Setting this to true will log additional messages to the console during execution.

See also enableDebug in delPaths.debug(enableDebug).

delPaths.debug(enableDebug)

Toggle debug mode on or off.

Returns itself for method chaining.

enableDebug

Type: Boolean

Default: false

Setting this to true will log additional messages to the console during execution.

delPaths.ignore(paths[, options])

Adds the path and its ancestors to an internal list of paths. Each path will only appear once in the list.

Returns itself for method chaining.

paths

Type: String or Array (of Strings)

Paths that you want the del module to ignore.

  1. If a path doesn't already start with !, it will be added
  2. Slashes will be normalized. Any backward slashes (\) will be replaced with forward slashes (/)
  3. Trailing slashes will be removed

This method does not handle glob patterns, so they will be skipped.

options

Type: Object

options.sort

Type: Boolean

Default: false

A boolean indicationg whether or not the method should sort the internal list of paths if the method modifies the list. By default, this is turned off since delPaths.paths() will return a sorted list.

delPaths.paths()

Returns the internal list of paths as an array of strings, sorted alphabetically.

delPaths.reset()

Empties the internal list of paths.

Returns itself for method chaining.