node package manager

noprob

Simple file change monitoring for any kind of development.

Noprob

Simple file change monitoring for any kind of development.

Note: Noprob has just been released and I haven't had the chance to test it on Windows yet. I'll get to it soon.

Why?

Having a utility that can restart or recompile or reconfigure or rewhatever whenever you change a file can be incredibly convenient. Many programs of this sort are geared to work with a specific toolchain or tend to be overly complicated for what should be a simple task.

No worries. Noprob's got your back, no problem.

Installation

Install npm. (it comes with Node.js).

Run: $ npm -g install noprob

Options

  • -h, --help
    • Output usage information.
  • -x, --exec [command]
    • String to execute globally on any file change.
    • Wrap command strings in single ' or double " quotes (though they can be left off if you are doing a simple command with no spaces or special characters like ls).
    • Global commands run once on startup and then upon every file change that matches the specified extensions.
  • -l, --local [command]
    • String to execute locally on any file that's changed as it is changed. Wrap in quotes as needed.
    • Local commands have the unique ability to use command tags to dynamically insert information sections of the changed file's path.
  • -w, --watch [directory]
    • Directory to watch.
  • -e, --extension [extensions]
    • List of file extensions to watch. Wrap in quotes as needed.
    • Separate extensions with a |.
  • -d, --dot
    • Watch hidden dot files.
    • Files that begin with a '.' or that are in a folder that begins with a '.' are ignored by default. Use this option to watch them.

Local Command Tags

Tags can be an extremely powerful way to execute commands on specific files. Simply insert the tags into your local command string like noprob -l 'echo <ext>' and they will be replaced with the associated information from the changed file's path.

  • is the full path (e.g. path/to/file.txt)
  • is the directory that contains the file (e.g. `path/to/`)
  • is the full filename including the extension (e.g. file.txt)
  • is the file's name without the extension (e.g. file)
  • is the file's extension (e.g. txt)

To further demonstrate, the following commands are equivalent:

$ noprob -l 'echo <full>'

$ noprob -l 'echo <dir><fullfile>'

$ noprob -l 'echo <dir><name>.<ext>'

though the last command would be left with a trailing . if the file has no extension while the other two would not.

Example Usage

Run and restart a node server on javascript source changes:

  • $ noprob -x 'node server.js' -e 'js'

Compile individual coffescript files in the "src" folder into javascript on demand (closely mimics coffescript's internal --watch option):

  • $ noprob -l 'coffee -c <fullfile>' -e 'coffee' -w src

Copy changed txt files into a mirrored directory tree under the 'copies' folder but with a .changed before the extension:

  • $ noprob -l 'mkdir -p copies/<dir> ; cp <full> copies/<dir><name>.changed.<ext>' -e txt