From 249a7bde89843e0192f15c55b9d0817c6721d8fb Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Mon, 6 Jan 2025 02:31:46 +0100 Subject: [PATCH] Fix adding comment to certain ftl files --- ...ExtensionModuleFileSourceCodeReadyToBeCopied.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts b/src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts index 10a4272f..243f905c 100644 --- a/src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts +++ b/src/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts @@ -100,9 +100,19 @@ function addCommentToSourceCode(params: { } if (fileRelativePath.endsWith(".ftl")) { - return toResult( - [`<#--`, ...commentLines.map(line => ` ${line}`), `-->`].join("\n") + const comment = [`<#--`, ...commentLines.map(line => ` ${line}`), `-->`].join( + "\n" ); + + if (sourceCode.trim().startsWith("<#ftl")) { + const [first, ...rest] = sourceCode.split(">"); + + const last = rest.join(">"); + + return [`${first}>`, comment, last].join("\n"); + } + + return toResult(comment); } if (fileRelativePath.endsWith(".html") || fileRelativePath.endsWith(".svg")) {