Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: prepare release as asset * chore: cleanup * fix: wrong extension * fix: wrong logger * fix: wrong path * chore: clean and create tmp * chore: fix types * fix: update generation * Update .github/workflows/build.yml Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * Update lib/datasource/types.ts Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
- Loading branch information
1 parent
ffb023c
commit e4c938b
Showing
27 changed files
with
786 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ coverage | |
**/*.generated.ts | ||
/tools/dist | ||
/patches | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ bin/yarn* | |
**/*.generated.ts | ||
/tools/dist | ||
/patches | ||
**/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface ModuleApi { | ||
displayName?: string; | ||
url?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import table from 'markdown-table'; | ||
import { getOptions } from '../../lib/config/options'; | ||
import { getCliName } from '../../lib/workers/global/config/parse/cli'; | ||
import { getEnvName } from '../../lib/workers/global/config/parse/env'; | ||
import { readFile, updateFile } from '../utils/index'; | ||
|
||
const options = getOptions(); | ||
|
||
function genTable(obj: [string, string][], type: string, def: any): string { | ||
const data = [['Name', 'Value']]; | ||
const name = obj[0][1]; | ||
const ignoredKeys = [ | ||
'name', | ||
'description', | ||
'default', | ||
'stage', | ||
'allowString', | ||
'cli', | ||
'env', | ||
'admin', | ||
]; | ||
obj.forEach(([key, val]) => { | ||
const el = [key, val]; | ||
if ( | ||
!ignoredKeys.includes(el[0]) || | ||
(el[0] === 'default' && typeof el[1] !== 'object' && name !== 'prBody') | ||
) { | ||
if (type === 'string' && el[0] === 'default') { | ||
el[1] = `\`"${el[1]}"\``; | ||
} | ||
if (type === 'boolean' && el[0] === 'default') { | ||
el[1] = `\`${el[1]}\``; | ||
} | ||
if (type === 'string' && el[0] === 'default' && el[1].length > 200) { | ||
el[1] = `[template]`; | ||
} | ||
data.push(el); | ||
} | ||
}); | ||
|
||
if (type === 'list') { | ||
data.push(['default', '`[]`']); | ||
} | ||
if (type === 'string' && def === undefined) { | ||
data.push(['default', '`null`']); | ||
} | ||
if (type === 'boolean' && def === undefined) { | ||
data.push(['default', '`true`']); | ||
} | ||
if (type === 'boolean' && def === null) { | ||
data.push(['default', '`null`']); | ||
} | ||
return table(data); | ||
} | ||
|
||
export async function generateConfig(dist: string, bot = false): Promise<void> { | ||
let configFile = `configuration-options.md`; | ||
if (bot) { | ||
configFile = `self-hosted-configuration.md`; | ||
} | ||
|
||
const configOptionsRaw = (await readFile(`docs/usage/${configFile}`)).split( | ||
'\n' | ||
); | ||
|
||
options | ||
.filter((option) => option.releaseStatus !== 'unpublished') | ||
.forEach((option) => { | ||
const el: Record<string, any> = { ...option }; | ||
let headerIndex = configOptionsRaw.indexOf(`## ${option.name}`); | ||
if (headerIndex === -1) { | ||
headerIndex = configOptionsRaw.indexOf(`### ${option.name}`); | ||
} | ||
if (bot) { | ||
el.cli = getCliName(el); | ||
el.env = getEnvName(el); | ||
if (el.cli === '') { | ||
el.cli = `N/A`; | ||
} | ||
if (el.env === '') { | ||
el.env = 'N/A'; | ||
} | ||
} | ||
|
||
configOptionsRaw[headerIndex] += | ||
`\n${option.description}\n\n` + | ||
genTable(Object.entries(el), option.type, option.default); | ||
}); | ||
|
||
await updateFile(`${dist}/${configFile}`, configOptionsRaw.join('\n')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { getDatasources } from '../../lib/datasource'; | ||
import { readFile, updateFile } from '../utils'; | ||
import { | ||
formatDescription, | ||
formatUrls, | ||
getDisplayName, | ||
replaceContent, | ||
} from './utils'; | ||
|
||
export async function generateDatasources(dist: string): Promise<void> { | ||
const dsList = getDatasources(); | ||
let datasourceContent = | ||
'\nSupported values for `datasource` are: ' + | ||
[...dsList.keys()].map((v) => `\`${v}\``).join(', ') + | ||
'.\n\n'; | ||
for (const [datasource, definition] of dsList) { | ||
const { id, urls, defaultConfig } = definition; | ||
const displayName = getDisplayName(datasource, definition); | ||
datasourceContent += `\n### ${displayName} Datasource\n\n`; | ||
datasourceContent += `**Identifier**: \`${id}\`\n\n`; | ||
datasourceContent += formatUrls(urls); | ||
datasourceContent += await formatDescription('datasource', datasource); | ||
|
||
if (defaultConfig) { | ||
datasourceContent += | ||
'**Default configuration**:\n\n```json\n' + | ||
JSON.stringify(defaultConfig, undefined, 2) + | ||
'\n```\n'; | ||
} | ||
|
||
datasourceContent += `\n----\n\n`; | ||
} | ||
let indexContent = await readFile(`docs/usage/modules/datasource.md`); | ||
indexContent = replaceContent(indexContent, datasourceContent); | ||
await updateFile(`${dist}/modules/datasource.md`, indexContent); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import type { RenovateConfig } from '../../lib/config/types'; | ||
import { getManagers } from '../../lib/manager'; | ||
import { readFile, updateFile } from '../utils'; | ||
import { getDisplayName, getNameWithUrl, replaceContent } from './utils'; | ||
|
||
function getTitle(manager: string, displayName: string): string { | ||
if (manager === 'regex') { | ||
return `Custom Manager Support using Regex`; | ||
} | ||
return `Automated Dependency Updates for ${displayName}`; | ||
} | ||
|
||
function getManagerLink(manager: string): string { | ||
return `[\`${manager}\`](${manager}/)`; | ||
} | ||
|
||
export async function generateManagers(dist: string): Promise<void> { | ||
const managers = getManagers(); | ||
const allLanguages: Record<string, string[]> = {}; | ||
for (const [manager, definition] of managers) { | ||
const language = definition.language || 'other'; | ||
allLanguages[language] = allLanguages[language] || []; | ||
allLanguages[language].push(manager); | ||
const { defaultConfig } = definition; | ||
const { fileMatch } = defaultConfig as RenovateConfig; | ||
const displayName = getDisplayName(manager, definition); | ||
let md = `--- | ||
title: ${getTitle(manager, displayName)} | ||
sidebar_label: ${displayName} | ||
--- | ||
`; | ||
if (manager !== 'regex') { | ||
const nameWithUrl = getNameWithUrl(manager, definition); | ||
md += `Renovate supports updating ${nameWithUrl} dependencies.\n\n`; | ||
if (defaultConfig.enabled === false) { | ||
md += '## Enabling\n\n'; | ||
md += `${displayName} functionality is currently in beta testing so you must opt in to test it out. To enable it, add a configuration like this to either your bot config or your \`renovate.json\`:\n\n`; | ||
md += '```\n'; | ||
md += `{\n "${manager}": {\n "enabled": true\n }\n}`; | ||
md += '\n```\n\n'; | ||
md += | ||
'If you encounter any bugs, please [raise a bug report](https://github.com/renovatebot/renovate/issues/new?template=3-Bug_report.md). If you find that it works well, then feedback on that would be welcome too.\n\n'; | ||
} | ||
md += '## File Matching\n\n'; | ||
if (!Array.isArray(fileMatch) || fileMatch.length === 0) { | ||
md += `Because file names for \`${manager}\` cannot be easily determined automatically, Renovate will not attempt to match any \`${manager}\` files by default. `; | ||
} else { | ||
md += `By default, Renovate will check any files matching `; | ||
if (fileMatch.length === 1) { | ||
md += `the following regular expression: \`${fileMatch[0]}\`.\n\n`; | ||
} else { | ||
md += `any of the following regular expressions:\n\n`; | ||
md += '```\n'; | ||
md += fileMatch.join('\n'); | ||
md += '\n```\n\n'; | ||
} | ||
} | ||
md += `For details on how to extend a manager's \`fileMatch\` value, please follow [this link](/modules/manager/#file-matching).\n\n`; | ||
} | ||
|
||
const managerReadmeContent = await readFile( | ||
`lib/manager/${manager}/readme.md` | ||
); | ||
if (manager !== 'regex') { | ||
md += '\n## Additional Information\n\n'; | ||
} | ||
md += managerReadmeContent + '\n\n'; | ||
|
||
await updateFile(`${dist}/modules/manager/${manager}/index.md`, md); | ||
} | ||
const languages = Object.keys(allLanguages).filter( | ||
(language) => language !== 'other' | ||
); | ||
languages.sort(); | ||
languages.push('other'); | ||
let languageText = '\n'; | ||
|
||
for (const language of languages) { | ||
languageText += `**${language}**: `; | ||
languageText += allLanguages[language].map(getManagerLink).join(', '); | ||
languageText += '\n\n'; | ||
} | ||
let indexContent = await readFile(`docs/usage/modules/manager.md`); | ||
indexContent = replaceContent(indexContent, languageText); | ||
await updateFile(`${dist}/modules/manager.md`, indexContent); | ||
} |
Oops, something went wrong.