From 2188e78ac7b82ce02b2f3f884d58f5e6b5406ac6 Mon Sep 17 00:00:00 2001 From: narendrarbabu Date: Thu, 27 Feb 2025 21:06:21 +0530 Subject: [PATCH 1/3] Changes to fix theme names while migrating app that is generated through sencha architect --- packages/ext-gen/appMigrate.js | 37 ++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/packages/ext-gen/appMigrate.js b/packages/ext-gen/appMigrate.js index 942faed..c1e0f3a 100644 --- a/packages/ext-gen/appMigrate.js +++ b/packages/ext-gen/appMigrate.js @@ -22,6 +22,10 @@ var gitIgnore = '.gitIgnore'; var gitIgnoreAppend = '/generatedFiles ' + os.EOL + '/cordova ' + os.EOL + '/node_modules' + os.EOL; var gitIgnoreData = '/build ' + os.EOL + gitIgnoreAppend; var extFrameworkPath = 'node_modules/@sencha/ext'; +var themes = ['theme-base', 'theme-ios', 'theme-material', + 'theme-aria', 'theme-neutral', 'theme-classic', 'theme-gray', + 'theme-crisp', 'theme-crisp-touch', 'theme-neptune', 'theme-neptune-touch', + 'theme-triton', 'theme-graphite']; var classic = false; var modern = false; var universal = false; @@ -340,10 +344,6 @@ function removeDebugJsPath(jsonLocation) { function handleWorkspaceJsonmigrate() { var workspaceJsonObject = getJson(workspaceJson), - themes = ['theme-base', 'theme-ios', 'theme-material', - 'theme-aria', 'theme-neutral', 'theme-classic', 'theme-gray', - 'theme-crisp', 'theme-crisp-touch', 'theme-neptune', 'theme-neptune-touch', - 'theme-triton', 'theme-graphite'], packageNames = ['treegrid', 'calendar', 'charts', 'froala-editor', 'amf', 'd3', 'exporter', 'pivot', 'pivot-d3', 'pivot-locale', 'ux', 'font-ios'], basePath = '$\u007Bworkspace.dir}/node_modules/@sencha/ext-', @@ -513,11 +513,11 @@ function buildToolKitAndThemeDetails() { if (appJsonObject.hasOwnProperty('toolkit')) { if (appJsonObject.toolkit == classicProfile) { classic = true; - classicTheme = appJsonObject.theme; + classicTheme = appJsonObject.theme = verifyAndUpdateTheme(appJsonObject.theme); } else { modern = true; - modernTheme = appJsonObject.theme; + modernTheme = appJsonObject.theme = verifyAndUpdateTheme(appJsonObject.theme); } } else { @@ -532,12 +532,33 @@ function buildToolKitAndThemeDetails() { for (profile in appJsonObject.builds) { if (profile === classicProfile) { classic = true; - classicTheme = appJsonObject.builds[profile].theme; + classicTheme = appJsonObject.builds[profile].theme = verifyAndUpdateTheme(appJsonObject.builds[profile].theme); } if (profile == modernProfile) { modern = true; - modernTheme = appJsonObject.builds[profile].theme; + modernTheme = appJsonObject.builds[profile].theme = verifyAndUpdateTheme(appJsonObject.builds[profile].theme); } } } } + +function verifyAndUpdateTheme(appTheme) { + var themeStr = appTheme.replace(/[^a-z-]/g, ''); + + // once special chars are removed check if it is one of the existing themes + if(themes.indexOf(themeStr) >= 0) { + return themeStr; + } else { // if doesn't exists return the appropriate theme from built-in theme list + var matchedTheme; + + for(var i = 0; i < themes.length; i++) { + if (themeStr.includes(themes[i])) { + matchedTheme = themes[i]; + break; + } + } + + return matchedTheme ? matchedTheme : appTheme; + } +} + From 0773f5b5106c2a5fd4e3b08f80ce080434896ba3 Mon Sep 17 00:00:00 2001 From: narendrarbabu Date: Fri, 28 Feb 2025 11:35:45 +0530 Subject: [PATCH 2/3] code format changes --- packages/ext-gen/appMigrate.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/ext-gen/appMigrate.js b/packages/ext-gen/appMigrate.js index c1e0f3a..3919ae6 100644 --- a/packages/ext-gen/appMigrate.js +++ b/packages/ext-gen/appMigrate.js @@ -543,22 +543,21 @@ function buildToolKitAndThemeDetails() { } function verifyAndUpdateTheme(appTheme) { - var themeStr = appTheme.replace(/[^a-z-]/g, ''); + var themeStr = appTheme.replace(/[^a-z-]/g, ''), + matchedTheme; // once special chars are removed check if it is one of the existing themes - if(themes.indexOf(themeStr) >= 0) { + if (themes.indexOf(themeStr) >= 0) { return themeStr; - } else { // if doesn't exists return the appropriate theme from built-in theme list - var matchedTheme; - - for(var i = 0; i < themes.length; i++) { - if (themeStr.includes(themes[i])) { - matchedTheme = themes[i]; - break; - } + } + + // if doesn't exists return the appropriate theme from built-in theme list + for (var i = 0; i < themes.length; i++) { + if (themeStr.includes(themes[i])) { + matchedTheme = themes[i]; + break; } - - return matchedTheme ? matchedTheme : appTheme; } + return matchedTheme ? matchedTheme : appTheme; } From 6cef9cb4dd2ca5b3c8faca8208b25e9e8b40a1db Mon Sep 17 00:00:00 2001 From: Govardhan Reddy <43410193+GovardhanCel@users.noreply.github.com> Date: Fri, 28 Feb 2025 13:29:51 +0530 Subject: [PATCH 3/3] Update appMigrate.js --- packages/ext-gen/appMigrate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ext-gen/appMigrate.js b/packages/ext-gen/appMigrate.js index 3919ae6..23970a0 100644 --- a/packages/ext-gen/appMigrate.js +++ b/packages/ext-gen/appMigrate.js @@ -544,7 +544,7 @@ function buildToolKitAndThemeDetails() { function verifyAndUpdateTheme(appTheme) { var themeStr = appTheme.replace(/[^a-z-]/g, ''), - matchedTheme; + matchedTheme; // once special chars are removed check if it is one of the existing themes if (themes.indexOf(themeStr) >= 0) {