Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

del is no longer deleting files after updating to v5 #117

Closed
dippas opened this issue Oct 3, 2019 · 2 comments
Closed

del is no longer deleting files after updating to v5 #117

dippas opened this issue Oct 3, 2019 · 2 comments

Comments

@dippas
Copy link

dippas commented Oct 3, 2019

I have this gulpfile (simplified for this use case), that I've been using for awhile

//--------- Include references
const gulp = require('gulp'),
    del = require('del'),
    assetsPath = '../Project.Web/Assets/';
// more references here

//--------- Define Paths
const paths = {
    views: {
        index: 'dist/'
    }
}
// more paths here 

//--------- Clean files
function clean(done) {
    del.sync([(`${paths.views.index.dest}**/`, `${assetsPath}**/`)], {
        force: true
    });
    done();
}
// more functions here

//--------- Create tasks 
gulp.task('clean', clean)
// more tasks here

//--------- Dist folders
gulp.task('build', gulp.series('clean', gulp.parallel(otherNotRelevantTasksHere)

//---------Default task
gulp.task('default', gulp.series('build'))

Since I've updated the del package from 4.1.1 to 5.0.0 (or any newer version) the function itself runs but it doesn't delete the folders

image

I've read a few issues such as #93 or #94 or even #100 , but I couldn't find a solution for this.

Things I've tried:

  • make the function async, by using async function
  • using return and removing sync form del
  • even path.josix.join() but I'm not even using backward-slashes, although I'm in a windows environment.

I would appreciate any help on this because I'd like to keep this package in this project (without to reverse to 4.1.1)

@kevva
Copy link
Contributor

kevva commented Oct 9, 2019

There's a PR with an explanation how to do this #116. Try using one * instead:

del.sync([(`${paths.views.index.dest}*`, `${assetsPath}*`)], {
	force: true
});

@dippas
Copy link
Author

dippas commented Oct 9, 2019

@kevva thank you :) I have seen that PR but didn't associate with my issue.

just a note, I had to delete the parenthesis () inside the square brackets [], otherwise it would only delete the last path.

so finally I ended up with this:

del.sync([`${paths.views.index.dest}*`, `${assetsPath}*`], {
    force: true
});

@dippas dippas closed this as completed Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants