From 0388e60b8eedbb189ad96e663f36ead98f9a87ed Mon Sep 17 00:00:00 2001 From: erdemcaygor Date: Tue, 29 Apr 2025 01:04:08 +0300 Subject: [PATCH] refactor --- .../schematics/src/commands/change-theme/index.ts | 10 +++------- .../schematics/src/commands/change-theme/style-map.ts | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/npm/ng-packs/packages/schematics/src/commands/change-theme/index.ts b/npm/ng-packs/packages/schematics/src/commands/change-theme/index.ts index 124de5524d..9e27d31c9f 100644 --- a/npm/ng-packs/packages/schematics/src/commands/change-theme/index.ts +++ b/npm/ng-packs/packages/schematics/src/commands/change-theme/index.ts @@ -190,10 +190,8 @@ export function removeImportsFromStandaloneProviders( let modules: readonly ts.Expression[] = []; if (args.length === 1 && ts.isArrayLiteralExpression(args[0])) { - // importProvidersFrom([Module1, Module2]) tarzı modules = (args[0] as ts.ArrayLiteralExpression).elements; } else { - // importProvidersFrom(Module1, Module2) tarzı modules = args; } @@ -219,7 +217,6 @@ export function removeImportsFromStandaloneProviders( } } - // Eğer tüm modüller silinirse, importProvidersFrom() fonksiyonunu da kaldır const remaining = modules.filter(el => !elementsToRemove.includes(el)); if (remaining.length === 0) { const start = expr.getFullStart(); @@ -236,7 +233,6 @@ export function removeImportsFromStandaloneProviders( } } } else { - // Diğer bağımsız provider fonksiyonları için const match = impMap.find(({ importName, provider }) => { const moduleSymbol = importName?.split('.')[0]; return ( @@ -306,11 +302,11 @@ export function removeProviderFromNgModuleMetadata( const prevChar = source.text.slice(start - 1, start); if (nextChar === ',') { - recorder.remove(start, end - start + 1); // sağ virgül ile + recorder.remove(start, end - start + 1); } else if (prevChar === ',') { - recorder.remove(start - 1, end - start + 1); // sol virgül ile + recorder.remove(start - 1, end - start + 1); } else { - recorder.remove(start, end - start); // direkt + recorder.remove(start, end - start); } } } diff --git a/npm/ng-packs/packages/schematics/src/commands/change-theme/style-map.ts b/npm/ng-packs/packages/schematics/src/commands/change-theme/style-map.ts index 4f93e996e2..8cae3b4641 100644 --- a/npm/ng-packs/packages/schematics/src/commands/change-theme/style-map.ts +++ b/npm/ng-packs/packages/schematics/src/commands/change-theme/style-map.ts @@ -261,7 +261,7 @@ styleMap.set(ThemeOptionsEnum.LeptonXLite, [ bundleName: 'bootstrap-icons', }, ]); -// the code written by Github co-pilot. thank go-pilot. You are the best sidekick. + export const allStyles = Array.from(styleMap.values()).reduce((acc, val) => [...acc, ...val], []); export const importMap = new Map();