in lib/utils.js [34:56]
generateHashBasedItemIdsInYamlFile: function (content, path, replaceParentID) {
let result = content;
const pathRegex = new RegExp(/^Path: ((\/[^/\r\n]+(?:\/[^/\r\n]+)+)\/(?:[^/\r\n]+))$/, 'gm');
const matches = pathRegex.exec(result);
if (matches.length > 2) {
const ymlPath = matches[1];
const ymlParentPath = matches[2];
// Replace template item ID with ID generated from path hash
const hashedID = guid(ymlPath);
result = result.replace(/^ID: ".+?"$/gmi, 'ID: "' + hashedID + '"');
// Generate Parent hash-based ID only for Layers Roots
if (replaceParentID) {
const hashedParentID = guid(ymlParentPath);
result = result.replace(/^Parent: ".+?"$/gmi, 'Parent: "' + hashedParentID + '"');
}
}
return result;
},