From 72b051db4c95a70d4ea8d0de8d2162e881a0dc1e Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Thu, 21 Nov 2024 15:39:24 +0000 Subject: [PATCH] refactor: update various todo comments with more info --- core/src/init.luau | 14 +++++++++++--- lune/init.luau | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/src/init.luau b/core/src/init.luau index 5bb78da..c9ec882 100644 --- a/core/src/init.luau +++ b/core/src/init.luau @@ -74,11 +74,17 @@ end local TOOL_INSTALL_DIR = (dirs.homeDir() or error("Couldn't get home dir :(")):join(".pesde"):join("bin") function installTool(tool: ToolId) + local toolStart = os.clock() local toolAlias = tool.alias:unwrapOr(string.split(tool.repo, "/")[2]) - local toolInstallPath = TOOL_INSTALL_DIR:join(toolAlias) + print("toolAlias defaulting took", os.clock() - toolStart) - -- TODO: This is a bit too much overhead on startup and takes about 2s - -- We can improve this by following what rokit does, where we symlink + local installStart = os.clock() + local toolInstallPath = TOOL_INSTALL_DIR:join(toolAlias) + print("toolInstallPath joining took", os.clock() - installStart) + + -- TODO: In order to eliminate fs read overhead on startup and to disallow + -- the use of the tool binary when outside a package where it is installed, + -- we can improve this by following what rokit does, where we symlink -- the tool's path to this script, and check the file that we are being -- invoked as, in order to figure out what tool to execute @@ -169,6 +175,8 @@ function installTool(tool: ToolId) end end + -- TODO: Maintain multiple versions of a tool, and avoid downloading + -- the binary for a version again if it's already there pathfs.move(binaryPath, toolInstallPath) runTool(toolInstallPath) end diff --git a/lune/init.luau b/lune/init.luau index 8d9de94..6b60423 100644 --- a/lune/init.luau +++ b/lune/init.luau @@ -3,6 +3,8 @@ local semver = require("./luau_packages/semver") local Option = require("./lune_packages/option") type Option = Option.Option +-- TODO: Use _G._PESDE_ROOT to get the install directory, then decode the +-- pesde manifest to get the version of the tool dynamically core.installTool({ alias = Option.Some("lune"), repo = "lune-org/lune",