Skip to content

Commit d29698e

Browse files
authored
feat(manager/gleam): enable update-lockfile (#31002)
1 parent 9c999fb commit d29698e

File tree

5 files changed

+13
-28
lines changed

5 files changed

+13
-28
lines changed

docs/usage/configuration-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3613,7 +3613,7 @@ Behavior:
36133613
- `bump` = e.g. bump the range even if the new version satisfies the existing range, e.g. `^1.0.0` -> `^1.1.0`
36143614
- `replace` = Replace the range with a newer one if the new version falls outside it, and update nothing otherwise
36153615
- `widen` = Widen the range with newer one, e.g. `^1.0.0` -> `^1.0.0 || ^2.0.0`
3616-
- `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
3616+
- `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
36173617
- `in-range-only` = Update the lock file when in-range updates are available, ignore package file updates
36183618

36193619
Renovate's `"auto"` strategy works like this for npm:

lib/modules/manager/gleam/artifacts.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ export async function updateArtifacts(
4949
],
5050
};
5151

52-
await exec('gleam deps download', execOptions);
52+
// `gleam deps update` with no packages rebuilds the lock file
53+
const packagesToUpdate = isLockFileMaintenance
54+
? []
55+
: updatedDeps.map((dep) => dep.depName).filter(Boolean);
56+
57+
const updateCommand = ['gleam deps update', ...packagesToUpdate].join(' ');
58+
await exec(updateCommand, execOptions);
5359
const newLockFileContent = await readLocalFile(lockFileName, 'utf8');
5460
if (!newLockFileContent) {
5561
logger.debug(`No ${lockFileName} found`);

lib/modules/manager/gleam/range.spec.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ describe('modules/manager/gleam/range', () => {
1616
expect(getRangeStrategy(config)).toBe('widen');
1717
});
1818

19-
it('returns widen if update-lockfile', () => {
20-
const config: RangeConfig = { rangeStrategy: 'update-lockfile' };
21-
expect(getRangeStrategy(config)).toBe('widen');
22-
});
23-
24-
it('returns widen if in-range-only', () => {
25-
const config: RangeConfig = { rangeStrategy: 'in-range-only' };
26-
expect(getRangeStrategy(config)).toBe('widen');
27-
});
28-
2919
it('defaults to widen', () => {
3020
const config: RangeConfig = {
3121
rangeStrategy: 'auto',

lib/modules/manager/gleam/range.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@ export function getRangeStrategy(config: RangeConfig): RangeStrategy {
1616
);
1717
return 'widen';
1818
}
19-
if (rangeStrategy === 'update-lockfile') {
20-
logger.warn(
21-
'Unsupported rangeStrategy update-lockfile, defaulting to widen',
22-
);
23-
return 'widen';
24-
}
25-
if (rangeStrategy === 'in-range-only') {
26-
logger.warn('Unsupported rangeStrategy in-range-only, defaulting to widen');
27-
return 'widen';
28-
}
2919
if (rangeStrategy !== 'auto') {
3020
return rangeStrategy;
3121
}

lib/modules/manager/gleam/readme.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ Here's how `"auto"` works with the `gleam` manager:
3131
| Simple range | `0.39.0` | `<= 0.38.0` | `<= 0.39.0` | If update outside current range: widens range to include the new version. |
3232
| Exact version constraint | `0.13.0` | `== 0.12.0` | `== 0.13.0` | Replace old version with new version. |
3333

34-
#### Do not set `rangeStrategy` to `update-lockfile` or `in-range-only`
34+
### Recommended `rangeStrategy` for apps and libraries
3535

36-
Do _not_ set `rangeStrategy` to:
36+
For applications, we recommend using `rangeStrategy=pin`.
37+
This pins your dependencies to exact versions, which is generally considered [best practice for apps](../../../dependency-pinning.md).
3738

38-
- `"update-lockfile"`
39-
- `"in-range-only"`
40-
41-
Renovate's `gleam` manager ignores these values, and uses the `widen` strategy instead.
39+
For libraries, use `rangeStrategy=widen` with version ranges in your `gleam.toml`.
40+
This allows for greater compatibility with other projects that may use your library as a dependency.

0 commit comments

Comments
 (0)