From ba47acbd1a176eef7c92e9d7235ba8c068313ff9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20L=C3=A4hdekorpi?= Date: Thu, 18 Aug 2022 09:58:49 +0300 Subject: [PATCH 1/2] feat: allow using the source text as a keygen strategy --- package.json | 3 ++- src/core/Extract.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1eed9e06..a5601685 100644 --- a/package.json +++ b/package.json @@ -1132,7 +1132,8 @@ "enum": [ "slug", "random", - "empty" + "empty", + "source" ], "description": "%config.keygen_strategy%" }, diff --git a/src/core/Extract.ts b/src/core/Extract.ts index 2bc403cf..8506230b 100644 --- a/src/core/Extract.ts +++ b/src/core/Extract.ts @@ -26,6 +26,9 @@ export function generateKeyFromText(text: string, filepath?: string, reuseExisti else if (keygenStrategy === 'empty') { key = '' } + else if (keygenStrategy === 'source') { + key = text + } else { text = text.replace(/\$/g, '') key = limax(text, { separator: Config.preferredDelimiter, tone: false }) @@ -33,7 +36,7 @@ export function generateKeyFromText(text: string, filepath?: string, reuseExisti } const keyPrefix = Config.keyPrefix - if (keyPrefix && keygenStrategy !== 'empty') + if (keyPrefix && keygenStrategy !== 'empty' && keygenStrategy !== 'source') key = keyPrefix + key if (filepath && key.includes('fileName')) { From c5ab9bf3a796212c0509ed7d69fc15f4264ebb36 Mon Sep 17 00:00:00 2001 From: Alex Terehov Date: Sun, 27 Aug 2023 17:17:06 -0300 Subject: [PATCH 2/2] Empty commit to trigger CI