mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
feat(bazelisk): add support for bazelisk bazelversion files (#16114)
This commit is contained in:
parent
22d2681a6e
commit
461cbc7551
5 changed files with 78 additions and 0 deletions
|
@ -5,6 +5,7 @@ import * as azurePipelines from './azure-pipelines';
|
|||
import * as batect from './batect';
|
||||
import * as batectWrapper from './batect-wrapper';
|
||||
import * as bazel from './bazel';
|
||||
import * as bazelisk from './bazelisk';
|
||||
import * as bitbucketPipelines from './bitbucket-pipelines';
|
||||
import * as buildkite from './buildkite';
|
||||
import * as bundler from './bundler';
|
||||
|
@ -79,6 +80,7 @@ api.set('azure-pipelines', azurePipelines);
|
|||
api.set('batect', batect);
|
||||
api.set('batect-wrapper', batectWrapper);
|
||||
api.set('bazel', bazel);
|
||||
api.set('bazelisk', bazelisk);
|
||||
api.set('bitbucket-pipelines', bitbucketPipelines);
|
||||
api.set('buildkite', buildkite);
|
||||
api.set('bundler', bundler);
|
||||
|
|
53
lib/modules/manager/bazelisk/extract.spec.ts
Normal file
53
lib/modules/manager/bazelisk/extract.spec.ts
Normal file
|
@ -0,0 +1,53 @@
|
|||
import { extractPackageFile } from '.';
|
||||
|
||||
describe('modules/manager/bazelisk/extract', () => {
|
||||
describe('extractPackageFile()', () => {
|
||||
it('returns a result', () => {
|
||||
const res = extractPackageFile('5.2.0\n');
|
||||
expect(res.deps).toEqual([
|
||||
{
|
||||
currentValue: '5.2.0',
|
||||
datasource: 'github-releases',
|
||||
depName: 'bazel',
|
||||
packageName: 'bazelbuild/bazel',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('supports ranges', () => {
|
||||
const res = extractPackageFile('5.2\n');
|
||||
expect(res.deps).toEqual([
|
||||
{
|
||||
currentValue: '5.2',
|
||||
datasource: 'github-releases',
|
||||
depName: 'bazel',
|
||||
packageName: 'bazelbuild/bazel',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('skips non ranges', () => {
|
||||
const res = extractPackageFile('latestn');
|
||||
expect(res.deps).toEqual([
|
||||
{
|
||||
currentValue: 'latestn',
|
||||
datasource: 'github-releases',
|
||||
depName: 'bazel',
|
||||
packageName: 'bazelbuild/bazel',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('ignores comments past the first line', () => {
|
||||
const res = extractPackageFile('5.2.0\n# comment1\n\n# comment2');
|
||||
expect(res.deps).toEqual([
|
||||
{
|
||||
currentValue: '5.2.0',
|
||||
datasource: 'github-releases',
|
||||
depName: 'bazel',
|
||||
packageName: 'bazelbuild/bazel',
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
12
lib/modules/manager/bazelisk/extract.ts
Normal file
12
lib/modules/manager/bazelisk/extract.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { GithubReleasesDatasource } from '../../datasource/github-releases';
|
||||
import type { PackageDependency, PackageFile } from '../types';
|
||||
|
||||
export function extractPackageFile(content: string): PackageFile {
|
||||
const dep: PackageDependency = {
|
||||
depName: 'bazel',
|
||||
currentValue: content.split('\n', 2)[0].trim(),
|
||||
datasource: GithubReleasesDatasource.id,
|
||||
packageName: 'bazelbuild/bazel',
|
||||
};
|
||||
return { deps: [dep] };
|
||||
}
|
10
lib/modules/manager/bazelisk/index.ts
Normal file
10
lib/modules/manager/bazelisk/index.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { GithubReleasesDatasource } from '../../datasource/github-releases';
|
||||
|
||||
export { extractPackageFile } from './extract';
|
||||
|
||||
export const defaultConfig = {
|
||||
fileMatch: ['(^|\\/)\\.bazelversion$'],
|
||||
pinDigests: false,
|
||||
};
|
||||
|
||||
export const supportedDatasources = [GithubReleasesDatasource.id];
|
1
lib/modules/manager/bazelisk/readme.md
Normal file
1
lib/modules/manager/bazelisk/readme.md
Normal file
|
@ -0,0 +1 @@
|
|||
Simply keeps the `.bazelversion` file updated.
|
Loading…
Reference in a new issue