mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-15 09:06:25 +00:00
44d953737d
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
28 lines
811 B
TypeScript
28 lines
811 B
TypeScript
import { regEx } from '../../../util/regex';
|
|
import { GitRefsDatasource } from '../../datasource/git-refs';
|
|
import { id as nixpkgsVersioning } from '../../versioning/nixpkgs';
|
|
import type { PackageDependency, PackageFile } from '../types';
|
|
|
|
const nixpkgsRegex = regEx(/"github:nixos\/nixpkgs\/(?<ref>[a-z0-9-.]+)"/i);
|
|
|
|
export function extractPackageFile(content: string): PackageFile | null {
|
|
const deps: PackageDependency[] = [];
|
|
|
|
const match = nixpkgsRegex.exec(content);
|
|
if (match?.groups) {
|
|
const { ref } = match.groups;
|
|
deps.push({
|
|
depName: 'nixpkgs',
|
|
currentValue: ref,
|
|
datasource: GitRefsDatasource.id,
|
|
packageName: 'https://github.com/NixOS/nixpkgs',
|
|
versioning: nixpkgsVersioning,
|
|
});
|
|
}
|
|
|
|
if (deps.length) {
|
|
return { deps };
|
|
}
|
|
|
|
return null;
|
|
}
|