sfdx-experiences-plugin
Version:
SFDX plugin to manage ExperienceBundle metadata
24 lines • 1.2 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("./core");
/**
* Returns the names of the route files to copy from the source bundle to the target bundle.
*
* @param {string} sourceBundlePath Path to the source bundle.
* @param {string} targetBundlePath Path to the target bundle.
* @param {boolean} [overwrite=false] Copy files that already exist in the target bundle.
* @param {string[]} [includeFiles] Copy only files with the given names.
* @returns {string[]} Names of the route files to copy from source to target.
*/
function getRoutesToCopy(sourceBundlePath, targetBundlePath, overwrite = false, includeFiles) {
let routesToCopy = core_1.getRoutesFileNames(sourceBundlePath);
if (includeFiles) {
routesToCopy = routesToCopy.filter(sourceRouteFile => includeFiles.includes(sourceRouteFile));
}
if (overwrite)
return routesToCopy;
const targetRoutes = core_1.getRoutesFileNames(targetBundlePath);
return routesToCopy.filter(sourceRouteFile => !targetRoutes.includes(sourceRouteFile));
}
exports.default = getRoutesToCopy;
//# sourceMappingURL=get-routes-to-copy.js.map
;