Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function copyAsset(target) {
return fs.copyDir(ASSET_DIR, target, { ignoreHidden: false });
}
fs.exists(assetPrev).then(function(exist) {
if (exist) {
fs.copyDir(assetPrev, assetDest).then(function() {
fs.rmdir(assetPrev);
});
}
});
}
const extendPath = pathFn.join(baseDir, dir);
const extendDist = pathFn.join(deployDir, dir);
if (typeof ignoreHidden === 'object') {
opts.ignoreHidden = ignoreHidden[dir];
} else {
opts.ignoreHidden = ignoreHidden;
}
if (typeof ignorePattern === 'string') {
opts.ignorePattern = new RegExp(ignorePattern);
} else if (typeof ignorePattern === 'object' && Reflect.apply(Object.prototype.hasOwnProperty, ignorePattern, [dir])) {
opts.ignorePattern = new RegExp(ignorePattern[dir]);
}
return fs.copyDir(extendPath, extendDist, opts);
};
return fs.exists(assetSrc).then(exist => {
if (!exist) return;
return fs.copyDir(assetSrc, assetDest).then(() => fs.rmdir(assetSrc));
});
}).thenReturn(result).asCallback(callback);
}).then(() => {
const opts = {};
log.info('Copying files from public folder...');
if (typeof ignoreHidden === 'object') {
opts.ignoreHidden = ignoreHidden.public;
} else {
opts.ignoreHidden = ignoreHidden;
}
if (typeof ignorePattern === 'string') {
opts.ignorePattern = new RegExp(ignorePattern);
} else if (typeof ignorePattern === 'object' && Reflect.apply(Object.prototype.hasOwnProperty, ignorePattern, ['public'])) {
opts.ignorePattern = new RegExp(ignorePattern.public);
}
return fs.copyDir(publicDir, deployDir, opts);
}).then(() => {
log.info('Copying files from extend dirs...');