0.2.0 • Published 7 years ago

vinyl-not-modified v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

This is a small package for Vinyl that will skip writing a file that has been modified by the user since the transform stream last ran.

Example

import notModified = require('vinyl-not-modified')
import * as vfs from "vinyl-fs"

vfs.src('/path/to/some/sources/**/*.js')
  // some custom transforms here ...
  .pipe(notModified('/path/to/dest/dir/hashes.json'))
  .pipe(vfs.dest('/path/to/dest/dir'))

Usage

notModified(catalogFilePath, options)

catalogFilePath is a path to a JSON file (generally in the output directory) that will contain a set of hashes of the current build. catalogFilePath must be absolute, otherwise it this module will not work.

options is optional. If set, it is an object which can contain the following properties:

  • dest is the destination directory where transformed files are written to. Defaults to path.dirname(catalogFilePath)
  • mayOverwrite is a predicate returning a promise indicating if the file, which has been modified, may still be overwritten. Usually, you will want to prompt the user for a confirmation using something like readline.
  • indent specifies indentation to use for serializing the JSON file. Entirely optional and mainly useful for debugging.