Check for conflicts, and get prompted for action (when needed), before writing a file to disk.
$ cnpm install detect-conflicts
Check for conflicts, and get prompted for action (when needed), before writing a file to disk.
Some of this code is based on the conflicter in yeoman-generator and the visual diff method in verb.
Install with npm
$ npm i detect-conflicts --save
var detect = require('detect-conflicts');
var file = {path: 'fixtures/a.txt', contents: 'aaa'};
detect(file, function (res) {
// `res` would be a user response. we'll only get to this
// point if the user chooses not to abort.
});
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright © 2015 Jon Schlinkert BSD license Copyright (c) Google Released under the MIT license.
This file was generated by verb-cli on August 19, 2015.
Copyright 2013 - present © cnpmjs.org | Home |