taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit dd3a12cfbf598ab8cb3eb3553e270854136ab838
parent da61377ca9318381aa8a4127e55f0ee616b5a070
Author: Sebastian <sebasjm@gmail.com>
Date:   Tue, 17 Jun 2025 12:57:23 -0300

sort the error message more clear

Diffstat:
Mpackages/pogen/src/potextract.ts | 37++++++++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/packages/pogen/src/potextract.ts b/packages/pogen/src/potextract.ts @@ -185,14 +185,22 @@ function processTaggedTemplateExpression( return res; } +const SCREEN_ID_MAP: Record<string, Set<string>> = {}; +const MISSING_SCREEN_ID: Set<string> = new Set(); + function formatScreenId( sourceFile: ts.SourceFile, outChunks: string[], screenId: string, ) { if (!screenId) { - console.error("missing screen id for file" + sourceFile.fileName); + MISSING_SCREEN_ID.add(sourceFile.fileName); } else { + if (!SCREEN_ID_MAP[screenId]) { + SCREEN_ID_MAP[screenId] = new Set(); + } + SCREEN_ID_MAP[screenId].add(sourceFile.fileName); + outChunks.push(`#. screenid: ${screenId}\n`); } } @@ -573,7 +581,7 @@ function processNode( sourceFile, outChunks, knownMessageIds, - projectPrefix + projectPrefix, ); }); } @@ -592,7 +600,16 @@ export function processFile( ) { // let lastTokLine = 0; // let preLastTokLine = 0; - processNode([], sourceFile, 0, 0, sourceFile, outChunks, knownMessageIds, projectPrefix); + processNode( + [], + sourceFile, + 0, + 0, + sourceFile, + outChunks, + knownMessageIds, + projectPrefix, + ); } function searchIntoParents(directory: string, fileFlag: string) { @@ -662,6 +679,20 @@ export function potextract() { processFile(f, chunks, knownMessageIds, gitRoot); } + MISSING_SCREEN_ID.forEach((fileName) => { + console.error(`missing SCREEN_ID for file: ${fileName}`); + }); + + Object.entries(SCREEN_ID_MAP).forEach(([screenId, files]) => { + if (files.size > 1) { + console.error( + `SCREEN_ID ${screenId} is in multiple files: \n * ${[...files].join( + "\n * ", + )}`, + ); + } + }); + const pot = chunks.join(""); //console.log(pot);