mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 13:48:55 +00:00
22 lines
669 B
TypeScript
22 lines
669 B
TypeScript
import { logger } from '../../../logger';
|
|
import type { UpdateDependencyConfig } from '../types';
|
|
|
|
const updateLine = '#copier updated';
|
|
|
|
/**
|
|
* updateDependency appends a comment line once.
|
|
* This is only for the purpose of triggering the artifact update.
|
|
* Copier needs to update its answers file itself.
|
|
*/
|
|
export function updateDependency({
|
|
fileContent,
|
|
upgrade,
|
|
}: UpdateDependencyConfig): string | null {
|
|
logger.trace({ upgrade }, `copier.updateDependency()`);
|
|
if (!fileContent.endsWith(updateLine)) {
|
|
logger.debug(`append update line to the fileContent if it hasn't been`);
|
|
return `${fileContent}\n${updateLine}`;
|
|
}
|
|
|
|
return fileContent;
|
|
}
|