vendure-plugin-declaration.ts 591 B

123456789101112131415161718192021
  1. import { ClassDeclaration } from 'ts-morph';
  2. import { AdminUiExtensionTypeName } from '../constants';
  3. export class VendurePluginDeclaration {
  4. constructor(public classDeclaration: ClassDeclaration) {}
  5. get name(): string {
  6. return this.classDeclaration.getName() as string;
  7. }
  8. getPluginDir() {
  9. return this.classDeclaration.getSourceFile().getDirectory();
  10. }
  11. hasUiExtensions(): boolean {
  12. return !!this.classDeclaration
  13. .getStaticProperties()
  14. .find(prop => prop.getType().getText() === AdminUiExtensionTypeName);
  15. }
  16. }