Skip to content

Commit

Permalink
feat: Make injection tokens display more pretty in dependency graphing
Browse files Browse the repository at this point in the history
  • Loading branch information
Iku-turso committed Feb 21, 2022
1 parent 1fbdf74 commit dc55d12
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('createContainer.dependency-graph', () => {
'@startuml',
'"Setup(some-setuppable)" ..up* "some-child-injectable" : Setup',
'"some-child-injectable" ..up* "some-injection-token" : Setup',
'class "some-injection-token" << (T,#FF7700) >>',
'"some-injection-token" ..up* "some-token-injectable" : Setup',
'"Setup(some-setuppable)" ..up* "some-setuppable" : Setup',
'"some-parent-injectable" --up* "some-child-injectable"',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export default (...listOfGetRequireContexts) => {
find({ id: injectionToken.id }),
);

const newContext = [...oldContext, { id: injectionToken.id }];
const newContext = [
...oldContext,
{ id: injectionToken.id, isInjectionToken: true },
];

if (injectableCausingCycle) {
throw new Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ const plantUmlExtractorInjectable = getInjectable({

return ({ context }) => {
context.reduce((parent, dependency) => {
if (parent.isInjectionToken) {
plantUmlState.add(`class "${parent.id}" << (T,#FF7700) >>`);
}

if (parent.isChildOfSetup === true) {
plantUmlState.add(`"${parent.id}" ..up* "${dependency.id}" : Setup`);

Expand Down

0 comments on commit dc55d12

Please sign in to comment.