From 0e6faad15f09cb7f9f5e2675e686b9da9d227823 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Mon, 25 Nov 2024 12:43:06 -0500 Subject: [PATCH] fix(.nvmrc) closes #1051 --- fixtures/.nvmrc | 1 + src/utils/devenv.test.ts | 1 + src/utils/devenv.ts | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 fixtures/.nvmrc diff --git a/fixtures/.nvmrc b/fixtures/.nvmrc new file mode 100644 index 00000000..6701850f --- /dev/null +++ b/fixtures/.nvmrc @@ -0,0 +1 @@ +^20.0.0 \ No newline at end of file diff --git a/src/utils/devenv.test.ts b/src/utils/devenv.test.ts index 06df67c3..effd4837 100644 --- a/src/utils/devenv.test.ts +++ b/src/utils/devenv.test.ts @@ -80,6 +80,7 @@ Deno.test("devenv.ts", async runner => { 'pnpm.io@7.33.7', ], [".node-version", "nodejs.org@16.16.0"], + [".nvmrc", "nodejs.org^20"], ["python-version/std/.python-version", "python.org~3.10"], ["python-version/commented/.python-version", "python.org~3.11"], [".ruby-version", "ruby-lang.org@3.2.1"], diff --git a/src/utils/devenv.ts b/src/utils/devenv.ts index f39681a5..5c80cf07 100644 --- a/src/utils/devenv.ts +++ b/src/utils/devenv.ts @@ -145,7 +145,8 @@ export default async function(dir: Path) { async function version_file(path: Path, project: string) { let s = (await path.read()).trim() if (s.startsWith('v')) s = s.slice(1) // v prefix has no effect but is allowed - s = `${project}@${s}` + if (s.match(/^[0-9]/)) s = `@${s}` // bare numbers are single versions + s = `${project}${s}` pkgs.push(utils.pkg.parse(s)) }