Skip to content

fix: parse dvm's key=value format in .dvmrc - #133

Open
somaz94 wants to merge 1 commit into
denoland:mainfrom
somaz94:fix/dvmrc-key-value
Open

fix: parse dvm's key=value format in .dvmrc#133
somaz94 wants to merge 1 commit into
denoland:mainfrom
somaz94:fix/dvmrc-key-value

Conversation

@somaz94

@somaz94 somaz94 commented Aug 4, 2026

Copy link
Copy Markdown

The README documents that deno-version-file can read dvm's .dvmrc, but the parser only accepts a bare version string. dvm writes the file as key=value (configrc.rs serializes with format!("{}={}", k, v)), so deno_version=1.43.1 falls through to the bare-version branch and fails with The passed version range is not valid.

.dvmrc is a general key/value store rather than a single line, and dvm also records registry_binary / registry_version, so the version is not necessarily on the first line. The new pattern scans every line for the deno_version key. It runs only after the existing .tool-versions match, and the two patterns are disjoint, so bare-version and .tool-versions files behave exactly as before.

Also tolerates spaces around = (dvm's own reader trims both sides) and a v prefix, consistent with the existing .tool-versions handling.

Validation:

  • deno lint, deno fmt --check, deno check src/main.ts all pass locally
  • deno run -A scripts/build.ts rebuilt dist/, and a second build is byte-identical, so build-diff stays clean
  • New test-version-file-dvm job writes a dvm-style .dvmrc with deno_version on the second line, so it covers the multi-key case rather than just a prefix strip
  • Exercised the parser locally over 13 cases: dvm single-key / multi-key in both orders / spaces around = / v prefix / CRLF, plus regressions for bare version, bare range (~1.32), .tool-versions, and a my_deno_versionx= string that must not match

related: #121

@somaz94

somaz94 commented Aug 4, 2026

Copy link
Copy Markdown
Author

Heads up on the red CI, both failures are pre-existing on main and not from this change.

lint fails at deno check src/main.ts because canary now declares ImportMeta.dirname/filename as string, which conflicts with the optional re-declaration at src/main.ts:13-14. I reproduced the same 4 errors on an unmodified main checkout with the same canary build.

test (ubuntu-latest, 4e8b2f46...) fails with a 404 from dl.deno.land for that pinned canary hash, so the artifact looks expired.

The jobs this PR affects are green: build-diff, test-version-file (.dvmrc and .tool-versions), and the new test-version-file-dvm.

Happy to fix either one in a separate PR if that helps.

@somaz94
somaz94 marked this pull request as ready for review August 4, 2026 02:43
somaz94 added a commit to somaz94/somaz94 that referenced this pull request Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant