Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(lib/data): monorepo #30210

Merged
merged 23 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
594 changes: 6 additions & 588 deletions lib/config/presets/internal/monorepos.ts

Large diffs are not rendered by default.

551 changes: 551 additions & 0 deletions lib/data/monorepo.json

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions lib/data/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Introduction
RahulGautamSingh marked this conversation as resolved.
Show resolved Hide resolved

The `lib/data` folder has all our crowdsourced data files.
This readme explains what each file is used for.

## Summary

| File | What is the file about? |
| --------------- | ---------------------------------------- |
| `monorepo.json` | Group related packages into a single PR. |

## Group related packages (`monorepo.json`)

The `monorepo.json` file has all the monorepo presets.

Monorepo presets group related packages, so they are updated with a single Renovate PR.

### Ways to group packages

There are three ways to group packages:

| Grouping Criteria | Method |
| ------------------------ | --------------- |
| Source repository URLs | `repoGroups` |
| Organization URls | `orgGroups` |
| Package name patterns(s) | `patternGroups` |

Each method allows you to group related packages based on different criteria:

`repoGroups`: Group packages from the same source repository.
`orgGroups`: Group packages from the same organization.
`patternGroups`: Group packages based on name patterns or prefixes.
RahulGautamSingh marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions lib/expose.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* returns renovates package.json
* @type {import('./types').RenovatePackageJson}
*/
const pkg = (() => require('../package.json'))();
// const pkg = (() => require('../package.json'))();

/**
* return's re2
Expand Down Expand Up @@ -40,7 +40,7 @@ function sqlite() {

module.exports = {
re2,
pkg,
// pkg,
openpgp,
prettier,
sqlite,
Expand Down
2 changes: 1 addition & 1 deletion lib/instrumentation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
} from '@opentelemetry/sdk-trace-base';
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { pkg } from '../expose.cjs';
import pkg from '../../package.json';
import {
isTraceDebuggingEnabled,
isTraceSendingEnabled,
Expand Down
2 changes: 1 addition & 1 deletion lib/util/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import merge from 'deepmerge';
import got, { Options, RequestError, RetryObject } from 'got';
import type { SetRequired } from 'type-fest';
import { infer as Infer, type ZodError, ZodType } from 'zod';
import pkg from '../../../package.json';
RahulGautamSingh marked this conversation as resolved.
Show resolved Hide resolved
import { GlobalConfig } from '../../config/global';
import { HOST_DISABLED } from '../../constants/error-messages';
import { pkg } from '../../expose.cjs';
import { logger } from '../../logger';
import { ExternalHostError } from '../../types/errors/external-host-error';
import * as memCache from '../cache/memory';
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/global/config/parse/cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Command } from 'commander';
import pkg from '../../../../../package.json';
RahulGautamSingh marked this conversation as resolved.
Show resolved Hide resolved
import { getOptions } from '../../../../config/options';
import type { AllConfig } from '../../../../config/types';
import { pkg } from '../../../../expose.cjs';
import { logger } from '../../../../logger';
import { regEx } from '../../../../util/regex';
import { coersions } from './coersions';
Expand Down
4 changes: 2 additions & 2 deletions lib/workers/global/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ERROR } from 'bunyan';
import fs from 'fs-extra';
import semver from 'semver';
import upath from 'upath';
import pkg from '../../../package.json';
RahulGautamSingh marked this conversation as resolved.
Show resolved Hide resolved
import * as configParser from '../../config';
import { mergeChildConfig } from '../../config';
import { GlobalConfig } from '../../config/global';
Expand All @@ -14,7 +15,6 @@ import type {
RenovateRepository,
} from '../../config/types';
import { CONFIG_PRESETS_INVALID } from '../../constants/error-messages';
import { pkg } from '../../expose.cjs';
import { instrument } from '../../instrumentation';
import { exportStats, finalizeReport } from '../../instrumentation/reporting';
import { getProblems, logger, setMeta } from '../../logger';
Expand Down Expand Up @@ -70,7 +70,7 @@ function haveReachedLimits(): boolean {

/* istanbul ignore next */
function checkEnv(): void {
const range = pkg.engines!.node!;
const range = pkg.engines.node;
RahulGautamSingh marked this conversation as resolved.
Show resolved Hide resolved
const rangeNext = pkg['engines-next']?.node;
if (process.release?.name !== 'node' || !process.versions?.node) {
logger.warn(
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/repository/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'fs-extra';
import pkg from '../../../package.json';
import { GlobalConfig } from '../../config/global';
import { applySecretsToConfig } from '../../config/secrets';
import type { RenovateConfig } from '../../config/types';
Expand All @@ -7,7 +8,6 @@ import {
REPOSITORY_FORKED,
REPOSITORY_NO_CONFIG,
} from '../../constants/error-messages';
import { pkg } from '../../expose.cjs';
import { instrument } from '../../instrumentation';
import { addExtractionStats } from '../../instrumentation/reporting';
import { logger, setMeta } from '../../logger';
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/repository/update/pr/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import is from '@sindresorhus/is';
import pkg from '../../../../../package.json';
import { GlobalConfig } from '../../../../config/global';
import type { RenovateConfig } from '../../../../config/types';
import {
PLATFORM_INTEGRATION_UNAUTHORIZED,
PLATFORM_RATE_LIMIT_EXCEEDED,
REPOSITORY_CHANGED,
} from '../../../../constants/error-messages';
import { pkg } from '../../../../expose.cjs';
import { logger } from '../../../../logger';
import {
PlatformPrOptions,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"version": "0.0.0-semantic-release",
"type": "commonjs",
"bin": {
"renovate": "dist/renovate.js",
"renovate-config-validator": "dist/config-validator.js"
"renovate": "dist/lib/renovate.js",
"renovate-config-validator": "dist/lib/config-validator.js"
RahulGautamSingh marked this conversation as resolved.
Show resolved Hide resolved
},
"scripts": {
"build": "run-s clean 'generate:*' 'compile:*' create-json-schema",
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/bin/renovate
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if [[ -f "/usr/local/etc/env" && -z "${CONTAINERBASE_ENV+x}" ]]; then
. /usr/local/etc/env
fi

node "${RENOVATE_NODE_ARGS[@]}" /usr/local/renovate/dist/renovate.js "$@"
node "${RENOVATE_NODE_ARGS[@]}" /usr/local/renovate/dist/lib/renovate.js "$@"
2 changes: 1 addition & 1 deletion tools/docker/bin/renovate-config-validator
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if [[ -f "/usr/local/etc/env" && -z "${CONTAINERBASE_ENV+x}" ]]; then
. /usr/local/etc/env
fi

node /usr/local/renovate/dist/config-validator.js "$@"
node /usr/local/renovate/dist/lib/config-validator.js "$@"
4 changes: 3 additions & 1 deletion tools/docs/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ function jsUcfirst(string: string): string {
function getEditUrl(name: string): string {
const url =
'https://github.com/renovatebot/renovate/edit/main/lib/config/presets/internal/';

const newUrl = 'https://github.com/renovatebot/renovate/edit/main/lib/data/';
RahulGautamSingh marked this conversation as resolved.
Show resolved Hide resolved
switch (name) {
case 'customManagers':
return `${url}custom-managers.ts`;
case 'mergeConfidence':
return `${url}merge-confidence.ts`;
case 'monorepo':
return `${newUrl}${name}.json`;
RahulGautamSingh marked this conversation as resolved.
Show resolved Hide resolved
default:
return `${url}${name}.ts`;
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig",
"compilerOptions": {
"declaration": true,
"resolveJsonModule": false,
"resolveJsonModule": true,
RahulGautamSingh marked this conversation as resolved.
Show resolved Hide resolved
"sourceMap": true,
"inlineSources": true,
"importHelpers": true,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"sourceMap": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": false,
"resolveJsonModule": true,
"noUnusedLocals": true,
"noImplicitOverride": true,
"experimentalDecorators": true,
Expand Down
Loading