Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonschlinkert/gulp-conflicts
Detects when a file to be written is different than an existing file and, if necessary, prompts the user for action.
https://github.com/jonschlinkert/gulp-conflicts
conflict conflicts detect files gulp gulpplugin javascript node nodejs prompt stream through
Last synced: 4 months ago
JSON representation
Detects when a file to be written is different than an existing file and, if necessary, prompts the user for action.
- Host: GitHub
- URL: https://github.com/jonschlinkert/gulp-conflicts
- Owner: jonschlinkert
- License: mit
- Created: 2018-11-22T09:41:55.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-22T09:42:35.000Z (about 6 years ago)
- Last Synced: 2024-10-05T00:21:33.480Z (4 months ago)
- Topics: conflict, conflicts, detect, files, gulp, gulpplugin, javascript, node, nodejs, prompt, stream, through
- Language: JavaScript
- Size: 384 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-conflicts [![NPM version](https://img.shields.io/npm/v/gulp-conflicts.svg?style=flat)](https://www.npmjs.com/package/gulp-conflicts) [![NPM monthly downloads](https://img.shields.io/npm/dm/gulp-conflicts.svg?style=flat)](https://npmjs.org/package/gulp-conflicts) [![NPM total downloads](https://img.shields.io/npm/dt/gulp-conflicts.svg?style=flat)](https://npmjs.org/package/gulp-conflicts) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/gulp-conflicts.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/gulp-conflicts)
> Detects when a (new) vinyl file is different than an existing file on the file system, and either prompts the user for action, skips the file, or calls a function on the file to determine the action to take.
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save gulp-conflicts
```## Usage
Pass the same destination value (string or function) to the `conflicts()` plugin that you pass to `gulp.dest()`. This is necessary so the plugin can check for existing files that may conflict with (proposed) files before they are written.
```js
const conflicts = require('gulp-conflicts');
const gulp = require('gulp');gulp.task('default', () => {
let dest = file => path.join(file.base, 'foo');return gulp.src('*.js')
.pipe(conflicts(dest))
.pipe(gulp.dest(dest));
});
```## File detection
1. The existing file's contents is compared with `file.contents` on the vinyl file
2. If the contents of both are identical, no action is taken, the file is skipped
3. If the contents differ, the user is prompted for action
4. If no conflicting file exists, the vinyl file is written to the file system**Params**
* `dest` **{String}**: The same desination directory passed to `app.dest()`
* `returns` **{String}****Example**
```js
app.src('foo/*.js')
.pipe(conflicts('foo'))
.pipe(app.dest('foo'));
```## About
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
Running Tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```### Author
**Jon Schlinkert**
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)### License
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on November 22, 2018._