mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
634d3b6084
* build(deps): update dependency neotraverse to v1 | datasource | package | from | to | | ---------- | ----------- | ------ | ----- | | npm | neotraverse | 0.6.18 | 1.0.1 | * refactor: use modern neotraverse API --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
30 lines
691 B
TypeScript
30 lines
691 B
TypeScript
import { map } from 'neotraverse';
|
|
|
|
export default function configSerializer<T extends Record<string, unknown>>(
|
|
config: T,
|
|
): T {
|
|
const templateFields = ['prBody'];
|
|
const contentFields = [
|
|
'content',
|
|
'contents',
|
|
'packageLockParsed',
|
|
'yarnLockParsed',
|
|
];
|
|
const arrayFields = ['packageFiles', 'upgrades'];
|
|
|
|
return map(config, (ctx, val) => {
|
|
if (ctx.key && val) {
|
|
const key = ctx.key.toString();
|
|
if (templateFields.includes(key)) {
|
|
ctx.update('[Template]');
|
|
}
|
|
if (contentFields.includes(key)) {
|
|
ctx.update('[content]');
|
|
}
|
|
if (arrayFields.includes(key)) {
|
|
ctx.update('[Array]');
|
|
}
|
|
}
|
|
});
|
|
}
|