Skip to content

Commit f391c50

Browse files
authored
docs(json-schema): add constraints and installTools (#42834)
* docs(json-schema): add `constraints` and `installTools` This requires `toolNames` and `additionalConstraintNames` are exported for use. * fixup! docs(json-schema): add `constraints` and `installTools`
1 parent 03cc426 commit f391c50

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

lib/util/exec/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { Options as ExecaOptions } from 'execa';
66
*
77
* TODO #41849 replace with upstream types
88
*/
9-
const toolNames = [
9+
export const toolNames = [
1010
'bazelisk',
1111
'bun',
1212
'bundler',
@@ -62,7 +62,7 @@ export function isToolName(value: unknown): value is ToolName {
6262
/**
6363
* Additional constraints that can be specified for some Managers, but are **not** tools that Containerbase supports.
6464
*/
65-
const additionalConstraintNames = [
65+
export const additionalConstraintNames = [
6666
/**
6767
* Used in the `gomod` manager to specify the version of the Go toolchain to use.
6868
*

tools/docs/schema.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import type {
44
RenovateRequiredOption,
55
} from '../../lib/config/types.ts';
66
import { pkg } from '../../lib/expose.ts';
7+
import {
8+
additionalConstraintNames,
9+
toolNames,
10+
} from '../../lib/util/exec/types.ts';
711
import { hasKey } from '../../lib/util/object.ts';
812
import { updateFile } from '../utils/index.ts';
913

@@ -122,6 +126,39 @@ function createSingleConfig(option: RenovateOptions): Record<string, unknown> {
122126
) {
123127
temp.$ref = '#';
124128
}
129+
130+
if (option.name === 'constraints') {
131+
temp.additionalProperties = false;
132+
temp.properties = {};
133+
134+
for (const tool of [...toolNames]) {
135+
temp.properties[tool] = {
136+
type: 'string',
137+
description: `A constraint for the \`${tool}\` Containerbase tool`,
138+
};
139+
}
140+
141+
for (const constraintName of [...additionalConstraintNames]) {
142+
temp.properties[constraintName] = {
143+
type: 'string',
144+
description: `A constraint for \`${constraintName}\``,
145+
};
146+
}
147+
}
148+
149+
if (option.name === 'installTools') {
150+
temp.additionalProperties = false;
151+
temp.properties = {};
152+
153+
for (const tool of [...toolNames]) {
154+
temp.properties[tool] = {
155+
type: 'object',
156+
description: `Install the \`${tool}\` Containerbase tool`,
157+
additionalProperties: false,
158+
};
159+
}
160+
}
161+
125162
return temp;
126163
}
127164

0 commit comments

Comments
 (0)