简体   繁体   中英

Globby and rimraf should remove everything except .yml files

The following js code (executed through foundation build) should actually clean the whole folder defined in PATHS.springDist except .yml files, instead it deletes everything.

function cleanSpring(done) {
    globby([PATHS.springDist + '/*', '!.yml']).then(paths => {
        paths.map(item => {
            rimraf(item, done);
        });
    });
}

What could be wrong?

I finally found it myself, actually i was in the wrong folder with "!*.yml" This way it's working fine:

function cleanSpring(done) {
    let path = PATHS.springDist;
    globby([path+ '/**/*', '!' + path + '/*.yml']).then(paths => {
        paths.map(item => {
          rimraf(item, done);
        });
    });
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM