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')) {