mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-26 07:20:39 +00:00
e5c6f38d75
* refactor: enable strict checks * chore: revert changes * chore: fix tsconfig
24 lines
723 B
TypeScript
24 lines
723 B
TypeScript
import Git from 'simple-git';
|
|
import upath from 'upath';
|
|
import { GlobalConfig } from '../../../config/global';
|
|
import { logger } from '../../../logger';
|
|
import type { UpdateDependencyConfig } from '../types';
|
|
|
|
export default async function updateDependency({
|
|
fileContent,
|
|
upgrade,
|
|
}: UpdateDependencyConfig): Promise<string | null> {
|
|
const { localDir } = GlobalConfig.get();
|
|
const git = Git(localDir);
|
|
const submoduleGit = Git(upath.join(localDir, upgrade.depName));
|
|
|
|
try {
|
|
await git.submoduleUpdate(['--init', upgrade.depName!]);
|
|
await submoduleGit.checkout([upgrade.newDigest!]);
|
|
return fileContent;
|
|
} catch (err) {
|
|
logger.debug({ err }, 'submodule checkout error');
|
|
return null;
|
|
}
|
|
}
|