Skip to content

Commit afd647d

Browse files
committed
fix .nvmrc versions
closes #10
1 parent c916a4c commit afd647d

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

fixtures/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
^20

src/sniff.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Deno.test("devenv.ts", async (runner) => {
9292
"pnpm.io@7.33.7",
9393
],
9494
[".node-version", "nodejs.org@16.16.0"],
95+
[".nvmrc", "nodejs.org^20"],
9596
["python-version/std/.python-version", "python.org~3.10"],
9697
["python-version/commented/.python-version", "python.org~3.11"],
9798
[".ruby-version", "ruby-lang.org@3.2.1"],

src/sniff.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ export default async function (dir: Path) {
162162
async function version_file(path: Path, project: string) {
163163
let s = (await path.read()).trim();
164164
if (s.startsWith("v")) s = s.slice(1); // v prefix has no effect but is allowed
165-
s = `${project}@${s}`;
165+
if (s.match(/^[0-9]/)) s = `@${s}`; // bare versions are `@`ed
166+
s = `${project}${s}`;
166167
pkgs.push(utils.pkg.parse(s));
167168
}
168169

0 commit comments

Comments
 (0)