Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(manager/gleam): enable update-lockfile #31002

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
enable update-locked range strategy
  • Loading branch information
SnakeDoc committed Nov 20, 2024
commit cff8a0d77e282cc86522f573fe899cba19514bdb
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);
SnakeDoc marked this conversation as resolved.
Show resolved Hide resolved
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') {
rarkins marked this conversation as resolved.
Show resolved Hide resolved
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.