mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-14 08:36:26 +00:00
19 lines
542 B
TypeScript
19 lines
542 B
TypeScript
import Git from 'simple-git';
|
|
import upath from 'upath';
|
|
import type { UpdateDependencyConfig } from '../types';
|
|
|
|
export default async function updateDependency({
|
|
fileContent,
|
|
upgrade,
|
|
}: UpdateDependencyConfig): Promise<string | null> {
|
|
const git = Git(upgrade.localDir);
|
|
const submoduleGit = Git(upath.join(upgrade.localDir, upgrade.depName));
|
|
|
|
try {
|
|
await git.submoduleUpdate(['--init', upgrade.depName]);
|
|
await submoduleGit.checkout([upgrade.newDigest]);
|
|
return fileContent;
|
|
} catch (err) {
|
|
return null;
|
|
}
|
|
}
|