Compare commits

...

4 Commits

Author SHA1 Message Date
f5231b840d Update changelog v5.3.2 2022-05-04 10:16:04 +00:00
afb6596c4b Bump version (changelog ignore) 2022-05-04 12:13:10 +02:00
dde9afef92 Merge pull request #101 from Romcol/bugfix/99
Issue #99 - Make replace less greedy in remplaceImportFromStatic
2022-05-04 12:12:06 +02:00
6595e9c3cb [IMP] Issue #99 - Make replace less greedy in remplaceImportFromStatic 2022-05-04 11:22:58 +02:00
3 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,10 @@
### **5.3.2** (2022-05-04)
- Merge pull request #101 from Romcol/bugfix/99
Issue #99 - Make replace less greedy in remplaceImportFromStatic
- [IMP] Issue #99 - Make replace less greedy in remplaceImportFromStatic
### **5.3.1** (2022-04-29)
- Comment out missleading informations

View File

@ -1,6 +1,6 @@
{
"name": "keycloakify",
"version": "5.3.1",
"version": "5.3.2",
"description": "Keycloak theme generator for Reacts app",
"repository": {
"type": "git",

View File

@ -17,12 +17,12 @@ export function replaceImportsFromStaticInJsCode(params: { jsCode: string; urlOr
const { jsCode, urlOrigin } = params;
const fixedJsCode = jsCode
.replace(/(\w+\.\w+)\+"static\//g, (...[, group]) =>
.replace(/([a-zA-Z]+\.[a-zA-Z]+)\+"static\//g, (...[, group]) =>
urlOrigin === undefined
? `window.${ftlValuesGlobalName}.url.resourcesPath + "/build/static/`
: `("${ftlValuesGlobalName}" in window ? "${urlOrigin}" : "") + ${group} + "static/`,
)
.replace(/".chunk.css",(\w)+=(\w+\.\w+)\+(\w+),/, (...[, group1, group2, group3]) =>
.replace(/".chunk.css",([a-zA-Z])+=([a-zA-Z]+\.[a-zA-Z]+)\+([a-zA-Z]+),/, (...[, group1, group2, group3]) =>
urlOrigin === undefined
? `".chunk.css",${group1} = window.${ftlValuesGlobalName}.url.resourcesPath + "/build/" + ${group3},`
: `".chunk.css",${group1} = ("${ftlValuesGlobalName}" in window ? "${urlOrigin}" : "") + ${group2} + ${group3},`,