87 lines
4.5 KiB
Markdown
87 lines
4.5 KiB
Markdown
# Renovate locally - proof of concept (npm + .NET)
|
|
|
|
A monorepo whose dependencies are checked and updated with the **Renovate CLI** -
|
|
fully local, without GitHub/GitLab. All packages are intentionally outdated.
|
|
|
|
```
|
|
npm/web/ package.json + package-lock.json (express, lodash)
|
|
npm/utils/ package.json + package-lock.json (dayjs, typescript)
|
|
dotnet/ global.json, Directory.Packages.props, .config/dotnet-tools.json,
|
|
src/{Core,Api} with packages.lock.json
|
|
renovate.json Renovate configuration: one PR for npm and one for NuGet (including major updates)
|
|
renovate/ script/ (PowerShell scripts), example-configurations/, results/ (output of every run)
|
|
```
|
|
|
|
Requirements: PowerShell, Node.js >= 24.11 (e.g. `volta install node@24`), Git, Podman,
|
|
.NET SDK 8 (Renovate runs `dotnet restore` to update the NuGet lock files).
|
|
|
|
Every run of `renovate-check.ps1` and `renovate-update.ps1` writes `renovate/results/<timestamp>/`:
|
|
|
|
| File | Content |
|
|
|---|---|
|
|
| `command.ps1` | the executed Renovate command incl. environment variables (run it from the repository root to repeat the run) |
|
|
| `renovate.json` | the Renovate configuration that was used |
|
|
| `renovate.log` | console output at debug level |
|
|
| `renovate-report.json` | Renovate report |
|
|
| `info.json` | `startedAt`, `finishedAt`, `durationSeconds` and (update only) the created `pullRequests` |
|
|
|
|
## Minimum release age
|
|
|
|
Only versions that were published at least 7 days ago are used:
|
|
|
|
- `"minimumReleaseAge": "7 days"` in `renovate.json` and all example configurations: Renovate only proposes such versions
|
|
(npm and NuGet). Security updates are not delayed (`vulnerabilityAlerts` resets it by default).
|
|
- `min-release-age=7` in `npm/web/.npmrc` and `npm/utils/.npmrc`: `npm install` (also when Renovate regenerates the
|
|
`package-lock.json`) only resolves such versions, including transitive dependencies. Older npm versions ignore it.
|
|
|
|
## Example configurations
|
|
|
|
`renovate/example-configurations/` contains alternative `renovate.json` files (copy one over `renovate.json` to use it):
|
|
|
|
| File | PRs |
|
|
|---|---|
|
|
| `renovate.all-in-one.json` | one PR with all updates |
|
|
| `renovate.per-ecosystem.json` | one PR for npm, one for NuGet (same as the current `renovate.json`) |
|
|
| `renovate.per-project.json` | one PR each for `npm/web`, `npm/utils` and `dotnet` (the .NET projects share `Directory.Packages.props`) |
|
|
| `renovate.exclude-api.json` | like per-ecosystem, without the packages only the Api project uses |
|
|
| `renovate.exclude-package.json` | like per-ecosystem, without `Newtonsoft.Json` |
|
|
| `renovate.max-version.json` | like per-ecosystem, but `express` stays on 4.x and the .NET SDK on 8.x (`allowedVersions`) |
|
|
| `renovate.no-sdk-and-tools.json` | like per-ecosystem, without the .NET SDK (`global.json`), the dotnet tools (`dotnet-tools.json`) and the npm `devDependencies` |
|
|
| `renovate.security-only.json` | only security fixes (one PR per vulnerable package, via the OSV database) |
|
|
|
|
## Check only
|
|
|
|
```powershell
|
|
.\renovate\script\renovate-check.ps1
|
|
```
|
|
|
|
Renovate runs with `--platform=local` directly on this directory and lists the available updates.
|
|
This platform can only check, it cannot change files.
|
|
|
|
## Update
|
|
|
|
For Renovate to create branches and PRs, a Git server is needed - here a local **Forgejo** in Podman.
|
|
|
|
```powershell
|
|
.\renovate\script\forgejo-up.ps1 # start Forgejo (once, or after a reboot)
|
|
.\renovate\script\renovate-update.ps1 # run Renovate (as often as you like)
|
|
.\renovate\script\forgejo-down.ps1 # stop Forgejo; with -Purge also delete all data
|
|
.\renovate\script\forgejo-reset.ps1 # reset Forgejo completely (all repos, PRs, tokens gone) and start fresh
|
|
```
|
|
|
|
- `forgejo-up.ps1` starts Forgejo (`http://localhost:3000`, login `renovate` / `renovate`),
|
|
creates the bot user and stores a fresh access token in `renovate/script/.forgejo-token`.
|
|
- `renovate-update.ps1` only knows Forgejo by endpoint, repository name (`renovate/renovate-test`) and `.forgejo-token`.
|
|
It pushes `main` (the repository is created automatically on the first push), runs Renovate and fetches the
|
|
branches into the local repository as `forgejo/renovate/*`. Every run creates **new branches + PRs**
|
|
(one for npm, one for NuGet), e.g. branch `renovate/2026-10-11-14-03-22-123-npm` with PR "Update npm 2026-10-11 14:03:22.123".
|
|
|
|
Apply:
|
|
|
|
```powershell
|
|
git diff main...forgejo/renovate/<timestamp>-npm
|
|
git merge forgejo/renovate/<timestamp>-npm
|
|
```
|
|
|
|
Optional: `$env:GITHUB_COM_TOKEN = '<token>'` - Renovate then adds release notes from github.com to the PRs.
|