Skip to content

Commit b7a56cb

Browse files
committed
new: Add Renovate support.
1 parent 713b85a commit b7a56cb

6 files changed

Lines changed: 224 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#### 🚀 Updates
66

7+
- Added [Renovate](https://www.mend.io/renovate/) support. View the official guide for more
8+
information.
79
- Updated BitBucket codeowners to use the
810
[new syntax & file location](https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-use-code-owners/).
911
If you are using the old syntax, you can use `bitbucket-legacy` instead.

ecosystem/renovate.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"description": "Shared Renovate preset for moon repositories. Keeps toolchain and moon versions up to date across moon's supported config formats (YAML, JSON, JSONC, TOML, Pkl, HCL). The jsonata managers update built-in toolchain versions in `toolchains.{yml,yaml,json,toml}` by structure, with no annotation comments required. The regex manager updates any other version annotated with a trailing `# renovate:` or `// renovate:` comment, in `.moon/` (or `.config/moon/`) configs, `moon.*` project configs, and GitHub Actions workflows. Tool versions in `.prototools` are handled by Renovate's built-in `proto` manager and are intentionally not matched here. See https://moonrepo.dev/docs/guides/renovate.",
4+
"customManagers": [
5+
{
6+
"customType": "jsonata",
7+
"description": "Update built-in toolchain versions in YAML toolchains config (no annotations needed).",
8+
"fileFormat": "yaml",
9+
"managerFilePatterns": [
10+
"/(^|/)\\.moon/toolchains\\.(yml|yaml)$/",
11+
"/(^|/)\\.config/moon/toolchains\\.(yml|yaml)$/"
12+
],
13+
"matchStrings": [
14+
"[ node[version].{ \"depName\": \"node\", \"packageName\": \"node\", \"currentValue\": version, \"datasource\": \"node-version\" }, npm[version].{ \"depName\": \"npm\", \"packageName\": \"npm\", \"currentValue\": version, \"datasource\": \"npm\" }, pnpm[version].{ \"depName\": \"pnpm\", \"packageName\": \"pnpm\", \"currentValue\": version, \"datasource\": \"npm\" }, yarn[version].{ \"depName\": \"yarn\", \"packageName\": \"@yarnpkg/cli\", \"currentValue\": version, \"datasource\": \"npm\" }, bun[version].{ \"depName\": \"bun\", \"packageName\": \"oven-sh/bun\", \"currentValue\": version, \"datasource\": \"github-releases\", \"extractVersion\": \"^bun-v(?<version>\\\\S+)\" }, deno[version].{ \"depName\": \"deno\", \"packageName\": \"denoland/deno\", \"currentValue\": version, \"datasource\": \"github-releases\", \"extractVersion\": \"^v(?<version>\\\\S+)\" }, go[version].{ \"depName\": \"go\", \"packageName\": \"golang/go\", \"currentValue\": version, \"datasource\": \"github-tags\", \"extractVersion\": \"^go(?<version>\\\\S+)\" }, rust[version].{ \"depName\": \"rust\", \"packageName\": \"rust-lang/rust\", \"currentValue\": version, \"datasource\": \"github-tags\" } ]"
15+
]
16+
},
17+
{
18+
"customType": "jsonata",
19+
"description": "Update built-in toolchain versions in JSON toolchains config (no annotations needed).",
20+
"fileFormat": "json",
21+
"managerFilePatterns": [
22+
"/(^|/)\\.moon/toolchains\\.json$/",
23+
"/(^|/)\\.config/moon/toolchains\\.json$/"
24+
],
25+
"matchStrings": [
26+
"[ node[version].{ \"depName\": \"node\", \"packageName\": \"node\", \"currentValue\": version, \"datasource\": \"node-version\" }, npm[version].{ \"depName\": \"npm\", \"packageName\": \"npm\", \"currentValue\": version, \"datasource\": \"npm\" }, pnpm[version].{ \"depName\": \"pnpm\", \"packageName\": \"pnpm\", \"currentValue\": version, \"datasource\": \"npm\" }, yarn[version].{ \"depName\": \"yarn\", \"packageName\": \"@yarnpkg/cli\", \"currentValue\": version, \"datasource\": \"npm\" }, bun[version].{ \"depName\": \"bun\", \"packageName\": \"oven-sh/bun\", \"currentValue\": version, \"datasource\": \"github-releases\", \"extractVersion\": \"^bun-v(?<version>\\\\S+)\" }, deno[version].{ \"depName\": \"deno\", \"packageName\": \"denoland/deno\", \"currentValue\": version, \"datasource\": \"github-releases\", \"extractVersion\": \"^v(?<version>\\\\S+)\" }, go[version].{ \"depName\": \"go\", \"packageName\": \"golang/go\", \"currentValue\": version, \"datasource\": \"github-tags\", \"extractVersion\": \"^go(?<version>\\\\S+)\" }, rust[version].{ \"depName\": \"rust\", \"packageName\": \"rust-lang/rust\", \"currentValue\": version, \"datasource\": \"github-tags\" } ]"
27+
]
28+
},
29+
{
30+
"customType": "jsonata",
31+
"description": "Update built-in toolchain versions in TOML toolchains config (no annotations needed).",
32+
"fileFormat": "toml",
33+
"managerFilePatterns": [
34+
"/(^|/)\\.moon/toolchains\\.toml$/",
35+
"/(^|/)\\.config/moon/toolchains\\.toml$/"
36+
],
37+
"matchStrings": [
38+
"[ node[version].{ \"depName\": \"node\", \"packageName\": \"node\", \"currentValue\": version, \"datasource\": \"node-version\" }, npm[version].{ \"depName\": \"npm\", \"packageName\": \"npm\", \"currentValue\": version, \"datasource\": \"npm\" }, pnpm[version].{ \"depName\": \"pnpm\", \"packageName\": \"pnpm\", \"currentValue\": version, \"datasource\": \"npm\" }, yarn[version].{ \"depName\": \"yarn\", \"packageName\": \"@yarnpkg/cli\", \"currentValue\": version, \"datasource\": \"npm\" }, bun[version].{ \"depName\": \"bun\", \"packageName\": \"oven-sh/bun\", \"currentValue\": version, \"datasource\": \"github-releases\", \"extractVersion\": \"^bun-v(?<version>\\\\S+)\" }, deno[version].{ \"depName\": \"deno\", \"packageName\": \"denoland/deno\", \"currentValue\": version, \"datasource\": \"github-releases\", \"extractVersion\": \"^v(?<version>\\\\S+)\" }, go[version].{ \"depName\": \"go\", \"packageName\": \"golang/go\", \"currentValue\": version, \"datasource\": \"github-tags\", \"extractVersion\": \"^go(?<version>\\\\S+)\" }, rust[version].{ \"depName\": \"rust\", \"packageName\": \"rust-lang/rust\", \"currentValue\": version, \"datasource\": \"github-tags\" } ]"
39+
]
40+
},
41+
{
42+
"customType": "regex",
43+
"description": "Update any version annotated with a trailing `# renovate:` or `// renovate:` comment (YAML, TOML, JSONC, Pkl, HCL).",
44+
"managerFilePatterns": [
45+
"/(^|/)\\.moon/.*\\.(ya?ml|jsonc|toml|pkl|hcl)$/",
46+
"/(^|/)\\.config/moon/.*\\.(ya?ml|jsonc|toml|pkl|hcl)$/",
47+
"/(^|/)moon\\.(ya?ml|jsonc|toml|pkl|hcl)$/",
48+
"/(^|/)\\.github/workflows/.*\\.ya?ml$/"
49+
],
50+
"matchStrings": [
51+
"['\"]?(?<currentValue>[^'\"\\s,#]+)['\"]?[,\\s]*(?:#|//)\\s*renovate:\\s*datasource=(?<datasource>\\S+)\\s+depName=(?<depName>\\S+)(?:\\s+packageName=(?<packageName>\\S+))?(?:\\s+versioning=(?<versioning>\\S+))?(?:\\s+extractVersion=(?<extractVersion>\\S+))?"
52+
],
53+
"datasourceTemplate": "{{{datasource}}}",
54+
"depNameTemplate": "{{{depName}}}",
55+
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
56+
}
57+
]
58+
}

website/docs/config/toolchain.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ When `false`, doesn't inherit a version. When `true`, matches the version specif
134134
using the same toolchain identifier. Otherwise a string can be provided to specify a proto-specific
135135
identifier. Defaults to `true`.
136136

137+
> Keeping versions in `.prototools` also pairs well with [Renovate](../guides/renovate), which can
138+
> update them automatically.
139+
137140
```yaml title=".moon/toolchains.yml"
138141
node:
139142
versionFromPrototools: 'nodejs'

website/docs/guides/ci.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ your cache. Blindly storing the `hashes` and `outputs` directories without a mec
263263
will simply not work, as the contents will drastically change between CI runs. This is the primary
264264
reason why the remote caching service exists.
265265

266+
## Keeping dependencies updated
267+
268+
To automate toolchain and dependency updates, moon integrates with
269+
[Renovate](https://docs.renovatebot.com/). Tool versions in [`.prototools`](../proto/config) are
270+
updated out of the box, and moon publishes a shared preset for updating moon-specific configuration.
271+
Refer to the [Renovate guide](./renovate) for setup.
272+
266273
## Reporting run results
267274

268275
If you're using GitHub Actions as your CI provider, we suggest using our

website/docs/guides/renovate.mdx

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
title: Renovate
3+
---
4+
5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
7+
8+
[Renovate](https://docs.renovatebot.com/) automates dependency updates by opening pull requests when
9+
new versions are released. Because moon builds on [proto](../proto) for toolchain management, and
10+
proto is supported by Renovate out of the box, most moon repositories work with Renovate with little
11+
to no configuration. This guide covers that native support, and how to extend it to versions pinned
12+
in moon's own configuration files.
13+
14+
## Pin versions in `.prototools` (recommended)
15+
16+
The cleanest setup requires **no Renovate configuration and no annotations at all**. Renovate ships a
17+
built-in [`proto` manager](https://docs.renovatebot.com/modules/manager/proto/) that updates tool
18+
versions declared in [`.prototools`](../proto/config) files automatically.
19+
20+
```toml title=".prototools"
21+
node = "22.18.0"
22+
yarn = "4.16.0"
23+
rust = "1.85.0"
24+
moon = "2.4.2"
25+
```
26+
27+
Because moon toolchains inherit their version from `.prototools` by default (via
28+
[`versionFromPrototools`](../config/toolchain#versionfromprototools)), you can leave the `version`
29+
out of [`.moon/toolchains.yml`](../config/toolchain) entirely and let proto be the single source of
30+
truth:
31+
32+
```yaml title=".moon/toolchains.yml"
33+
# No version here — inherited from .prototools
34+
node: {}
35+
rust: {}
36+
```
37+
38+
With this approach, Renovate keeps `.prototools` current, moon resolves toolchains from it, and
39+
derived fields (like `package.json`'s `packageManager`) stay in sync — no `# renovate:` comments
40+
required.
41+
42+
:::tip
43+
44+
If you can, prefer this over hard-coding a `version` in `.moon/toolchains.yml`. It's the least
45+
configuration, and nothing drifts out of sync.
46+
47+
:::
48+
49+
## Versions in moon configuration
50+
51+
If you'd rather pin versions in moon's config files — or you have versions that don't live in
52+
`.prototools` at all (the moon [`versionConstraint`](../config/workspace#versionconstraint), a CI
53+
input, a WASM plugin) — moon publishes a shared Renovate
54+
[config preset](https://docs.renovatebot.com/config-presets/) to cover them.
55+
56+
<Tabs groupId="renovate-setup">
57+
<TabItem value="preset" label="Extend the preset (recommended)">
58+
59+
```json title="renovate.json"
60+
{
61+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
62+
"extends": ["config:recommended", "github>moonrepo/moon//ecosystem/renovate"]
63+
}
64+
```
65+
66+
</TabItem>
67+
<TabItem value="inline" label="Inline configuration">
68+
69+
If you'd rather not depend on the preset, copy its
70+
[custom managers](https://docs.renovatebot.com/modules/manager/custom/) directly into your
71+
configuration — see the source at
72+
[`ecosystem/renovate.json`](https://github.com/moonrepo/moon/blob/master/ecosystem/renovate.json).
73+
74+
</TabItem>
75+
</Tabs>
76+
77+
### Toolchain versions (no annotations)
78+
79+
The preset includes [JSONata managers](https://docs.renovatebot.com/modules/manager/jsonata/) that
80+
read your [`toolchains`](../config/toolchain) config _by structure_, so a `version` pinned for a
81+
built-in toolchain is updated automatically — **no comments needed**. This works for the `yml`,
82+
`yaml`, `json`, and `toml` formats (in `.moon/` or `.config/moon/`):
83+
84+
```yaml title=".moon/toolchains.yml"
85+
node:
86+
version: '22.18.0'
87+
rust:
88+
version: '1.85.0'
89+
```
90+
91+
### Other versions
92+
93+
For anything the structural managers don't cover, the preset also includes a regex manager that reads
94+
a trailing `# renovate:` (or `// renovate:`) comment. Add it to the _end of the line_ containing the
95+
version, and point it at a [datasource](https://docs.renovatebot.com/modules/datasource/) and package.
96+
It applies to `.moon/` (and `.config/moon/`) configs, `moon.*` project files, and
97+
`.github/workflows/*.yml`, in any comment-supporting format (`yml`, `yaml`, `toml`, `jsonc`, `pkl`,
98+
`hcl` — strict `json` has no comments):
99+
100+
```yaml title=".moon/workspace.yml"
101+
# Pin the version of moon itself
102+
versionConstraint: '>=2.4.2' # renovate: datasource=github-releases depName=moonrepo/moon extractVersion=^v(?<version>.*)$
103+
```
104+
105+
```yaml title=".github/workflows/ci.yml"
106+
- uses: 'moonrepo/setup-toolchain@v0'
107+
with:
108+
proto-version: '0.58.2' # renovate: datasource=github-releases depName=moonrepo/proto extractVersion=^v(?<version>.*)$
109+
```
110+
111+
In formats that use `//` for comments (JSONC, Pkl, HCL), the `// renovate:` form works the same way:
112+
113+
```json title=".moon/workspace.jsonc"
114+
{
115+
"versionConstraint": ">=2.4.2" // renovate: datasource=github-releases depName=moonrepo/moon extractVersion=^v(?<version>.*)$
116+
}
117+
```
118+
119+
To annotate versions in _other_ files — such as WASM plugin versions in `.prototools` — append their
120+
paths to `managerFilePatterns` in your own `customManagers` entry.
121+
122+
### Datasource reference
123+
124+
Useful when annotating a version, or adding a toolchain the structural manager doesn't cover. These
125+
mirror the datasources Renovate's native `proto` manager uses.
126+
127+
| Tool | `datasource` | `depName` / `packageName` | `extractVersion` |
128+
| ---------- | ----------------- | ------------------------- | ----------------------- |
129+
| node | `node-version` | `node` | |
130+
| npm / pnpm | `npm` | `npm` / `pnpm` | |
131+
| yarn | `npm` | `@yarnpkg/cli` | |
132+
| rust | `github-tags` | `rust-lang/rust` | |
133+
| go | `github-tags` | `golang/go` | `^go(?<version>.*)$` |
134+
| python | `github-tags` | `python/cpython` | `^v(?<version>.*)$` |
135+
| deno | `github-releases` | `denoland/deno` | `^v(?<version>.*)$` |
136+
| bun | `github-releases` | `oven-sh/bun` | `^bun-v(?<version>.*)$` |
137+
| moon | `github-releases` | `moonrepo/moon` | `^v(?<version>.*)$` |
138+
| proto | `github-releases` | `moonrepo/proto` | `^v(?<version>.*)$` |
139+
140+
## Tips and limitations
141+
142+
- **Config format coverage.** Comment-free structural updates work for the `yml`, `yaml`, `json`, and
143+
`toml` formats; `jsonc`, `pkl`, and `hcl` are updated through `#` or `//` annotations. Strict `json`
144+
can't hold comments, so pin those toolchains structurally or in `.prototools`.
145+
- **Aliases are skipped.** Values like `latest`, `stable`, `canary`, or `nightly` can't be resolved
146+
to a concrete version, and are ignored.
147+
- **Pin each toolchain in one place.** Don't set the same version in both `.prototools` and
148+
`.moon/toolchains.yml` (or add an annotation on top of a structurally-managed version) — you'll get
149+
duplicate pull requests.
150+
- **Propagate changes on self-hosted Renovate.** You can run `moon sync` (or any command) after an
151+
update via [`postUpgradeTasks`](https://docs.renovatebot.com/configuration-options/#postupgradetasks)
152+
to keep generated files in sync.\
153+
to batch toolchain bumps into a single pull request.

website/sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ const sidebars: SidebarsConfig = {
254254
'guides/offline-mode',
255255
'guides/open-source',
256256
'guides/remote-cache',
257+
'guides/renovate',
257258
'guides/root-project',
258259
'guides/sharing-config',
259260
'guides/notifications',

0 commit comments

Comments
 (0)