bafolts / tplant

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

How to use project option? #86

Open chipbite opened 2 years ago

chipbite commented 2 years ago

Hi! I have tried using project option, but cannot get it to work.

I always get "Missing input file"

Any clues? I have tested with a simplified tsconfig (just files, one path). No joy.

BR! /marcus

bafolts commented 2 years ago

What was the command you ran when project option failed?

BillyBobFry commented 2 years ago

Not the OP, but I got the same error with: tplant --project ./common/tsconfig.json --output ./testStore.svg

Also failed with tplant --input common/**.*.ts --project common/tsconfig.json --output ./testStore.svg

bafolts commented 2 years ago

@BillyBobFry what error did you get with:

tplant --input common/**.*.ts --project common/tsconfig.json --output ./testStore.svg

Since the input option was provided I wouldn't expect to see Missing input file.

https://github.com/bafolts/tplant/blob/master/src/index.ts#L34

I can't see how the project option is used. There is definitely some bug here. This is where we look for the tsconfig.json

BillyBobFry commented 2 years ago

Ah sorry, I was perhaps a bit unclear. The first command gives me the error Missing input file.

I wasn't sure if I also needed an input glob with the --project option, so I tried the second command to see if I could get it working with a tsconfig AND an input glob. In that case there was no error message, but it only generated UML from the first file that matched the glob.

BillyBobFry commented 2 years ago

I've found a solution to my problem (if not to the issue of --project not working).

If I wrap my input glob in single quotes then the resulting output file contains models from all matching file paths - for some reason without the quotes it only processes the first match. Something to do with my shell perhaps? I'm using zsh.

tplant --input 'common/**/*.ts' --output ./testStore.svg ^^^ This does what I need.

zinefer commented 9 months ago

I was using tplant -i src/index.js because the glob was only grabbing the first file but this produced a diagram with a syntax error. After passing in the glob in a string like above it began to work.