bafolts / tplant

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

+findConfigUpwards(rootDir: string): string #122

Open Antonytm opened 5 months ago

Antonytm commented 5 months ago

I get

[From string (line 3) ]
@startuml
+findConfigUpwards(rootDir: string): string
Syntax Error?

when trying to generate documentation for @sitecore/jss

I assume it might be related to

"extends": "../../tsconfig.json",

in tsconfig.json

Antonytm commented 5 months ago

Steps to reproduce:

  1. Clone https://github.com/Sitecore/jss/
  2. Install tsplant npm install --global tplant
  3. Run `tplant --input packages/sitecore-jss-nextjs/*/.ts --output Playground.svg

Expected result: SVG should be generated Actual result:

This page contains the following errors:
error on line 634 at column 19: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.
[From string (line 3) ]
@startuml
+findConfigUpwards(rootDir: string): string | null
Syntax Error?
fuhrmanator commented 2 months ago

I also have this problem with another project. It is due to a bug (that I fixed in a PR https://github.com/bafolts/tplant/pull/121#issue-2139103949) where tplant puts functions (which are not UML methods) into the PlantUML (and they appear outside of classes, thus causing PlantUML to crash).

For example, https://github.com/babel/babel/blob/0417c41e5982b8e49477227dc8fc20f16eb61e4c/packages/babel-core/src/config/files/configuration.ts#L212 shows that it's not a method (export function).

I suspect the npm package didn't get built/published properly. I also noticed that tplant -V says 3.1.2, whereas it should have been bumped to 3.1.3 according to the npm package.

I just cloned and built the code from the repo here, and I don't have the problem with functions going into the PlantUML. However, if I run it from the latest npm install tplant, I see the functions there.

fuhrmanator commented 2 months ago

It works for me if I install the 3.1.2 3.1.0 version:

npm install -g tplant@3.1.0