feat: add label configuration fields to barcode templates and implement zero-padding support in variable replacement
Build and Push Multi-Platform Images / build-and-push (push) Successful in 27s

This commit is contained in:
2026-05-07 23:34:52 +02:00
parent 80f862a0c0
commit 71502df7b4
3 changed files with 47 additions and 3 deletions
@@ -14,7 +14,17 @@ function escape(s: string): string {
}
function applyVars(template: string, vars: Record<string, string>): string {
return template.replace(/\{([^}]+)\}/g, (_, key) => vars[key] ?? `{${key}}`);
return template.replace(/\{([^}]+)\}/g, (_, key: string) => {
const colonIdx = key.indexOf(':');
if (colonIdx !== -1) {
const varName = key.slice(0, colonIdx);
const width = parseInt(key.slice(colonIdx + 1), 10);
if (!isNaN(width) && varName in vars) {
return vars[varName].padStart(width, '0');
}
}
return vars[key] ?? `{${key}}`;
});
}
@Injectable()