From 2611eda80b6af15dc0e7eef3d1b6cd5db736516a Mon Sep 17 00:00:00 2001 From: Jason Sipula Date: Sat, 24 Aug 2024 18:27:53 -0700 Subject: [PATCH] enable update-locked range strategy --- docs/usage/configuration-options.md | 2 +- lib/modules/manager/gleam/artifacts.ts | 2 +- lib/modules/manager/gleam/range.spec.ts | 10 ---------- lib/modules/manager/gleam/range.ts | 10 ---------- lib/modules/manager/gleam/readme.md | 11 +++++------ 5 files changed, 7 insertions(+), 28 deletions(-) diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index dc974e1bd17b088..5a1273bc8537a7f 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -3611,7 +3611,7 @@ Behavior: - `bump` = e.g. bump the range even if the new version satisfies the existing range, e.g. `^1.0.0` -> `^1.1.0` - `replace` = Replace the range with a newer one if the new version falls outside it, and update nothing otherwise - `widen` = Widen the range with newer one, e.g. `^1.0.0` -> `^1.0.0 || ^2.0.0` -- `update-lockfile` = Update the lock file when in-range updates are available, otherwise `replace` for updates out of range. Works for `bundler`, `cargo`, `composer`, `npm`, `yarn`, `pnpm`, `terraform` and `poetry` so far +- `update-lockfile` = Update the lock file when in-range updates are available, otherwise `replace` for updates out of range. Works for `bundler`, `cargo`, `composer`, `gleam`, `npm`, `yarn`, `pnpm`, `terraform` and `poetry` so far - `in-range-only` = Update the lock file when in-range updates are available, ignore package file updates Renovate's `"auto"` strategy works like this for npm: diff --git a/lib/modules/manager/gleam/artifacts.ts b/lib/modules/manager/gleam/artifacts.ts index 8a88595a61d23cb..1bd06ea5a9b99c2 100644 --- a/lib/modules/manager/gleam/artifacts.ts +++ b/lib/modules/manager/gleam/artifacts.ts @@ -49,7 +49,7 @@ export async function updateArtifacts( ], }; - await exec('gleam deps download', execOptions); + await exec('gleam deps update', execOptions); const newLockFileContent = await readLocalFile(lockFileName, 'utf8'); if (!newLockFileContent) { logger.debug(`No ${lockFileName} found`); diff --git a/lib/modules/manager/gleam/range.spec.ts b/lib/modules/manager/gleam/range.spec.ts index da0083582cc088f..6dc4e912918b701 100644 --- a/lib/modules/manager/gleam/range.spec.ts +++ b/lib/modules/manager/gleam/range.spec.ts @@ -16,16 +16,6 @@ describe('modules/manager/gleam/range', () => { expect(getRangeStrategy(config)).toBe('widen'); }); - it('returns widen if update-lockfile', () => { - const config: RangeConfig = { rangeStrategy: 'update-lockfile' }; - expect(getRangeStrategy(config)).toBe('widen'); - }); - - it('returns widen if in-range-only', () => { - const config: RangeConfig = { rangeStrategy: 'in-range-only' }; - expect(getRangeStrategy(config)).toBe('widen'); - }); - it('defaults to widen', () => { const config: RangeConfig = { rangeStrategy: 'auto', diff --git a/lib/modules/manager/gleam/range.ts b/lib/modules/manager/gleam/range.ts index f8436aa2d71d460..61b62cd73f5768f 100644 --- a/lib/modules/manager/gleam/range.ts +++ b/lib/modules/manager/gleam/range.ts @@ -16,16 +16,6 @@ export function getRangeStrategy(config: RangeConfig): RangeStrategy { ); return 'widen'; } - if (rangeStrategy === 'update-lockfile') { - logger.warn( - 'Unsupported rangeStrategy update-lockfile, defaulting to widen', - ); - return 'widen'; - } - if (rangeStrategy === 'in-range-only') { - logger.warn('Unsupported rangeStrategy in-range-only, defaulting to widen'); - return 'widen'; - } if (rangeStrategy !== 'auto') { return rangeStrategy; } diff --git a/lib/modules/manager/gleam/readme.md b/lib/modules/manager/gleam/readme.md index 1254744d2762e24..27a8fed0e784111 100644 --- a/lib/modules/manager/gleam/readme.md +++ b/lib/modules/manager/gleam/readme.md @@ -31,11 +31,10 @@ Here's how `"auto"` works with the `gleam` manager: | Simple range | `0.39.0` | `<= 0.38.0` | `<= 0.39.0` | If update outside current range: widens range to include the new version. | | Exact version constraint | `0.13.0` | `== 0.12.0` | `== 0.13.0` | Replace old version with new version. | -#### Do not set `rangeStrategy` to `update-lockfile` or `in-range-only` +### Recommended `rangeStrategy` for apps and libraries -Do _not_ set `rangeStrategy` to: +For applications, we recommend using `rangeStrategy=pin`. +This pins your dependencies to exact versions, which is generally considered [best practice for apps](../../../dependency-pinning.md). -- `"update-lockfile"` -- `"in-range-only"` - -Renovate's `gleam` manager ignores these values, and uses the `widen` strategy instead. +For libraries, use `rangeStrategy=widen` with version ranges in your `gleam.toml`. +This allows for greater compatibility with other projects that may use your library as a dependency.