Skip to content

Commit

Permalink
Merge branch 'main' into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Workflow committed Sep 9, 2022
2 parents b74f068 + 538ba0c commit 1b90057
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 6 deletions.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ In this section, ONLY edit between "extra content" marker comments!
- [dependencyDashboardMajor](#dependencydashboardmajor)
- [keepFresh](#keepfresh)
- [newConfigWarningIssue](#newconfigwarningissue)
- [restrictNode](#restrictnode)
- [scheduleNoisy](#schedulenoisy)
<!-- end presets TOC -->

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

#### `groupTypes`

Group minor and patch updates to @types devDependencies.
Group minor and patch updates to `@types` `devDependencies`.

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

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

---

#### `restrictNode(<arg0>)`

Restrict @types/node version to the range `arg0`.

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

```json
{
"packageRules": [
{
"matchPackageNames": ["@types/node"],
"allowedVersions": "{{arg0}}"
}
]
}
```

</details>

<!-- start extra content (EDITABLE between these comments) -->

<!-- end extra content -->

---

#### `scheduleNoisy`

Update "noisy" (frequently-updating) packages once a week.
Expand Down
2 changes: 1 addition & 1 deletion groupTypes.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",

"description": "Group minor and patch updates to @types devDependencies.",
"description": "Group minor and patch updates to `@types` `devDependencies`.",

"packageRules": [
{
Expand Down
12 changes: 12 additions & 0 deletions restrictNode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",

"description": "Restrict @types/node version to the range `arg0`.",

"packageRules": [
{
"matchPackageNames": ["@types/node"],
"allowedVersions": "{{arg0}}"
}
]
}
16 changes: 12 additions & 4 deletions scripts/updateReadme.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const splitByHeading = (text, level) =>
* @type {(text: string, level: number) => string}
*/
const getHeadingText = (text, level) =>
(text.match(new RegExp(`^${'#'.repeat(level)} (.*)`, 'm')) || [])[1] || '';
(text.match(new RegExp(`^${'#'.repeat(level)} (.*)`, 'm')) || [])[1]?.trim() || '';

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

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

const { description, $schema, ...otherJson } = json;
Expand All @@ -138,7 +146,7 @@ async function updateReadme() {
return {
name: presetName,
content: `
#### \`${presetName}\`
#### \`${presetNameWithArgs}\`
${description || ''}
Expand Down

0 comments on commit 1b90057

Please sign in to comment.