Skip to content

Commit 1b90057

Browse files
author
GitHub Workflow
committed
Merge branch 'main' into v1
2 parents b74f068 + 538ba0c commit 1b90057

File tree

4 files changed

+52
-6
lines changed

4 files changed

+52
-6
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ In this section, ONLY edit between "extra content" marker comments!
6767
- [dependencyDashboardMajor](#dependencydashboardmajor)
6868
- [keepFresh](#keepfresh)
6969
- [newConfigWarningIssue](#newconfigwarningissue)
70+
- [restrictNode](#restrictnode)
7071
- [scheduleNoisy](#schedulenoisy)
7172
<!-- end presets TOC -->
7273

@@ -538,7 +539,7 @@ Group all rollup-related updates (except when initially pinning).
538539

539540
#### `groupTypes`
540541

541-
Group minor and patch updates to @types devDependencies.
542+
Group minor and patch updates to `@types` `devDependencies`.
542543

543544
<details><summary><b>Show config JSON</b></summary>
544545

@@ -733,6 +734,31 @@ Always create a new issue if there's a config problem (for visibility).
733734

734735
---
735736

737+
#### `restrictNode(<arg0>)`
738+
739+
Restrict @types/node version to the range `arg0`.
740+
741+
<details><summary><b>Show config JSON</b></summary>
742+
743+
```json
744+
{
745+
"packageRules": [
746+
{
747+
"matchPackageNames": ["@types/node"],
748+
"allowedVersions": "{{arg0}}"
749+
}
750+
]
751+
}
752+
```
753+
754+
</details>
755+
756+
<!-- start extra content (EDITABLE between these comments) -->
757+
758+
<!-- end extra content -->
759+
760+
---
761+
736762
#### `scheduleNoisy`
737763

738764
Update "noisy" (frequently-updating) packages once a week.

groupTypes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33

4-
"description": "Group minor and patch updates to @types devDependencies.",
4+
"description": "Group minor and patch updates to `@types` `devDependencies`.",
55

66
"packageRules": [
77
{

restrictNode.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
4+
"description": "Restrict @types/node version to the range `arg0`.",
5+
6+
"packageRules": [
7+
{
8+
"matchPackageNames": ["@types/node"],
9+
"allowedVersions": "{{arg0}}"
10+
}
11+
]
12+
}

scripts/updateReadme.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const splitByHeading = (text, level) =>
7575
* @type {(text: string, level: number) => string}
7676
*/
7777
const getHeadingText = (text, level) =>
78-
(text.match(new RegExp(`^${'#'.repeat(level)} (.*)`, 'm')) || [])[1] || '';
78+
(text.match(new RegExp(`^${'#'.repeat(level)} (.*)`, 'm')) || [])[1]?.trim() || '';
7979

8080
const slugify = (text) =>
8181
text
@@ -94,7 +94,9 @@ function getPresetExtraTexts(presetNames, presetsSection) {
9494
splitByHeading(presetsSection, 4)
9595
.slice(1) // remove the first part, which will be an h3
9696
.forEach((text) => {
97-
const presetName = getHeadingText(text, 4).replace(/`/g, '');
97+
const presetName = getHeadingText(text, 4)
98+
.replace(/`/g, '')
99+
.replace(/ \(.*\)$/, ''); // remove args
98100
if (!presetName) {
99101
console.warn('Section REMOVED since it did not match expected format:\n', text);
100102
} else if (!presetNames.includes(presetName)) {
@@ -128,8 +130,14 @@ async function updateReadme() {
128130
const presetExtraTexts = getPresetExtraTexts(presetNames, presetsSection);
129131

130132
// Generate preset sections based on the descriptions, custom text, and other JSON
131-
const newPresets = Object.entries(presets).map(([presetFile, { json }]) => {
133+
const newPresets = Object.entries(presets).map(([presetFile, { content, json }]) => {
132134
const presetName = path.basename(presetFile, '.json');
135+
const presetArgs = content.match(/{{arg\d}}/g);
136+
console.log(presetArgs);
137+
const presetNameWithArgs = presetArgs
138+
? `${presetName}(${presetArgs.map((arg) => `<${arg.slice(2, -2)}>`).join(', ')})`
139+
: presetName;
140+
console.log(presetNameWithArgs);
133141
const extraContent = presetExtraTexts[presetName] || '';
134142

135143
const { description, $schema, ...otherJson } = json;
@@ -138,7 +146,7 @@ async function updateReadme() {
138146
return {
139147
name: presetName,
140148
content: `
141-
#### \`${presetName}\`
149+
#### \`${presetNameWithArgs}\`
142150
143151
${description || ''}
144152

0 commit comments

Comments
 (0)