mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-26 07:20:39 +00:00
8f2ffc0e90
* feat(manager/mise): support remote `include` entries * feat(manager/mise): support digest pinning of `include` refs via comment hints * feat(manager/mise): support git references of remote task files * fix(manager/mise): use gitlab-tags for gitlab.com references * refactor(manager/mise): only support `# <version>` and `# <branch>` hints * refactor(manager/mise): parse git references with parseGitUrl * feat(manager/mise): support http and Azure DevOps ssh git references * refactor(manager/mise): separate remote reference datasources from backends * docs(manager/mise): add tag ref example for remote includes
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { getDep } from '../dockerfile/extract.ts';
|
|
import type { PackageDependency } from '../types.ts';
|
|
import { extractGitReference } from './git-reference.ts';
|
|
|
|
const ociPrefix = 'oci::';
|
|
|
|
function extractOciInclude(include: string): PackageDependency {
|
|
// `replaceString` and the template cover the image reference only,
|
|
// so the `oci::` prefix stays in place.
|
|
const dep = getDep(include.slice(ociPrefix.length));
|
|
return { ...dep, depType: 'include' };
|
|
}
|
|
|
|
/**
|
|
* Extracts a remote `include` entry of a mise configuration file.
|
|
* `content` is the raw file, used to read trailing comment hints.
|
|
* @link https://mise.jdx.dev/configuration.html#include
|
|
*/
|
|
export function extractInclude(
|
|
include: string,
|
|
content: string,
|
|
): PackageDependency {
|
|
const trimmed = include.trim();
|
|
if (trimmed.startsWith(ociPrefix)) {
|
|
return extractOciInclude(trimmed);
|
|
}
|
|
const gitDep = extractGitReference(trimmed, content, 'include');
|
|
if (gitDep) {
|
|
return gitDep;
|
|
}
|
|
return {
|
|
depName: trimmed,
|
|
depType: 'include',
|
|
skipReason: 'unsupported-url',
|
|
};
|
|
}
|