mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-31 09:41:46 +00:00
930cf6633c
fix: Additional vi.mock path corrections and prettier formatting
19 lines
520 B
TypeScript
19 lines
520 B
TypeScript
import { logger } from '../../../logger/index.ts';
|
|
import type { PackageFileContent } from '../types.ts';
|
|
import { ComposerExtract } from './schema.ts';
|
|
|
|
export async function extractPackageFile(
|
|
content: string,
|
|
packageFile: string,
|
|
): Promise<PackageFileContent | null> {
|
|
const res = await ComposerExtract.safeParseAsync({
|
|
content,
|
|
fileName: packageFile,
|
|
});
|
|
if (!res.success) {
|
|
logger.debug({ packageFile, err: res.error }, 'Composer: extract failed');
|
|
return null;
|
|
}
|
|
return res.data;
|
|
}
|