bafolts / tplant

Typescript to plantuml
https://segmentationfaults.com/tplant/default.html
GNU General Public License v3.0
266 stars 34 forks source link

Broken output if multiple exports in same nested file #115

Closed lgberro closed 11 months ago

lgberro commented 11 months ago

If a nested folder has a file with multiple named exports the output class name gets broken.

// /FooBar/types.ts

export interface Foo {
  bar: number
  foo: string
}

export interface Bar extends Foo {
  foobar: boolean
}

run in root folder: npx tplant -A -f mermaid -i '**/*.ts' -o uml.mmd

Output:

classDiagram
class Foo {
    +bar: number
    +foo: string
}
<<Interface>> Foo
"FooBar/types".Foo <|.. Bar
class Bar {
    +foobar: boolean
}
<<Interface>> Bar

Expected:

classDiagram
class Foo {
    +bar: number
    +foo: string
}
<<Interface>> Foo
Foo <|.. Bar
class Bar {
    +foobar: boolean
}
<<Interface>> Bar

Both Mermaid and PlantUML break because of "FooBar/types".

Version: 3.1.2

pkropachev commented 9 months ago

I faced with the same problem.

export interface FileLoader {
  start(url: string): void;
  stop(): void;
}

export interface Downloader extends FileLoader {
  startToFile(path: string): void;
}

export interface Uploader extends FileLoader {
  uploadContetnt(path: string): void;
}
@startuml
interface FileLoader {
    +start(url: string): void
    +stop(): void
}
interface Downloader extends "src1/loader".FileLoader {
    +startToFile(path: string): void
}
interface Uploader extends "src1/loader".FileLoader {
    +uploadContetnt(path: string): void
}
@enduml

@bafolts, could you please release new version with this fix?

bafolts commented 9 months ago

I faced with the same problem.

export interface FileLoader {
  start(url: string): void;
  stop(): void;
}

export interface Downloader extends FileLoader {
  startToFile(path: string): void;
}

export interface Uploader extends FileLoader {
  uploadContetnt(path: string): void;
}
@startuml
interface FileLoader {
    +start(url: string): void
    +stop(): void
}
interface Downloader extends "src1/loader".FileLoader {
    +startToFile(path: string): void
}
interface Uploader extends "src1/loader".FileLoader {
    +uploadContetnt(path: string): void
}
@enduml

@bafolts, could you please release new version with this fix?

Done. This is now in 3.1.3 and on npm.