Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
removeDirectory('.tmp', function() {
var files = wrench.readdirSyncRecursive('static');
files.forEach(function(file) {
var filePath = 'static/' + file;
var distPath = '.whdist/static/' + file;
if(!fs.lstatSync(filePath).isDirectory() && !fs.existsSync(distPath)) {
var fileData = fs.readFileSync(filePath);
fs.writeFileSync(distPath, fileData);
}
});
done();
});
}
removeDirectory('.tmp', function() {
var files = wrench.readdirSyncRecursive('static');
files.forEach(function(file) {
var filePath = 'static/' + file;
var distPath = '.whdist/static/' + file;
if(!fs.lstatSync(filePath).isDirectory() && !fs.existsSync(distPath)) {
var fileData = fs.readFileSync(filePath);
fs.writeFileSync(distPath, fileData);
}
});
done();
});
}
listFiles: function (directory, filter) {
var files = wrench.readdirSyncRecursive(directory),
filteredFiles = [];
files.forEach(function (file) {
//On mac wrench.readdirSyncRecursive does not return absolute paths, so resolve one.
file = path.resolve(directory, file);
if (filter(file)) {
filteredFiles.push(file);
}
});
return filteredFiles;
},
listFiles: function (directory, filter) {
var files = wrench.readdirSyncRecursive(directory),
filteredFiles = [];
files.forEach(function (file) {
//On mac wrench.readdirSyncRecursive does not return absolute paths, so resolve one.
file = path.resolve(directory, file);
if (filter(file)) {
filteredFiles.push(file);
}
});
return filteredFiles;
},
listFiles: function (directory, filter) {
var files = wrench.readdirSyncRecursive(directory),
filteredFiles = [];
files.forEach(function (file) {
//On mac wrench.readdirSyncRecursive does not return absolute paths, so resolve one.
file = path.resolve(directory, file);
if (filter(file)) {
filteredFiles.push(file);
}
});
return filteredFiles;
},