renovate/lib/manager/git-submodules/update.ts
2021-02-16 12:33:44 +01:00

20 lines
540 B
TypeScript

import Git from 'simple-git';
import upath from 'upath';
import { UpdateDependencyConfig } from '../common';
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.newVersion]);
return fileContent;
} catch (err) {
return null;
}
}