davglass / cpr

Nodejs cp -R
Other
79 stars 80 forks source link

Update mkdirp dependency #65

Open guimard opened 3 years ago

guimard commented 3 years ago

Hi,

this patch looks enough to update mkdirp dependency to ^1.0.3:

--- a/lib/index.js                                                                                
+++ b/lib/index.js                                                                                
@@ -121,12 +121,12 @@                                                                             
                     err.errno = 27;                                                              
                     options.errors.push(err);                                                    
                 } else {                                                                         
-                    mkdirp(to, stat.mode, stack.add(function(err) {                              
+                    mkdirp(to, stat.mode).catch((err) => {stack.add(function(err) {              
                         /*istanbul ignore next*/                                                 
                         if (err) {                                                               
                             options.errors.push(err);                                            
                         }                                                                        
-                    }));                                                                         
+                    })});                                                                        
                 }                                                                                
             }));                                                                                 
         }                                                                                        
@@ -139,7 +139,7 @@                                                                               

 var copyFile = function(from, to, options, callback) {                                           
     var dir = path.dirname(to);                                                                  
-    mkdirp(dir, function() {                                                                     
+    mkdirp(dir).then( () => {                                                                    
         fs.stat(to, function(statError) {                                                        
             var err;                                                                             
             if(!statError && options.overwrite !== true) {                                       
mfranzke commented 3 years ago

@guimard do you have the chance in providing this code as a pull request? snyk has even already opened a pull request, but without the suggested code changes that you listed here obviously. A pull request might be easier to accept and merge than just an issue.

guimard commented 3 years ago

Hi @mfranzke, done in #68

Cheers, Yadd