renovate 40.29.0 → 40.29.1

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.
@@ -87,16 +87,20 @@ async function postUpgradeCommandsExecutor(filteredUpgradeCommands, config) {
87
87
  ...(0, array_1.coerceArray)(status.not_added),
88
88
  ...(0, array_1.coerceArray)(status.modified),
89
89
  ];
90
- logger_1.logger.trace({ addedOrModifiedFiles }, 'Added or modified files');
91
- logger_1.logger.debug(`Checking ${addedOrModifiedFiles.length} added or modified files for post-upgrade changes`);
90
+ const changedFiles = [
91
+ ...addedOrModifiedFiles,
92
+ ...(0, array_1.coerceArray)(status.deleted),
93
+ ];
92
94
  // Check for files which were previously deleted but have been re-added without modification
93
95
  const previouslyDeletedFiles = updatedArtifacts.filter((ua) => ua.type === 'deletion');
94
96
  for (const previouslyDeletedFile of previouslyDeletedFiles) {
95
- if (!addedOrModifiedFiles.includes(previouslyDeletedFile.path)) {
97
+ if (!changedFiles.includes(previouslyDeletedFile.path)) {
96
98
  logger_1.logger.debug({ file: previouslyDeletedFile.path }, 'Previously deleted file has been restored without modification');
97
99
  updatedArtifacts = updatedArtifacts.filter((ua) => !(ua.type === 'deletion' && ua.path === previouslyDeletedFile.path));
98
100
  }
99
101
  }
102
+ logger_1.logger.trace({ addedOrModifiedFiles }, 'Added or modified files');
103
+ logger_1.logger.debug(`Checking ${addedOrModifiedFiles.length} added or modified files for post-upgrade changes`);
100
104
  for (const relativePath of addedOrModifiedFiles) {
101
105
  let fileMatched = false;
102
106
  for (const pattern of fileFilters) {
@@ -126,11 +130,13 @@ async function postUpgradeCommandsExecutor(filteredUpgradeCommands, config) {
126
130
  for (const relativePath of (0, array_1.coerceArray)(status.deleted)) {
127
131
  for (const pattern of fileFilters) {
128
132
  if ((0, minimatch_1.minimatch)(pattern, { dot: true }).match(relativePath)) {
129
- logger_1.logger.debug({ file: relativePath, pattern }, 'Post-upgrade file removed');
130
- updatedArtifacts.push({
131
- type: 'deletion',
132
- path: relativePath,
133
- });
133
+ if (!updatedArtifacts.some((ua) => ua.path === relativePath && ua.type === 'deletion')) {
134
+ logger_1.logger.debug({ file: relativePath, pattern }, 'Post-upgrade file removed');
135
+ updatedArtifacts.push({
136
+ type: 'deletion',
137
+ path: relativePath,
138
+ });
139
+ }
134
140
  // If the file is created or modified by a previous post-update command, remove the modification from updatedArtifacts
135
141
  updatedArtifacts = updatedArtifacts.filter((ua) => !(ua.type === 'addition' && ua.path === relativePath));
136
142
  }
@@ -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":";;AA0BA,kEAoLC;AAED,6CAwCC;;AAxPD,cAAc;AACd,kEAAkC;AAClC,+CAAsD;AACtD,sDAAyD;AACzD,+CAAqD;AAErD,kDAAqD;AACrD,gDAA6C;AAC7C,4CAI6B;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,gBAAgB;YAC/B,eAAe;SAChB,EACD,iCAAiC,CAClC,CAAC;QACF,MAAM,QAAQ,G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,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":["// TODO #22198\nimport is from '@sindresorhus/is';\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 {\n localPathIsFile,\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 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 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 const execResult = await exec(compiledCmd, {\n cwd: GlobalConfig.get('localDir'),\n });\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\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 // 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 (!addedOrModifiedFiles.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 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 logger.debug(\n { file: relativePath, pattern },\n 'Post-upgrade file removed',\n );\n updatedArtifacts.push({\n type: 'deletion',\n path: relativePath,\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":";;AA0BA,kEA8LC;AAED,6CAwCC;;AAlQD,cAAc;AACd,kEAAkC;AAClC,+CAAsD;AACtD,sDAAyD;AACzD,+CAAqD;AAErD,kDAAqD;AACrD,gDAA6C;AAC7C,4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ChC,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":["// TODO #22198\nimport is from '@sindresorhus/is';\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 {\n localPathIsFile,\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 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 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 const execResult = await exec(compiledCmd, {\n cwd: GlobalConfig.get('localDir'),\n });\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"]}
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": "40.29.0",
4
+ "version": "40.29.1",
5
5
  "type": "commonjs",
6
6
  "bin": {
7
7
  "renovate": "dist/renovate.js",