renovate 41.31.0 → 41.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/options/index.js +1 -1
- package/dist/config/options/index.js.map +1 -1
- package/dist/logger/cmd-serializer.js +2 -1
- package/dist/logger/cmd-serializer.js.map +1 -1
- package/dist/logger/err-serializer.js +2 -2
- package/dist/logger/err-serializer.js.map +1 -1
- package/dist/logger/pretty-stdout.js +2 -1
- package/dist/logger/pretty-stdout.js.map +1 -1
- package/dist/logger/utils.js +1 -1
- package/dist/logger/utils.js.map +1 -1
- package/dist/modules/datasource/conan/index.js +2 -1
- package/dist/modules/datasource/conan/index.js.map +1 -1
- package/dist/modules/datasource/gradle-version/index.js +2 -1
- package/dist/modules/datasource/gradle-version/index.js.map +1 -1
- package/dist/modules/datasource/hexpm-bob/index.js +2 -1
- package/dist/modules/datasource/hexpm-bob/index.js.map +1 -1
- package/dist/modules/manager/bazel/artifacts.js +2 -2
- package/dist/modules/manager/bazel/artifacts.js.map +1 -1
- package/dist/modules/manager/conan/extract.js +2 -2
- package/dist/modules/manager/conan/extract.js.map +1 -1
- package/dist/modules/manager/cpanfile/parser.js +2 -1
- package/dist/modules/manager/cpanfile/parser.js.map +1 -1
- package/dist/modules/manager/crossplane/schema.js +2 -1
- package/dist/modules/manager/crossplane/schema.js.map +1 -1
- package/dist/modules/manager/mise/upgradeable-tooling.js +8 -7
- package/dist/modules/manager/mise/upgradeable-tooling.js.map +1 -1
- package/dist/modules/manager/pip_setup/extract.js +1 -1
- package/dist/modules/manager/pip_setup/extract.js.map +1 -1
- package/dist/modules/manager/poetry/artifacts.js +1 -1
- package/dist/modules/manager/poetry/artifacts.js.map +1 -1
- package/dist/modules/manager/vendir/schema.js +3 -2
- package/dist/modules/manager/vendir/schema.js.map +1 -1
- package/dist/modules/versioning/maven/compare.js +1 -1
- package/dist/modules/versioning/maven/compare.js.map +1 -1
- package/dist/modules/versioning/perl/index.js +1 -1
- package/dist/modules/versioning/perl/index.js.map +1 -1
- package/dist/util/template/index.d.ts +1 -0
- package/dist/util/template/index.js +1 -0
- package/dist/util/template/index.js.map +1 -1
- package/dist/workers/repository/update/branch/execute-post-upgrade-commands.js +3 -0
- package/dist/workers/repository/update/branch/execute-post-upgrade-commands.js.map +1 -1
- package/dist/workers/repository/update/pr/body/index.js +3 -0
- package/dist/workers/repository/update/pr/body/index.js.map +1 -1
- package/package.json +2 -2
- package/renovate-schema.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/util/template/index.ts"],"names":[],"mappings":";;;AAsSA,8CAQC;AAED,0BAuBC;AAED,kCAWC;;AApVD,kEAAkC;AAClC,oEAA4D;AAC5D,gDAAmD;AACnD,yCAAsC;AACtC,oCAAmC;AACnC,yCAA4C;AAC5C,oCAAiC;AAOjC,oBAAU,CAAC,cAAc,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;AACpE,oBAAU,CAAC,cAAc,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;AAEpE,oBAAU,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC,GAAW,EAAE,EAAE,CACxD,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAC1C,CAAC;AAEF,oBAAU,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC,GAAW,EAAE,EAAE,CACxD,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAC5C,CAAC;AAEF,oBAAU,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC,KAAa,EAAU,EAAE,CACxE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAC3C,CAAC;AAEF,oBAAU,CAAC,cAAc,CAAC,QAAQ,EAA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BAAY,CAAC,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,CAAC;IACtD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IACxC,MAAM,aAAa,GAAG,YAAY;QAChC,CAAC,CAAC,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC;QACxC,CAAC,CAAC,IAAI,CAAC;IAET,eAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,oBAAoB,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,oBAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC;IAE3D,IAAI,aAAa,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QAC3B,eAAM,CAAC,IAAI,CACT,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,EACjD,uCAAuC,CACxC,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,WAAW,CACzB,QAAgB,EAChB,KAAmB,EACnB,YAAY,GAAG,IAAI;IAEnB,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAChD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,0BAA0B,CAAC,CAAC;QAC3D,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport handlebars, { type HelperOptions } from 'handlebars';\nimport { GlobalConfig } from '../../config/global';\nimport { logger } from '../../logger';\nimport { toArray } from '../array';\nimport { getChildEnv } from '../exec/utils';\nimport { regEx } from '../regex';\n\n// Missing in handlebars\ntype Options = HelperOptions & {\n lookupProperty: (element: unknown, key: unknown) => unknown;\n};\n\nhandlebars.registerHelper('encodeURIComponent', encodeURIComponent);\nhandlebars.registerHelper('decodeURIComponent', decodeURIComponent);\n\nhandlebars.registerHelper('encodeBase64', (str: string) =>\n Buffer.from(str ?? '').toString('base64'),\n);\n\nhandlebars.registerHelper('decodeBase64', (str: string) =>\n Buffer.from(str ?? '', 'base64').toString(),\n);\n\nhandlebars.registerHelper('stringToPrettyJSON', (input: string): string =>\n JSON.stringify(JSON.parse(input), null, 2),\n);\n\nhandlebars.registerHelper('toJSON', (input: unknown): string =>\n JSON.stringify(input),\n);\n\nhandlebars.registerHelper('toArray', (...args: unknown[]): unknown[] => {\n // Need to remove the 'options', as last parameter\n // https://handlebarsjs.com/api-reference/helpers.html\n args.pop();\n return args;\n});\n\nhandlebars.registerHelper('toObject', (...args: unknown[]): unknown => {\n // Need to remove the 'options', as last parameter\n // https://handlebarsjs.com/api-reference/helpers.html\n args.pop();\n\n if (args.length % 2 !== 0) {\n throw new Error(`Must contain an even number of elements`);\n }\n\n const keys = args.filter((_, index) => index % 2 === 0);\n const values = args.filter((_, index) => index % 2 === 1);\n\n return Object.fromEntries(keys.map((key, index) => [key, values[index]]));\n});\n\nhandlebars.registerHelper('replace', (find, replace, context) =>\n (context ?? '').replace(regEx(find, 'g'), replace),\n);\n\nhandlebars.registerHelper('lowercase', (str: string) => str?.toLowerCase());\n\nhandlebars.registerHelper('containsString', (str, subStr) =>\n str?.includes(subStr),\n);\n\nhandlebars.registerHelper('equals', (arg1, arg2) => arg1 === arg2);\n\nhandlebars.registerHelper('includes', (arg1: string[], arg2: string) => {\n if (is.array(arg1, is.string) && is.string(arg2)) {\n return arg1.includes(arg2);\n }\n\n return false;\n});\n\nhandlebars.registerHelper(\n 'split',\n (str: unknown, separator: unknown): string[] => {\n if (is.string(str) && is.string(separator)) {\n return str.split(separator);\n }\n return [];\n },\n);\n\nhandlebars.registerHelper({\n and(...args) {\n // Need to remove the 'options', as last parameter\n // https://handlebarsjs.com/api-reference/helpers.html\n args.pop();\n return args.every(Boolean);\n },\n or(...args) {\n // Need to remove the 'options', as last parameter\n // https://handlebarsjs.com/api-reference/helpers.html\n args.pop();\n return args.some(Boolean);\n },\n});\n\nhandlebars.registerHelper(\n 'lookupArray',\n (obj: unknown, key: unknown, options: Options): unknown[] => {\n return (\n toArray(obj)\n // skip elements like #with does\n .filter((element) => !handlebars.Utils.isEmpty(element))\n .map((element) => options.lookupProperty(element, key))\n .filter((value) => value !== undefined)\n );\n },\n);\n\nhandlebars.registerHelper('distinct', (obj: unknown): unknown[] => {\n const seen = new Set<string>();\n\n return toArray(obj).filter((value) => {\n const str = JSON.stringify(value);\n\n if (seen.has(str)) {\n return false;\n }\n\n seen.add(str);\n return true;\n });\n});\n\nexport const exposedConfigOptions = [\n 'additionalBranchPrefix',\n 'addLabels',\n 'branchName',\n 'branchPrefix',\n 'branchTopic',\n 'commitBody',\n 'commitMessage',\n 'commitMessageAction',\n 'commitMessageExtra',\n 'commitMessagePrefix',\n 'commitMessageSuffix',\n 'commitMessageTopic',\n 'gitAuthor',\n 'group',\n 'groupName',\n 'groupSlug',\n 'labels',\n 'prBodyColumns',\n 'prBodyDefinitions',\n 'prBodyNotes',\n 'prTitle',\n 'semanticCommitScope',\n 'semanticCommitType',\n 'separateMajorMinor',\n 'separateMinorPatch',\n 'separateMultipleMinor',\n 'sourceDirectory',\n];\n\nexport const allowedFields = {\n baseBranch: 'The baseBranch for this branch/PR',\n body: 'The body of the release notes',\n categories: 'The categories of the manager of the dependency being updated',\n currentValue: 'The extracted current value of the dependency being updated',\n currentVersion:\n 'The version that would be currently installed. For example, if currentValue is ^3.0.0 then currentVersion might be 3.1.0.',\n currentVersionAgeInDays: 'The age of the current version in days',\n currentVersionTimestamp: 'The timestamp of the current version',\n currentDigest: 'The extracted current digest of the dependency being updated',\n currentDigestShort:\n 'The extracted current short digest of the dependency being updated',\n datasource: 'The datasource used to look up the upgrade',\n depName: 'The name of the dependency being updated',\n depNameLinked:\n 'The dependency name already linked to its home page using markdown',\n depNameSanitized:\n 'The depName field sanitized for use in branches after removing spaces and special characters',\n depType: 'The dependency type (if extracted - manager-dependent)',\n depTypes:\n 'A deduplicated array of dependency types (if extracted - manager-dependent) in a branch',\n displayFrom: 'The current value, formatted for display',\n displayPending: 'Latest pending update, if internalChecksFilter is in use',\n displayTo: 'The to value, formatted for display',\n hasReleaseNotes: 'true if the upgrade has release notes',\n indentation: 'The indentation of the dependency being updated',\n isGroup: 'true if the upgrade is part of a group',\n isLockfileUpdate: 'true if the branch is a lock file update',\n isMajor: 'true if the upgrade is major',\n isMinor: 'true if the upgrade is minor',\n isPatch: 'true if the upgrade is a patch upgrade',\n isPin: 'true if the upgrade is pinning dependencies',\n isPinDigest: 'true if the upgrade is pinning digests',\n isRollback: 'true if the upgrade is a rollback PR',\n isReplacement: 'true if the upgrade is a replacement',\n isRange: 'true if the new value is a range',\n isSingleVersion:\n 'true if the upgrade is to a single version rather than a range',\n isVulnerabilityAlert: 'true if the upgrade is a vulnerability alert',\n logJSON: 'ChangeLogResult object for the upgrade',\n manager: 'The (package) manager which detected the dependency',\n newDigest: 'The new digest value',\n newDigestShort:\n 'A shorted version of newDigest, for use when the full digest is too long to be conveniently displayed',\n newMajor:\n 'The major version of the new version. e.g. \"3\" if the new version is \"3.1.0\"',\n newMinor:\n 'The minor version of the new version. e.g. \"1\" if the new version is \"3.1.0\"',\n newPatch:\n 'The patch version of the new version. e.g. \"0\" if the new version is \"3.1.0\"',\n newName:\n 'The name of the new dependency that replaces the current deprecated dependency',\n newValue:\n 'The new value in the upgrade. Can be a range or version e.g. \"^3.0.0\" or \"3.1.0\"',\n newVersion: 'The new version in the upgrade, e.g. \"3.1.0\"',\n newVersionAgeInDays: 'The age of the new version in days',\n packageFile: 'The filename that the dependency was found in',\n packageFileDir:\n 'The directory with full path where the packageFile was found',\n packageName: 'The full name that was used to look up the dependency',\n packageScope: 'The scope of the package name. Supports Maven group ID only',\n parentDir:\n 'The name of the directory that the dependency was found in, without full path',\n parentOrg: 'The name of the parent organization for the current repository',\n platform: 'VCS platform in use, e.g. \"github\", \"gitlab\", etc.',\n prettyDepType: 'Massaged depType',\n prettyNewMajor: 'The new major value with v prepended to it.',\n prettyNewVersion: 'The new version value with v prepended to it.',\n project: 'ChangeLogProject object',\n recreateClosed: 'If true, this PR will be recreated if closed',\n references: 'A list of references for the upgrade',\n releases: 'An array of releases for an upgrade',\n releaseNotes: 'A ChangeLogNotes object for the release',\n releaseTimestamp: 'The timestamp of the release',\n repository: 'The current repository',\n semanticPrefix: 'The fully generated semantic prefix for commit messages',\n sourceRepo: 'The repository in the sourceUrl, if present',\n sourceRepoName: 'The repository name in the sourceUrl, if present',\n sourceRepoOrg: 'The repository organization in the sourceUrl, if present',\n sourceRepoSlug: 'The slugified pathname of the sourceUrl, if present',\n sourceUrl: 'The source URL for the package',\n topLevelOrg:\n 'The name of the top-level organization for the current repository',\n updateType:\n 'One of digest, pin, rollback, patch, minor, major, replacement, pinDigest',\n upgrades: 'An array of upgrade objects in the branch',\n url: 'The url of the release notes',\n version: 'The version number of the changelog',\n versioning: 'The versioning scheme in use',\n versions: 'An array of ChangeLogRelease objects in the upgrade',\n vulnerabilitySeverity:\n 'The severity for a vulnerability alert upgrade (LOW, MEDIUM, MODERATE, HIGH, CRITICAL, UNKNOWN)',\n};\n\ntype CompileInput = Record<string, unknown>;\n\nconst allowedTemplateFields = new Set([\n ...Object.keys(allowedFields),\n ...exposedConfigOptions,\n]);\n\nclass CompileInputProxyHandler implements ProxyHandler<CompileInput> {\n constructor(private warnVariables: Set<string>) {}\n\n get(target: CompileInput, prop: keyof CompileInput): unknown {\n if (prop === 'env') {\n return target[prop];\n }\n\n if (!allowedTemplateFields.has(prop)) {\n this.warnVariables.add(prop);\n return undefined;\n }\n\n const value = target[prop];\n\n if (prop === 'prBodyDefinitions') {\n // Expose all prBodyDefinitions.*\n return value;\n }\n\n if (is.array(value)) {\n return value.map((element) =>\n is.primitive(element)\n ? element\n : proxyCompileInput(element as CompileInput, this.warnVariables),\n );\n }\n\n if (is.plainObject(value)) {\n return proxyCompileInput(value, this.warnVariables);\n }\n\n return value;\n }\n}\n\nexport function proxyCompileInput(\n input: CompileInput,\n warnVariables: Set<string>,\n): CompileInput {\n return new Proxy<CompileInput>(\n input,\n new CompileInputProxyHandler(warnVariables),\n );\n}\n\nexport function compile(\n template: string,\n input: CompileInput,\n filterFields = true,\n): string {\n const env = getChildEnv({});\n const data = { ...GlobalConfig.get(), ...input, env };\n const warnVariables = new Set<string>();\n const filteredInput = filterFields\n ? proxyCompileInput(data, warnVariables)\n : data;\n\n logger.trace({ template, filteredInput }, 'Compiling template');\n const result = handlebars.compile(template)(filteredInput);\n\n if (warnVariables.size > 0) {\n logger.info(\n { varNames: Array.from(warnVariables), template },\n 'Disallowed variable names in template',\n );\n }\n\n return result;\n}\n\nexport function safeCompile(\n template: string,\n input: CompileInput,\n filterFields = true,\n): string {\n try {\n return compile(template, input, filterFields);\n } catch (err) {\n logger.warn({ err, template }, 'Error compiling template');\n return '';\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/util/template/index.ts"],"names":[],"mappings":";;;AAwSA,8CAQC;AAED,0BAuBC;AAED,kCAWC;;AAtVD,kEAAkC;AAClC,oEAA4D;AAC5D,gDAAmD;AACnD,yCAAsC;AACtC,oCAAmC;AACnC,yCAA4C;AAC5C,oCAAiC;AAOjC,oBAAU,CAAC,cAAc,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;AACpE,oBAAU,CAAC,cAAc,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;AAEpE,oBAAU,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC,GAAW,EAAE,EAAE,CACxD,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAC1C,CAAC;AAEF,oBAAU,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC,GAAW,EAAE,EAAE,CACxD,MAAM,CAAC,IAAI,CAAC,GA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AC;QAC3D,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import is from '@sindresorhus/is';\nimport handlebars, { type HelperOptions } from 'handlebars';\nimport { GlobalConfig } from '../../config/global';\nimport { logger } from '../../logger';\nimport { toArray } from '../array';\nimport { getChildEnv } from '../exec/utils';\nimport { regEx } from '../regex';\n\n// Missing in handlebars\ntype Options = HelperOptions & {\n lookupProperty: (element: unknown, key: unknown) => unknown;\n};\n\nhandlebars.registerHelper('encodeURIComponent', encodeURIComponent);\nhandlebars.registerHelper('decodeURIComponent', decodeURIComponent);\n\nhandlebars.registerHelper('encodeBase64', (str: string) =>\n Buffer.from(str ?? '').toString('base64'),\n);\n\nhandlebars.registerHelper('decodeBase64', (str: string) =>\n Buffer.from(str ?? '', 'base64').toString(),\n);\n\nhandlebars.registerHelper('stringToPrettyJSON', (input: string): string =>\n JSON.stringify(JSON.parse(input), null, 2),\n);\n\nhandlebars.registerHelper('toJSON', (input: unknown): string =>\n JSON.stringify(input),\n);\n\nhandlebars.registerHelper('toArray', (...args: unknown[]): unknown[] => {\n // Need to remove the 'options', as last parameter\n // https://handlebarsjs.com/api-reference/helpers.html\n args.pop();\n return args;\n});\n\nhandlebars.registerHelper('toObject', (...args: unknown[]): unknown => {\n // Need to remove the 'options', as last parameter\n // https://handlebarsjs.com/api-reference/helpers.html\n args.pop();\n\n if (args.length % 2 !== 0) {\n throw new Error(`Must contain an even number of elements`);\n }\n\n const keys = args.filter((_, index) => index % 2 === 0);\n const values = args.filter((_, index) => index % 2 === 1);\n\n return Object.fromEntries(keys.map((key, index) => [key, values[index]]));\n});\n\nhandlebars.registerHelper('replace', (find, replace, context) =>\n (context ?? '').replace(regEx(find, 'g'), replace),\n);\n\nhandlebars.registerHelper('lowercase', (str: string) => str?.toLowerCase());\n\nhandlebars.registerHelper('containsString', (str, subStr) =>\n str?.includes(subStr),\n);\n\nhandlebars.registerHelper('equals', (arg1, arg2) => arg1 === arg2);\n\nhandlebars.registerHelper('includes', (arg1: string[], arg2: string) => {\n if (is.array(arg1, is.string) && is.string(arg2)) {\n return arg1.includes(arg2);\n }\n\n return false;\n});\n\nhandlebars.registerHelper(\n 'split',\n (str: unknown, separator: unknown): string[] => {\n if (is.string(str) && is.string(separator)) {\n return str.split(separator);\n }\n return [];\n },\n);\n\nhandlebars.registerHelper({\n and(...args) {\n // Need to remove the 'options', as last parameter\n // https://handlebarsjs.com/api-reference/helpers.html\n args.pop();\n return args.every(Boolean);\n },\n or(...args) {\n // Need to remove the 'options', as last parameter\n // https://handlebarsjs.com/api-reference/helpers.html\n args.pop();\n return args.some(Boolean);\n },\n});\n\nhandlebars.registerHelper(\n 'lookupArray',\n (obj: unknown, key: unknown, options: Options): unknown[] => {\n return (\n toArray(obj)\n // skip elements like #with does\n .filter((element) => !handlebars.Utils.isEmpty(element))\n .map((element) => options.lookupProperty(element, key))\n .filter((value) => value !== undefined)\n );\n },\n);\n\nhandlebars.registerHelper('distinct', (obj: unknown): unknown[] => {\n const seen = new Set<string>();\n\n return toArray(obj).filter((value) => {\n const str = JSON.stringify(value);\n\n if (seen.has(str)) {\n return false;\n }\n\n seen.add(str);\n return true;\n });\n});\n\nexport const exposedConfigOptions = [\n 'additionalBranchPrefix',\n 'addLabels',\n 'branchName',\n 'branchPrefix',\n 'branchTopic',\n 'commitBody',\n 'commitMessage',\n 'commitMessageAction',\n 'commitMessageExtra',\n 'commitMessagePrefix',\n 'commitMessageSuffix',\n 'commitMessageTopic',\n 'gitAuthor',\n 'group',\n 'groupName',\n 'groupSlug',\n 'labels',\n 'prBodyColumns',\n 'prBodyDefinitions',\n 'prBodyNotes',\n 'prTitle',\n 'semanticCommitScope',\n 'semanticCommitType',\n 'separateMajorMinor',\n 'separateMinorPatch',\n 'separateMultipleMinor',\n 'sourceDirectory',\n];\n\nexport const allowedFields = {\n baseBranch: 'The baseBranch for this branch/PR',\n body: 'The body of the release notes',\n categories: 'The categories of the manager of the dependency being updated',\n currentValue: 'The extracted current value of the dependency being updated',\n currentVersion:\n 'The version that would be currently installed. For example, if currentValue is ^3.0.0 then currentVersion might be 3.1.0.',\n currentVersionAgeInDays: 'The age of the current version in days',\n currentVersionTimestamp: 'The timestamp of the current version',\n currentDigest: 'The extracted current digest of the dependency being updated',\n currentDigestShort:\n 'The extracted current short digest of the dependency being updated',\n datasource: 'The datasource used to look up the upgrade',\n depName: 'The name of the dependency being updated',\n depNameLinked:\n 'The dependency name already linked to its home page using markdown',\n depNameSanitized:\n 'The depName field sanitized for use in branches after removing spaces and special characters',\n depType: 'The dependency type (if extracted - manager-dependent)',\n depTypes:\n 'A deduplicated array of dependency types (if extracted - manager-dependent) in a branch',\n displayFrom: 'The current value, formatted for display',\n displayPending: 'Latest pending update, if internalChecksFilter is in use',\n displayTo: 'The to value, formatted for display',\n hasReleaseNotes: 'true if the upgrade has release notes',\n indentation: 'The indentation of the dependency being updated',\n isGroup: 'true if the upgrade is part of a group',\n isLockfileUpdate: 'true if the branch is a lock file update',\n isMajor: 'true if the upgrade is major',\n isMinor: 'true if the upgrade is minor',\n isPatch: 'true if the upgrade is a patch upgrade',\n isPin: 'true if the upgrade is pinning dependencies',\n isPinDigest: 'true if the upgrade is pinning digests',\n isRollback: 'true if the upgrade is a rollback PR',\n isReplacement: 'true if the upgrade is a replacement',\n isRange: 'true if the new value is a range',\n isSingleVersion:\n 'true if the upgrade is to a single version rather than a range',\n isVulnerabilityAlert: 'true if the upgrade is a vulnerability alert',\n logJSON: 'ChangeLogResult object for the upgrade',\n manager: 'The (package) manager which detected the dependency',\n newDigest: 'The new digest value',\n newDigestShort:\n 'A shorted version of newDigest, for use when the full digest is too long to be conveniently displayed',\n newMajor:\n 'The major version of the new version. e.g. \"3\" if the new version is \"3.1.0\"',\n newMinor:\n 'The minor version of the new version. e.g. \"1\" if the new version is \"3.1.0\"',\n newPatch:\n 'The patch version of the new version. e.g. \"0\" if the new version is \"3.1.0\"',\n newName:\n 'The name of the new dependency that replaces the current deprecated dependency',\n newNameLinked:\n 'The new dependency name already linked to its home page using markdown',\n newValue:\n 'The new value in the upgrade. Can be a range or version e.g. \"^3.0.0\" or \"3.1.0\"',\n newVersion: 'The new version in the upgrade, e.g. \"3.1.0\"',\n newVersionAgeInDays: 'The age of the new version in days',\n packageFile: 'The filename that the dependency was found in',\n packageFileDir:\n 'The directory with full path where the packageFile was found',\n packageName: 'The full name that was used to look up the dependency',\n packageScope: 'The scope of the package name. Supports Maven group ID only',\n parentDir:\n 'The name of the directory that the dependency was found in, without full path',\n parentOrg: 'The name of the parent organization for the current repository',\n platform: 'VCS platform in use, e.g. \"github\", \"gitlab\", etc.',\n prettyDepType: 'Massaged depType',\n prettyNewMajor: 'The new major value with v prepended to it.',\n prettyNewVersion: 'The new version value with v prepended to it.',\n project: 'ChangeLogProject object',\n recreateClosed: 'If true, this PR will be recreated if closed',\n references: 'A list of references for the upgrade',\n releases: 'An array of releases for an upgrade',\n releaseNotes: 'A ChangeLogNotes object for the release',\n releaseTimestamp: 'The timestamp of the release',\n repository: 'The current repository',\n semanticPrefix: 'The fully generated semantic prefix for commit messages',\n sourceRepo: 'The repository in the sourceUrl, if present',\n sourceRepoName: 'The repository name in the sourceUrl, if present',\n sourceRepoOrg: 'The repository organization in the sourceUrl, if present',\n sourceRepoSlug: 'The slugified pathname of the sourceUrl, if present',\n sourceUrl: 'The source URL for the package',\n topLevelOrg:\n 'The name of the top-level organization for the current repository',\n updateType:\n 'One of digest, pin, rollback, patch, minor, major, replacement, pinDigest',\n upgrades: 'An array of upgrade objects in the branch',\n url: 'The url of the release notes',\n version: 'The version number of the changelog',\n versioning: 'The versioning scheme in use',\n versions: 'An array of ChangeLogRelease objects in the upgrade',\n vulnerabilitySeverity:\n 'The severity for a vulnerability alert upgrade (LOW, MEDIUM, MODERATE, HIGH, CRITICAL, UNKNOWN)',\n};\n\ntype CompileInput = Record<string, unknown>;\n\nconst allowedTemplateFields = new Set([\n ...Object.keys(allowedFields),\n ...exposedConfigOptions,\n]);\n\nclass CompileInputProxyHandler implements ProxyHandler<CompileInput> {\n constructor(private warnVariables: Set<string>) {}\n\n get(target: CompileInput, prop: keyof CompileInput): unknown {\n if (prop === 'env') {\n return target[prop];\n }\n\n if (!allowedTemplateFields.has(prop)) {\n this.warnVariables.add(prop);\n return undefined;\n }\n\n const value = target[prop];\n\n if (prop === 'prBodyDefinitions') {\n // Expose all prBodyDefinitions.*\n return value;\n }\n\n if (is.array(value)) {\n return value.map((element) =>\n is.primitive(element)\n ? element\n : proxyCompileInput(element as CompileInput, this.warnVariables),\n );\n }\n\n if (is.plainObject(value)) {\n return proxyCompileInput(value, this.warnVariables);\n }\n\n return value;\n }\n}\n\nexport function proxyCompileInput(\n input: CompileInput,\n warnVariables: Set<string>,\n): CompileInput {\n return new Proxy<CompileInput>(\n input,\n new CompileInputProxyHandler(warnVariables),\n );\n}\n\nexport function compile(\n template: string,\n input: CompileInput,\n filterFields = true,\n): string {\n const env = getChildEnv({});\n const data = { ...GlobalConfig.get(), ...input, env };\n const warnVariables = new Set<string>();\n const filteredInput = filterFields\n ? proxyCompileInput(data, warnVariables)\n : data;\n\n logger.trace({ template, filteredInput }, 'Compiling template');\n const result = handlebars.compile(template)(filteredInput);\n\n if (warnVariables.size > 0) {\n logger.info(\n { varNames: Array.from(warnVariables), template },\n 'Disallowed variable names in template',\n );\n }\n\n return result;\n}\n\nexport function safeCompile(\n template: string,\n input: CompileInput,\n filterFields = true,\n): string {\n try {\n return compile(template, input, filterFields);\n } catch (err) {\n logger.warn({ err, template }, 'Error compiling template');\n return '';\n }\n}\n"]}
|
@@ -108,14 +108,17 @@ async function postUpgradeCommandsExecutor(filteredUpgradeCommands, config) {
|
|
108
108
|
addedCount: status.not_added?.length,
|
109
109
|
modifiedCount: status.modified?.length,
|
110
110
|
deletedCount: status.deleted?.length,
|
111
|
+
renamedCount: status.renamed?.length,
|
111
112
|
}, 'git status counts after post-upgrade tasks');
|
112
113
|
const addedOrModifiedFiles = [
|
113
114
|
...(0, array_1.coerceArray)(status.not_added),
|
114
115
|
...(0, array_1.coerceArray)(status.modified),
|
116
|
+
...(0, array_1.coerceArray)(status.renamed?.map((x) => x.to)),
|
115
117
|
];
|
116
118
|
const changedFiles = [
|
117
119
|
...addedOrModifiedFiles,
|
118
120
|
...(0, array_1.coerceArray)(status.deleted),
|
121
|
+
...(0, array_1.coerceArray)(status.renamed?.map((x) => x.from)),
|
119
122
|
];
|
120
123
|
// Check for files which were previously deleted but have been re-added without modification
|
121
124
|
const previouslyDeletedFiles = updatedArtifacts.filter((ua) => ua.type === 'deletion');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"execute-post-upgrade-commands.js","sourceRoot":"","sources":["../../../../../lib/workers/repository/update/branch/execute-post-upgrade-commands.ts"],"names":[],"mappings":";;AA+BA,kEAqOC;AAED,6CAwCC;;AA9SD,4DAA4B;AAC5B,cAAc;AACd,kEAAkC;AAClC,0DAA0B;AAC1B,+CAAsD;AACtD,sDAAyD;AACzD,+CAAqD;AAErD,kDAAqD;AACrD,gDAA6C;AAE7C,4CAM6B;AAC7B,8CAAqD;AAErD,0DAAuD;AACvD,kDAA+C;AAC/C,wDAAqD;AACrD,wDAAoD;AAQ7C,KAAK,UAAU,2BAA2B,CAC/C,uBAA8C,EAC9C,MAAoB;IAEpB,IAAI,gBAAgB,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5D,MAAM,cAAc,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,CAAC;IAC1D,MAAM,eAAe,GAAG,qBAAY,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAE5D,KAAK,MAAM,OAAO,IAAI,uBAAuB,EAAE,CAAC;QAC9C,IAAA,gBAAO,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAClC,eAAM,CAAC,KAAK,CACV;YACE,KAAK,EAAE,OAAO,CAAC,gB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E,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YAChE,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,gBAAgB,EACd,MAAM,CAAC,gBAAiB,CAAC,aAAa,KAAK,QAAQ;gBACjD,CAAC,CAAC,MAAM,CAAC,gBAAgB;gBACzB,CAAC,CAAC,SAAS;YACf,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC;KACF,CAAC;IAEF,MAAM,qBAAqB,GAA0B,MAAM,CAAC,QAAQ,CAAC,MAAM,CACzE,CAAC,EAAE,gBAAgB,EAAE,EAAE,EAAE,CACvB,CAAC,gBAAgB,EAAE,aAAa;QAChC,gBAAgB,CAAC,aAAa,KAAK,QAAQ,CAC9C,CAAC;IAEF,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,GACxC,MAAM,2BAA2B,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACnE,OAAO,2BAA2B,CAAC,qBAAqB,EAAE;QACxD,GAAG,MAAM;QACT,gBAAgB;QAChB,cAAc;KACf,CAAC,CAAC;AACL,CAAC","sourcesContent":["import crypto from 'crypto';\n// TODO #22198\nimport is from '@sindresorhus/is';\nimport upath from 'upath';\nimport { mergeChildConfig } from '../../../../config';\nimport { GlobalConfig } from '../../../../config/global';\nimport { addMeta, logger } from '../../../../logger';\nimport type { ArtifactError } from '../../../../modules/manager/types';\nimport { coerceArray } from '../../../../util/array';\nimport { exec } from '../../../../util/exec';\nimport type { ExecOptions } from '../../../../util/exec/types';\nimport {\n localPathIsFile,\n outputCacheFile,\n privateCacheDir,\n readLocalFile,\n writeLocalFile,\n} from '../../../../util/fs';\nimport { getRepoStatus } from '../../../../util/git';\nimport type { FileChange } from '../../../../util/git/types';\nimport { minimatch } from '../../../../util/minimatch';\nimport { regEx } from '../../../../util/regex';\nimport { sanitize } from '../../../../util/sanitize';\nimport { compile } from '../../../../util/template';\nimport type { BranchConfig, BranchUpgradeConfig } from '../../../types';\n\nexport interface PostUpgradeCommandsExecutionResult {\n updatedArtifacts: FileChange[];\n artifactErrors: ArtifactError[];\n}\n\nexport async function postUpgradeCommandsExecutor(\n filteredUpgradeCommands: BranchUpgradeConfig[],\n config: BranchConfig,\n): Promise<PostUpgradeCommandsExecutionResult> {\n let updatedArtifacts = [...(config.updatedArtifacts ?? [])];\n const artifactErrors = [...(config.artifactErrors ?? [])];\n const allowedCommands = GlobalConfig.get('allowedCommands');\n\n for (const upgrade of filteredUpgradeCommands) {\n addMeta({ dep: upgrade.depName });\n logger.trace(\n {\n tasks: upgrade.postUpgradeTasks,\n allowedCommands,\n },\n `Checking for post-upgrade tasks`,\n );\n const commands = upgrade.postUpgradeTasks?.commands;\n const dataFileTemplate = upgrade.postUpgradeTasks?.dataFileTemplate;\n const fileFilters = upgrade.postUpgradeTasks?.fileFilters ?? ['**/*'];\n if (is.nonEmptyArray(commands)) {\n // Persist updated files in file system so any executed commands can see them\n const previouslyModifiedFiles =\n config.updatedPackageFiles!.concat(updatedArtifacts);\n for (const file of previouslyModifiedFiles) {\n const canWriteFile = await localPathIsFile(file.path);\n if (file.type === 'addition' && !file.isSymlink && canWriteFile) {\n let contents: Buffer | null;\n if (typeof file.contents === 'string') {\n contents = Buffer.from(file.contents);\n } else {\n contents = file.contents;\n }\n // TODO #22198\n await writeLocalFile(file.path, contents!);\n }\n }\n\n let dataFilePath: string | null = null;\n if (dataFileTemplate) {\n const dataFileContent = sanitize(\n compile(dataFileTemplate, mergeChildConfig(config, upgrade)),\n );\n logger.debug(\n { dataFileTemplate },\n 'Processed post-upgrade commands data file template.',\n );\n\n const dataFileName = `post-upgrade-data-file-${crypto.randomBytes(8).toString('hex')}.tmp`;\n dataFilePath = upath.join(privateCacheDir(), dataFileName);\n\n try {\n await outputCacheFile(dataFilePath, dataFileContent);\n\n logger.debug(\n { dataFilePath, dataFileContent },\n 'Created post-upgrade commands data file.',\n );\n } catch (error) {\n artifactErrors.push({\n stderr: sanitize(\n `Failed to create post-upgrade commands data file at ${dataFilePath}, reason: ${error.message}`,\n ),\n });\n\n dataFilePath = null;\n }\n }\n\n for (const cmd of commands) {\n const compiledCmd = compile(cmd, mergeChildConfig(config, upgrade));\n if (compiledCmd !== cmd) {\n logger.debug(\n { rawCmd: cmd, compiledCmd },\n 'Post-upgrade command has been compiled',\n );\n }\n if (\n allowedCommands!.some((pattern) => regEx(pattern).test(compiledCmd))\n ) {\n try {\n logger.trace({ cmd: compiledCmd }, 'Executing post-upgrade task');\n\n const execOpts: ExecOptions = {\n cwd: GlobalConfig.get('localDir'),\n };\n if (dataFilePath) {\n execOpts.env = {\n RENOVATE_POST_UPGRADE_COMMAND_DATA_FILE: dataFilePath,\n };\n }\n const execResult = await exec(compiledCmd, execOpts);\n\n logger.debug(\n { cmd: compiledCmd, ...execResult },\n 'Executed post-upgrade task',\n );\n } catch (error) {\n artifactErrors.push({\n lockFile: upgrade.packageFile,\n stderr: sanitize(error.message),\n });\n }\n } else {\n logger.warn(\n {\n cmd: compiledCmd,\n allowedCommands,\n },\n 'Post-upgrade task did not match any on allowedCommands list',\n );\n artifactErrors.push({\n lockFile: upgrade.packageFile,\n stderr: sanitize(\n `Post-upgrade command '${compiledCmd}' has not been added to the allowed list in allowedCommands`,\n ),\n });\n }\n }\n\n const status = await getRepoStatus();\n\n logger.trace({ status }, 'git status after post-upgrade tasks');\n\n logger.debug(\n {\n addedCount: status.not_added?.length,\n modifiedCount: status.modified?.length,\n deletedCount: status.deleted?.length,\n },\n 'git status counts after post-upgrade tasks',\n );\n\n const addedOrModifiedFiles = [\n ...coerceArray(status.not_added),\n ...coerceArray(status.modified),\n ];\n const changedFiles = [\n ...addedOrModifiedFiles,\n ...coerceArray(status.deleted),\n ];\n\n // Check for files which were previously deleted but have been re-added without modification\n const previouslyDeletedFiles = updatedArtifacts.filter(\n (ua) => ua.type === 'deletion',\n );\n for (const previouslyDeletedFile of previouslyDeletedFiles) {\n if (!changedFiles.includes(previouslyDeletedFile.path)) {\n logger.debug(\n { file: previouslyDeletedFile.path },\n 'Previously deleted file has been restored without modification',\n );\n updatedArtifacts = updatedArtifacts.filter(\n (ua) =>\n !(\n ua.type === 'deletion' && ua.path === previouslyDeletedFile.path\n ),\n );\n }\n }\n\n logger.trace({ addedOrModifiedFiles }, 'Added or modified files');\n logger.debug(\n `Checking ${addedOrModifiedFiles.length} added or modified files for post-upgrade changes`,\n );\n\n for (const relativePath of addedOrModifiedFiles) {\n let fileMatched = false;\n for (const pattern of fileFilters) {\n if (minimatch(pattern, { dot: true }).match(relativePath)) {\n fileMatched = true;\n logger.debug(\n { file: relativePath, pattern },\n 'Post-upgrade file saved',\n );\n const existingContent = await readLocalFile(relativePath);\n const existingUpdatedArtifacts = updatedArtifacts.find(\n (ua) => ua.path === relativePath,\n );\n if (existingUpdatedArtifacts?.type === 'addition') {\n existingUpdatedArtifacts.contents = existingContent;\n } else {\n updatedArtifacts.push({\n type: 'addition',\n path: relativePath,\n contents: existingContent,\n });\n }\n // If the file is deleted by a previous post-update command, remove the deletion from updatedArtifacts\n updatedArtifacts = updatedArtifacts.filter(\n (ua) => !(ua.type === 'deletion' && ua.path === relativePath),\n );\n }\n }\n if (!fileMatched) {\n logger.debug(\n { file: relativePath },\n 'Post-upgrade file did not match any file filters',\n );\n }\n }\n\n for (const relativePath of coerceArray(status.deleted)) {\n for (const pattern of fileFilters) {\n if (minimatch(pattern, { dot: true }).match(relativePath)) {\n if (\n !updatedArtifacts.some(\n (ua) => ua.path === relativePath && ua.type === 'deletion',\n )\n ) {\n logger.debug(\n { file: relativePath, pattern },\n 'Post-upgrade file removed',\n );\n updatedArtifacts.push({\n type: 'deletion',\n path: relativePath,\n });\n }\n // If the file is created or modified by a previous post-update command, remove the modification from updatedArtifacts\n updatedArtifacts = updatedArtifacts.filter(\n (ua) => !(ua.type === 'addition' && ua.path === relativePath),\n );\n }\n }\n }\n }\n }\n return { updatedArtifacts, artifactErrors };\n}\n\nexport default async function executePostUpgradeCommands(\n config: BranchConfig,\n): Promise<PostUpgradeCommandsExecutionResult | null> {\n const hasChangedFiles =\n (is.array(config.updatedPackageFiles) &&\n config.updatedPackageFiles.length > 0) ||\n (is.array(config.updatedArtifacts) && config.updatedArtifacts.length > 0);\n\n if (!hasChangedFiles) {\n /* Only run post-upgrade tasks if there are changes to package files... */\n logger.debug('No changes to package files, skipping post-upgrade tasks');\n return null;\n }\n\n const branchUpgradeCommands: BranchUpgradeConfig[] = [\n {\n manager: config.manager,\n depName: config.upgrades.map(({ depName }) => depName).join(' '),\n branchName: config.branchName,\n postUpgradeTasks:\n config.postUpgradeTasks!.executionMode === 'branch'\n ? config.postUpgradeTasks\n : undefined,\n fileFilters: config.fileFilters,\n },\n ];\n\n const updateUpgradeCommands: BranchUpgradeConfig[] = config.upgrades.filter(\n ({ postUpgradeTasks }) =>\n !postUpgradeTasks?.executionMode ||\n postUpgradeTasks.executionMode === 'update',\n );\n\n const { updatedArtifacts, artifactErrors } =\n await postUpgradeCommandsExecutor(updateUpgradeCommands, config);\n return postUpgradeCommandsExecutor(branchUpgradeCommands, {\n ...config,\n updatedArtifacts,\n artifactErrors,\n });\n}\n"]}
|
1
|
+
{"version":3,"file":"execute-post-upgrade-commands.js","sourceRoot":"","sources":["../../../../../lib/workers/repository/update/branch/execute-post-upgrade-commands.ts"],"names":[],"mappings":";;AA+BA,kEAwOC;AAED,6CAwCC;;AAjTD,4DAA4B;AAC5B,cAAc;AACd,kEAAkC;AAClC,0DAA0B;AAC1B,+CAAsD;AACtD,sDAAyD;AACzD,+CAAqD;AAErD,kDAAqD;AACrD,gDAA6C;AAE7C,4CAM6B;AAC7B,8CAAqD;AAErD,0DAAuD;AACvD,kDAA+C;AAC/C,wDAAqD;AACrD,wDAAoD;AAQ7C,KAAK,UAAU,2BAA2B,CAC/C,uBAA8C,EAC9C,MAAoB;IAEpB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AE,EAAE,EAAE,CACvB,CAAC,gBAAgB,EAAE,aAAa;QAChC,gBAAgB,CAAC,aAAa,KAAK,QAAQ,CAC9C,CAAC;IAEF,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,GACxC,MAAM,2BAA2B,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACnE,OAAO,2BAA2B,CAAC,qBAAqB,EAAE;QACxD,GAAG,MAAM;QACT,gBAAgB;QAChB,cAAc;KACf,CAAC,CAAC;AACL,CAAC","sourcesContent":["import crypto from 'crypto';\n// TODO #22198\nimport is from '@sindresorhus/is';\nimport upath from 'upath';\nimport { mergeChildConfig } from '../../../../config';\nimport { GlobalConfig } from '../../../../config/global';\nimport { addMeta, logger } from '../../../../logger';\nimport type { ArtifactError } from '../../../../modules/manager/types';\nimport { coerceArray } from '../../../../util/array';\nimport { exec } from '../../../../util/exec';\nimport type { ExecOptions } from '../../../../util/exec/types';\nimport {\n localPathIsFile,\n outputCacheFile,\n privateCacheDir,\n readLocalFile,\n writeLocalFile,\n} from '../../../../util/fs';\nimport { getRepoStatus } from '../../../../util/git';\nimport type { FileChange } from '../../../../util/git/types';\nimport { minimatch } from '../../../../util/minimatch';\nimport { regEx } from '../../../../util/regex';\nimport { sanitize } from '../../../../util/sanitize';\nimport { compile } from '../../../../util/template';\nimport type { BranchConfig, BranchUpgradeConfig } from '../../../types';\n\nexport interface PostUpgradeCommandsExecutionResult {\n updatedArtifacts: FileChange[];\n artifactErrors: ArtifactError[];\n}\n\nexport async function postUpgradeCommandsExecutor(\n filteredUpgradeCommands: BranchUpgradeConfig[],\n config: BranchConfig,\n): Promise<PostUpgradeCommandsExecutionResult> {\n let updatedArtifacts = [...(config.updatedArtifacts ?? [])];\n const artifactErrors = [...(config.artifactErrors ?? [])];\n const allowedCommands = GlobalConfig.get('allowedCommands');\n\n for (const upgrade of filteredUpgradeCommands) {\n addMeta({ dep: upgrade.depName });\n logger.trace(\n {\n tasks: upgrade.postUpgradeTasks,\n allowedCommands,\n },\n `Checking for post-upgrade tasks`,\n );\n const commands = upgrade.postUpgradeTasks?.commands;\n const dataFileTemplate = upgrade.postUpgradeTasks?.dataFileTemplate;\n const fileFilters = upgrade.postUpgradeTasks?.fileFilters ?? ['**/*'];\n if (is.nonEmptyArray(commands)) {\n // Persist updated files in file system so any executed commands can see them\n const previouslyModifiedFiles =\n config.updatedPackageFiles!.concat(updatedArtifacts);\n for (const file of previouslyModifiedFiles) {\n const canWriteFile = await localPathIsFile(file.path);\n if (file.type === 'addition' && !file.isSymlink && canWriteFile) {\n let contents: Buffer | null;\n if (typeof file.contents === 'string') {\n contents = Buffer.from(file.contents);\n } else {\n contents = file.contents;\n }\n // TODO #22198\n await writeLocalFile(file.path, contents!);\n }\n }\n\n let dataFilePath: string | null = null;\n if (dataFileTemplate) {\n const dataFileContent = sanitize(\n compile(dataFileTemplate, mergeChildConfig(config, upgrade)),\n );\n logger.debug(\n { dataFileTemplate },\n 'Processed post-upgrade commands data file template.',\n );\n\n const dataFileName = `post-upgrade-data-file-${crypto.randomBytes(8).toString('hex')}.tmp`;\n dataFilePath = upath.join(privateCacheDir(), dataFileName);\n\n try {\n await outputCacheFile(dataFilePath, dataFileContent);\n\n logger.debug(\n { dataFilePath, dataFileContent },\n 'Created post-upgrade commands data file.',\n );\n } catch (error) {\n artifactErrors.push({\n stderr: sanitize(\n `Failed to create post-upgrade commands data file at ${dataFilePath}, reason: ${error.message}`,\n ),\n });\n\n dataFilePath = null;\n }\n }\n\n for (const cmd of commands) {\n const compiledCmd = compile(cmd, mergeChildConfig(config, upgrade));\n if (compiledCmd !== cmd) {\n logger.debug(\n { rawCmd: cmd, compiledCmd },\n 'Post-upgrade command has been compiled',\n );\n }\n if (\n allowedCommands!.some((pattern) => regEx(pattern).test(compiledCmd))\n ) {\n try {\n logger.trace({ cmd: compiledCmd }, 'Executing post-upgrade task');\n\n const execOpts: ExecOptions = {\n cwd: GlobalConfig.get('localDir'),\n };\n if (dataFilePath) {\n execOpts.env = {\n RENOVATE_POST_UPGRADE_COMMAND_DATA_FILE: dataFilePath,\n };\n }\n const execResult = await exec(compiledCmd, execOpts);\n\n logger.debug(\n { cmd: compiledCmd, ...execResult },\n 'Executed post-upgrade task',\n );\n } catch (error) {\n artifactErrors.push({\n lockFile: upgrade.packageFile,\n stderr: sanitize(error.message),\n });\n }\n } else {\n logger.warn(\n {\n cmd: compiledCmd,\n allowedCommands,\n },\n 'Post-upgrade task did not match any on allowedCommands list',\n );\n artifactErrors.push({\n lockFile: upgrade.packageFile,\n stderr: sanitize(\n `Post-upgrade command '${compiledCmd}' has not been added to the allowed list in allowedCommands`,\n ),\n });\n }\n }\n\n const status = await getRepoStatus();\n\n logger.trace({ status }, 'git status after post-upgrade tasks');\n\n logger.debug(\n {\n addedCount: status.not_added?.length,\n modifiedCount: status.modified?.length,\n deletedCount: status.deleted?.length,\n renamedCount: status.renamed?.length,\n },\n 'git status counts after post-upgrade tasks',\n );\n\n const addedOrModifiedFiles = [\n ...coerceArray(status.not_added),\n ...coerceArray(status.modified),\n ...coerceArray(status.renamed?.map((x) => x.to)),\n ];\n const changedFiles = [\n ...addedOrModifiedFiles,\n ...coerceArray(status.deleted),\n ...coerceArray(status.renamed?.map((x) => x.from)),\n ];\n\n // Check for files which were previously deleted but have been re-added without modification\n const previouslyDeletedFiles = updatedArtifacts.filter(\n (ua) => ua.type === 'deletion',\n );\n for (const previouslyDeletedFile of previouslyDeletedFiles) {\n if (!changedFiles.includes(previouslyDeletedFile.path)) {\n logger.debug(\n { file: previouslyDeletedFile.path },\n 'Previously deleted file has been restored without modification',\n );\n updatedArtifacts = updatedArtifacts.filter(\n (ua) =>\n !(\n ua.type === 'deletion' && ua.path === previouslyDeletedFile.path\n ),\n );\n }\n }\n\n logger.trace({ addedOrModifiedFiles }, 'Added or modified files');\n logger.debug(\n `Checking ${addedOrModifiedFiles.length} added or modified files for post-upgrade changes`,\n );\n\n for (const relativePath of addedOrModifiedFiles) {\n let fileMatched = false;\n for (const pattern of fileFilters) {\n if (minimatch(pattern, { dot: true }).match(relativePath)) {\n fileMatched = true;\n logger.debug(\n { file: relativePath, pattern },\n 'Post-upgrade file saved',\n );\n const existingContent = await readLocalFile(relativePath);\n const existingUpdatedArtifacts = updatedArtifacts.find(\n (ua) => ua.path === relativePath,\n );\n if (existingUpdatedArtifacts?.type === 'addition') {\n existingUpdatedArtifacts.contents = existingContent;\n } else {\n updatedArtifacts.push({\n type: 'addition',\n path: relativePath,\n contents: existingContent,\n });\n }\n // If the file is deleted by a previous post-update command, remove the deletion from updatedArtifacts\n updatedArtifacts = updatedArtifacts.filter(\n (ua) => !(ua.type === 'deletion' && ua.path === relativePath),\n );\n }\n }\n if (!fileMatched) {\n logger.debug(\n { file: relativePath },\n 'Post-upgrade file did not match any file filters',\n );\n }\n }\n\n for (const relativePath of coerceArray(status.deleted)) {\n for (const pattern of fileFilters) {\n if (minimatch(pattern, { dot: true }).match(relativePath)) {\n if (\n !updatedArtifacts.some(\n (ua) => ua.path === relativePath && ua.type === 'deletion',\n )\n ) {\n logger.debug(\n { file: relativePath, pattern },\n 'Post-upgrade file removed',\n );\n updatedArtifacts.push({\n type: 'deletion',\n path: relativePath,\n });\n }\n // If the file is created or modified by a previous post-update command, remove the modification from updatedArtifacts\n updatedArtifacts = updatedArtifacts.filter(\n (ua) => !(ua.type === 'addition' && ua.path === relativePath),\n );\n }\n }\n }\n }\n }\n return { updatedArtifacts, artifactErrors };\n}\n\nexport default async function executePostUpgradeCommands(\n config: BranchConfig,\n): Promise<PostUpgradeCommandsExecutionResult | null> {\n const hasChangedFiles =\n (is.array(config.updatedPackageFiles) &&\n config.updatedPackageFiles.length > 0) ||\n (is.array(config.updatedArtifacts) && config.updatedArtifacts.length > 0);\n\n if (!hasChangedFiles) {\n /* Only run post-upgrade tasks if there are changes to package files... */\n logger.debug('No changes to package files, skipping post-upgrade tasks');\n return null;\n }\n\n const branchUpgradeCommands: BranchUpgradeConfig[] = [\n {\n manager: config.manager,\n depName: config.upgrades.map(({ depName }) => depName).join(' '),\n branchName: config.branchName,\n postUpgradeTasks:\n config.postUpgradeTasks!.executionMode === 'branch'\n ? config.postUpgradeTasks\n : undefined,\n fileFilters: config.fileFilters,\n },\n ];\n\n const updateUpgradeCommands: BranchUpgradeConfig[] = config.upgrades.filter(\n ({ postUpgradeTasks }) =>\n !postUpgradeTasks?.executionMode ||\n postUpgradeTasks.executionMode === 'update',\n );\n\n const { updatedArtifacts, artifactErrors } =\n await postUpgradeCommandsExecutor(updateUpgradeCommands, config);\n return postUpgradeCommandsExecutor(branchUpgradeCommands, {\n ...config,\n updatedArtifacts,\n artifactErrors,\n });\n}\n"]}
|
@@ -21,9 +21,11 @@ function massageUpdateMetadata(config) {
|
|
21
21
|
const { homepage, sourceUrl, sourceDirectory, changelogUrl, dependencyUrl, } = upgrade;
|
22
22
|
// TODO: types (#22198)
|
23
23
|
let depNameLinked = upgrade.depName;
|
24
|
+
let newNameLinked = upgrade.newName;
|
24
25
|
const primaryLink = homepage ?? sourceUrl ?? dependencyUrl;
|
25
26
|
if (primaryLink) {
|
26
27
|
depNameLinked = `[${depNameLinked}](${primaryLink})`;
|
28
|
+
newNameLinked = `[${newNameLinked}](${primaryLink})`;
|
27
29
|
}
|
28
30
|
let sourceRootPath = 'tree/HEAD';
|
29
31
|
if (sourceUrl) {
|
@@ -49,6 +51,7 @@ function massageUpdateMetadata(config) {
|
|
49
51
|
depNameLinked += ` (${otherLinks.join(', ')})`;
|
50
52
|
}
|
51
53
|
upgrade.depNameLinked = depNameLinked;
|
54
|
+
upgrade.newNameLinked = newNameLinked;
|
52
55
|
const references = [];
|
53
56
|
if (homepage) {
|
54
57
|
references.push(`[homepage](${homepage})`);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/body/index.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lib/workers/repository/update/pr/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AU,CAAC,EAAE,MAAM,CAAC,CAAC;QACnD,MAAM,aAAa,GAAG,IAAA,iBAAQ,EAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;QACvE,MAAM,IAAI,wBAAwB,aAAa,OAAO,CAAC;QACvD,MAAM,GAAG,mBAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAE9D,IAAI,YAAY,EAAE,cAAc,EAAE,CAAC;YACjC,MAAM,GAAG,MAAM,CAAC,OAAO,CACrB,aAAa,EACb,iBAAiB,YAAY,CAAC,cAAc,EAAE,CAC/C,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { RenovateConfig } from '../../../../../config/types';\nimport type { PrDebugData } from '../../../../../modules/platform';\nimport { platform } from '../../../../../modules/platform';\nimport { detectPlatform } from '../../../../../util/common';\nimport { regEx } from '../../../../../util/regex';\nimport { toBase64 } from '../../../../../util/string';\nimport * as template from '../../../../../util/template';\nimport { joinUrlParts } from '../../../../../util/url';\nimport type { BranchConfig } from '../../../../types';\nimport { getDepWarningsPR, getWarnings } from '../../../errors-warnings';\nimport { getChangelogs } from './changelogs';\nimport { getPrConfigDescription } from './config-description';\nimport { getControls } from './controls';\nimport { getPrFooter } from './footer';\nimport { getPrHeader } from './header';\nimport { getPrExtraNotes, getPrNotes } from './notes';\nimport { getPrUpdatesTable } from './updates-table';\n\nfunction massageUpdateMetadata(config: BranchConfig): void {\n config.upgrades.forEach((upgrade) => {\n const {\n homepage,\n sourceUrl,\n sourceDirectory,\n changelogUrl,\n dependencyUrl,\n } = upgrade;\n // TODO: types (#22198)\n let depNameLinked = upgrade.depName!;\n let newNameLinked = upgrade.newName!;\n const primaryLink = homepage ?? sourceUrl ?? dependencyUrl;\n if (primaryLink) {\n depNameLinked = `[${depNameLinked}](${primaryLink})`;\n newNameLinked = `[${newNameLinked}](${primaryLink})`;\n }\n\n let sourceRootPath = 'tree/HEAD';\n if (sourceUrl) {\n const sourcePlatform = detectPlatform(sourceUrl);\n if (sourcePlatform === 'bitbucket') {\n sourceRootPath = 'src/HEAD';\n } else if (sourcePlatform === 'bitbucket-server') {\n sourceRootPath = 'browse';\n }\n }\n\n const otherLinks = [];\n if (sourceUrl && (!!sourceDirectory || homepage)) {\n otherLinks.push(\n `[source](${getFullSourceUrl(sourceUrl, sourceRootPath, sourceDirectory)})`,\n );\n }\n const templatedChangelogUrl = changelogUrl\n ? template.compile(changelogUrl, upgrade, true)\n : undefined;\n if (templatedChangelogUrl) {\n otherLinks.push(`[changelog](${templatedChangelogUrl})`);\n }\n if (otherLinks.length) {\n depNameLinked += ` (${otherLinks.join(', ')})`;\n }\n upgrade.depNameLinked = depNameLinked;\n upgrade.newNameLinked = newNameLinked;\n const references: string[] = [];\n if (homepage) {\n references.push(`[homepage](${homepage})`);\n }\n if (sourceUrl) {\n references.push(\n `[source](${getFullSourceUrl(sourceUrl, sourceRootPath, sourceDirectory)})`,\n );\n }\n if (templatedChangelogUrl) {\n references.push(`[changelog](${templatedChangelogUrl})`);\n }\n upgrade.references = references.join(', ');\n });\n}\n\nfunction getFullSourceUrl(\n sourceUrl: string,\n sourceRootPath: string,\n sourceDirectory?: string,\n): string {\n let fullUrl = sourceUrl;\n if (sourceDirectory) {\n fullUrl = joinUrlParts(sourceUrl, sourceRootPath, sourceDirectory);\n }\n\n return fullUrl;\n}\n\ninterface PrBodyConfig {\n appendExtra?: string | null | undefined;\n rebasingNotice?: string;\n debugData: PrDebugData;\n}\n\nconst rebasingRegex = regEx(/\\*\\*Rebasing\\*\\*: .*/);\n\nexport function getPrBody(\n branchConfig: BranchConfig,\n prBodyConfig: PrBodyConfig,\n config: RenovateConfig,\n): string {\n massageUpdateMetadata(branchConfig);\n let warnings = '';\n warnings += getWarnings(branchConfig);\n if (branchConfig.packageFiles) {\n warnings += getDepWarningsPR(\n branchConfig.packageFiles,\n config,\n branchConfig.dependencyDashboard,\n );\n }\n const content = {\n header: getPrHeader(branchConfig),\n table: getPrUpdatesTable(branchConfig),\n warnings,\n notes: getPrNotes(branchConfig) + getPrExtraNotes(branchConfig),\n changelogs: getChangelogs(branchConfig),\n configDescription: getPrConfigDescription(branchConfig),\n controls: getControls(),\n footer: getPrFooter(branchConfig),\n };\n\n let prBody = '';\n if (branchConfig.prBodyTemplate) {\n const prBodyTemplate = branchConfig.prBodyTemplate;\n prBody = template.compile(prBodyTemplate, content, false);\n prBody = prBody.trim();\n prBody = prBody.replace(regEx(/\\n\\n\\n+/g), '\\n\\n');\n const prDebugData64 = toBase64(JSON.stringify(prBodyConfig.debugData));\n prBody += `\\n<!--renovate-debug:${prDebugData64}-->\\n`;\n prBody = platform.massageMarkdown(prBody, config.rebaseLabel);\n\n if (prBodyConfig?.rebasingNotice) {\n prBody = prBody.replace(\n rebasingRegex,\n `**Rebasing**: ${prBodyConfig.rebasingNotice}`,\n );\n }\n }\n return prBody;\n}\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "renovate",
|
3
3
|
"description": "Automated dependency updates. Flexible so you don't need to be.",
|
4
|
-
"version": "41.
|
4
|
+
"version": "41.32.0",
|
5
5
|
"type": "commonjs",
|
6
6
|
"bin": {
|
7
7
|
"renovate": "dist/renovate.js",
|
@@ -262,7 +262,7 @@
|
|
262
262
|
"vuln-vects": "1.1.0",
|
263
263
|
"xmldoc": "2.0.2",
|
264
264
|
"yaml": "2.8.0",
|
265
|
-
"zod": "3.25.
|
265
|
+
"zod": "3.25.74"
|
266
266
|
},
|
267
267
|
"optionalDependencies": {
|
268
268
|
"better-sqlite3": "12.2.0",
|
package/renovate-schema.json
CHANGED
@@ -6778,7 +6778,7 @@
|
|
6778
6778
|
"description": "Table column definitions to use in PR tables.",
|
6779
6779
|
"type": "object",
|
6780
6780
|
"default": {
|
6781
|
-
"Package": "{{{depNameLinked}}}",
|
6781
|
+
"Package": "{{{depNameLinked}}}{{#if newName}}{{#unless (equals depName newName)}} → {{{newNameLinked}}}{{/unless}}{{/if}}",
|
6782
6782
|
"Type": "{{{depType}}}",
|
6783
6783
|
"Update": "{{{updateType}}}",
|
6784
6784
|
"Current value": "{{{currentValue}}}",
|