Browse Source

refactor

pull/22645/head
erdemcaygor 1 year ago
parent
commit
0388e60b8e
  1. 10
      npm/ng-packs/packages/schematics/src/commands/change-theme/index.ts
  2. 2
      npm/ng-packs/packages/schematics/src/commands/change-theme/style-map.ts

10
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);
}
}
}

2
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<ThemeOptionsEnum, ImportDefinition[]>();

Loading…
Cancel
Save