Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function copyDirSync(src, dest, filter, rel) {
fs.existsSync(dest) || wrench.mkdirSyncRecursive(dest);
fs.existsSync(src) && fs.readdirSync(src).forEach(function (name) {
var from = path.join(src, name),
to = path.join(dest, name);
if (fs.existsSync(from) && (!filter || filter.test(name))) {
if (fs.statSync(from).isDirectory()) {
// we only want to apply the filter to the root of the directory being copied... I think
!ignoreDirs.test(name) && copyDirSync(from, to, null, rel);
// !ignoreDirs.test(name) && copyDirSync(from, to, filter, rel);
} else if (!ignoreFiles.test(name)) {
copyFileSync(from, to, rel);
}
}
});
}
function copyFolder(source, destination) {
if (path.existsSync(source)) {
//create the destination folder if it does not exist
if (!path.existsSync(destination)) {
wrench.mkdirSyncRecursive(destination, "0755");
}
wrench.copyDirSyncRecursive(source, destination);
}
}
function copyFolder(source, destination) {
//create the destination folder if it does not exist
if (!path.existsSync(destination)) {
wrench.mkdirSyncRecursive(destination, "0755");
}
wrench.copyDirSyncRecursive(source, destination);
}
function copyJnextDependencies(session) {
var conf = session.conf,
src = path.normalize(conf.DEPENDENCIES_JNEXT),
dest = path.normalize(session.sourcePaths.JNEXT_PLUGINS);
if (!path.existsSync(dest)) {
wrench.mkdirSyncRecursive(dest, "0755");
}
wrench.copyDirSyncRecursive(src, dest);
}
var toPath = function (file) {
var p = path.resolve(__dirname + "/../tmp/" + file),
dirname = path.dirname(p),
basename = path.basename(p);
if (mapper && mapper.transform) {
p = mapper.transform(file, p);
}
if (!path.existsSync(dirname)) {
try {
wrench.mkdirSyncRecursive(dirname, 0777);
} catch (err) {}
}
return p;
};