Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clean-remains

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clean-remains

Remove files created in the last run but not anymore in the current one

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

clean-remains

version status node

Remove files created in the last run but not anymore in the current one.

In development environment, build process are run once a file change detected. If a file is removed, the corresponding compiled file (like a browserify bundle) remains, which is redundant and should be deleted.

Example

The following example make the 'build' directory always has the same contents with the 'src' directory.

const gulp = require('gulp')
const clean = require('clean-remains').glob('build/*.js')

gulp.task('sync', function () {
  return gulp.src('src/*.js')
    .pipe(gulp.dest('build'))
    .pipe(clean())
    .once('delete', files => console.log(files))
})

gulp.task('watch', ['sync'], function () {
  gulp.watch('src/*.js', ['sync'])
})

You could delete the whole 'build' directory in the example above. However, if you do that and there are also css files in the 'build' directory, they will be deleted against your will.

API

const Clean = require('clean-remains')

clean = Clean(initialFiles)

Return a function like a gulp plugin, which should be used after gulp.dest.

initialFiles

Type: Array

Required.

If there are no redundant files before the first run, you could pass an empty array.

const gulp = require('gulp')
const clean = require('clean-remains')([])

clean = Clean.glob(patterns, opts)

patterns and opts are passed to [globby] to create the initialFiles.

Keywords

FAQs

Package last updated on 26 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc