Skip to content

Commit

Permalink
enable update-locked range strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
SnakeDoc committed Nov 19, 2024
1 parent 743fed0 commit 2611eda
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/gleam/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down
10 changes: 0 additions & 10 deletions lib/modules/manager/gleam/range.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 0 additions & 10 deletions lib/modules/manager/gleam/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
11 changes: 5 additions & 6 deletions lib/modules/manager/gleam/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 2611eda

Please sign in to comment.