Giter Site home page Giter Site logo

Comments (10)

landed1 avatar landed1 commented on August 12, 2024 1

I am here too ..issues on shared drive requires the force option...here is my code

gulp.task('clean',function(){
  return gulp.src(DEST)
      .pipe(vinylPaths(del(DEST, { force: true })));
});

I was using vinylPaths as I wanted to do this on a stream of ONLY changed files

from del.

TrySound avatar TrySound commented on August 12, 2024

@jzp74 Read documentation, please. New api uses promises instead of callback.

from del.

jzp74 avatar jzp74 commented on August 12, 2024

@TrySound Thanks for your reply. You mean this documentation: https://github.com/gulpjs/gulp/blob/master/docs/API.md?
Not sure I understand how that would change my gulp clean task. Can you elaborate a bit more?

from del.

TrySound avatar TrySound commented on August 12, 2024

@jzp74 This documentation
https://github.com/sindresorhus/del

from del.

TrySound avatar TrySound commented on August 12, 2024

@jzp74 Instead of passing callback as the last argument you can just return result of del function. gulp tasks accept streams and promises.

from del.

jzp74 avatar jzp74 commented on August 12, 2024

@TrySound Thanks!

So I tried this with a normal directory

gulp.task('clean', function(cb) {
    del(['dist/css/*.css'], { force: true });
    cb();
});

Works perfectly. I then tried this (basically the same) with the shared location

gulp.task('clean', function(cb) {
    del(['//some/network/location/dist/css/*.css'], { force: true });
    cb();
});

Doesn't work and renders no errors or warning. This should work right?

Then tried this to see if something is perhaps wrong wiith my shared location.

gulp.task('clean', function (cb) {
    exec('rm -fr //some/network/location/dist/css/*', function (err, stdout, stderr) {
    console.log(stdout);
    console.log(stderr);
    cb(err);
    });
})

Works perfectly. It looks like del doesn't work with shared locations. Am I still doing something wrong? Is there something else you would like me to test?

from del.

TrySound avatar TrySound commented on August 12, 2024

@jzp74 Do not use callback here. You call cb before del end.

gulp.task('clean', function() {
    return del(['dist/css/*.css'], { force: true });
});

from del.

TrySound avatar TrySound commented on August 12, 2024

@jzp74 I don't know about shared location.
/cc @sindresorhus

from del.

jzp74 avatar jzp74 commented on August 12, 2024

Removed the callback for both the local delete and the shared location delete. Same results: local delete works, shared location delete doesn't

from del.

schnittstabil avatar schnittstabil commented on August 12, 2024

ATM, glob does not support UNC globs, see isaacs/node-glob#74 and isaacs/node-glob#146. Thus, this also applies to del.

However there's a workaround:

  1. use glob's root option: The place where patterns starting with / will be mounted onto.
  2. use a glob pattern starting with /.
  3. use del's force option: Allow deleting the current working directory and outside.

Example:

del('/dist/css/*.css', {
  root: '//ComputerName/SharedFolder',
  force: true,
});

Notes:

  1. globbing ComputerNames is not possible – Windows processes these in a different way

  2. globbing SharedFolders is not possible – Windows processes these in a different way

  3. Promises fail silently, i. e. to output error message one need to catch it:

    del().then(console.log).catch(console.error)
  4. Of course, gulp outputs errors, but only if one return the Promise:

    gulp.task('clean', function() {
      return del();
    });

This should answer all questions.

from del.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.