From 49cb0d63490f6b5de1d4ac25140a2070d380f638 Mon Sep 17 00:00:00 2001 From: Jacob Heider Date: Tue, 29 Nov 2022 16:39:45 -0500 Subject: [PATCH] Read from `VERSION` file if it exists --- src/hooks/useVirtualEnv.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hooks/useVirtualEnv.ts b/src/hooks/useVirtualEnv.ts index 362b9d82..0e9126e8 100644 --- a/src/hooks/useVirtualEnv.ts +++ b/src/hooks/useVirtualEnv.ts @@ -65,7 +65,12 @@ export default async function useVirtualEnv(opts?: { cwd: Path }): Promise x.file.basename() == "README.md") ?? files[0] + const { file, version: req_version } = files.find(x => x.file.basename() == "README.md") ?? files[0] + + const version_file = srcroot.join("VERSION").isFile() + + const version = version_file ? semver.parse(await version_file.read()) ?? req_version : req_version + const pkgs = files.flatMap(x => x.pkgs) //TODO magic deps should not conflict with requirements files deps