From 708014351596da3c29bc6e662ea654fbb0d9f19d Mon Sep 17 00:00:00 2001 From: Aidan Bleser Date: Fri, 1 Nov 2024 09:41:34 -0500 Subject: [PATCH] fixes #1368 --- packages/cli/src/commands/update.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/commands/update.ts b/packages/cli/src/commands/update.ts index 8712b3f57..8154fe3c0 100644 --- a/packages/cli/src/commands/update.ts +++ b/packages/cli/src/commands/update.ts @@ -149,8 +149,10 @@ async function runUpdate(cwd: string, config: cliConfig.Config, options: UpdateO if (p.isCancel(proceed) || proceed === false) cancel(); } + const utilsIndex = selectedComponents.findIndex((item) => item.name === "utils"); + // `update utils` - update the utils.(ts|js) file - if (selectedComponents.find((item) => item.name === "utils")) { + if (utilsIndex !== -1) { const extension = config.typescript ? ".ts" : ".js"; const utilsPath = config.resolvedPaths.utils + extension; @@ -160,6 +162,12 @@ async function runUpdate(cwd: string, config: cliConfig.Config, options: UpdateO // utils.(ts|js) is not in the registry, it is a template, so we'll just overwrite it await fs.writeFile(utilsPath, config.typescript ? UTILS : UTILS_JS); + + // remove utils so that it isn't fetched from the registry + selectedComponents = [ + ...selectedComponents.slice(0, utilsIndex), + ...selectedComponents.slice(utilsIndex + 1), + ]; } const tree = await registry.resolveTree({