Nonchalantly Performs Magic

    @xtwest/clear-require-cache

    0.1.6 • Public • Published

    Clear Require Cache

    Dependency Status

    Watch files and clear them from require.cache whenever changes are made.

    Installation

    Install locally:

    $ npm install sapientnitrola/clear-require-cache --save-dev
    

    Install globally to have clearcache available in your path:

    $ npm install sapientnitrola/clear-require-cache -g
    

    Usage

    Module

    const clearRequireCache = require( 'clear-require-cache' );
    clearRequireCache( patterns, options );

    CLI

    Globally installed:

    clearcache [options] <pattern> [patterns...]

    Locally installed:

    ./node_modules/.bin/clearcache [options] <pattern> [patterns...]

    Module Arguments

    patterns

    File glob patterns. See supported minimatch patterns.

    • Type: String, Array
    • Required: true

    Example:

    const clearRequireCache = require( 'clear-require-cache' );
    clearRequireCache( '**/*.js' );

    Note: The node_modules directory is ignored by default.

    options

    Defaults to the options supported by chokidar. This object is passed directly to chokidar, but not all options will be relavent to the scope of clear-require-cache.

    • Type: Object
    • Required: false

    options.quiet

    Suppress all log messages.

    • Type: Boolean
    • Default: false

    CLI

    Usage: clearcache [options] <pattern> [patterns...]
     
    Multiple glob patterns can passed as a space delimited list.
    To prevent shell globbing, wrap each pattern in quotes.
    Glob primer: https://github.com/isaacs/node-glob#glob-primer
     
    Options:
     
      -h, --help     output usage information
      -V, --version  output the version number
      -q, --quiet    Suppress all log messages.
     
     
    Examples:
     
      Watch all files with '.js' extension
      $ clearcache '**/*.js'
     
      Watch all files with '.js' extension, except ones in the "tests" directory
      $ clearcache '**/*.js' '!tests/*.js'

    TODO

    • Describe some common use cases.
    • Cross platform testing.
    • Test suite.
    • Travis CI

    Install

    npm i @xtwest/clear-require-cache

    DownloadsWeekly Downloads

    4

    Version

    0.1.6

    License

    MIT

    Last publish

    Collaborators

    • christowiz
    • danielapopescu
    • mlgantt
    • ryanfitzer
    • sbmadhav
    • tisalig
    • vbalcom