Skip to content

Commit

Permalink
Expose components to LibraryInfo.
Browse files Browse the repository at this point in the history
  • Loading branch information
shammowla committed Nov 20, 2023
1 parent a228bfb commit 8e93c10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/LibraryInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ const prepareLibraryInfo = ({ config, componentRegistry }) => {
}
resultConfig[key] = value.toString();
});
const components = componentRegistry.getComponentNames();
return {
version: libraryVersion,
configs: resultConfig,
commands: allCommands
commands: allCommands,
components
};
};

Expand Down
3 changes: 3 additions & 0 deletions src/core/createComponentRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ export default () => {
},
getLifecycleCallbacks(hookName) {
return lifecycleCallbacksByName[hookName] || [];
},
getComponentNames() {
return Object.keys(componentsByNamespace);
}
};
};
6 changes: 4 additions & 2 deletions test/unit/specs/components/LibraryInfo/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ describe("LibraryInfo", () => {
foo: "bar"
},
componentRegistry: {
getCommandNames: () => ["bar"]
getCommandNames: () => ["bar"],
getComponentNames: () => ["ComponentA", "ComponentB"]
}
};
});
Expand All @@ -30,7 +31,8 @@ describe("LibraryInfo", () => {
libraryInfo: {
version: `__VERSION__`,
configs: { foo: "bar" },
commands: ["bar", "configure", "setDebug"]
commands: ["bar", "configure", "setDebug"],
components: ["ComponentA", "ComponentB"]
}
});
});
Expand Down

0 comments on commit 8e93c10

Please sign in to comment.