Skip to content

Commit

Permalink
refactor: remove variable
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaugomez committed Jul 10, 2023
1 parent f269b37 commit 4b99411
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/services/get_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ import { Dependency } from "../types/dependency.js";
export function getDependencies(args: Partial<Args>) {
const dependencies: Dependency[] = [];

const project = new Project({
tsConfigFilePath: args.tsconfig,
});

project.getSourceFiles().forEach((sourceFile) => {
sourceFile.getClasses().forEach((classDeclaration) => {
const hasDecorator = Boolean(classDeclaration.getDecorator("injectable"));
if (!hasDecorator) return;
new Project({ tsConfigFilePath: args.tsconfig })
.getSourceFiles()
.forEach((sourceFile) => {
sourceFile.getClasses().forEach((classDeclaration) => {
const hasDecorator = Boolean(
classDeclaration.getDecorator("injectable")
);
if (!hasDecorator) return;

const className = classDeclaration.getName();
if (!className) return;
const className = classDeclaration.getName();
if (!className) return;

const implement = classDeclaration.getImplements()[0];
dependencies.push({
path: sourceFile.getFilePath().replace(/^.*src/, "@/src"),
abstraction: implement?.getText() ?? className,
implementation: className,
const implement = classDeclaration.getImplements()[0];
dependencies.push({
path: sourceFile.getFilePath().replace(/^.*src/, "@/src"),
abstraction: implement?.getText() ?? className,
implementation: className,
});
});
});
});

return dependencies;
}

0 comments on commit 4b99411

Please sign in to comment.