tplant icon indicating copy to clipboard operation
tplant copied to clipboard

How to use project option?

Open chipbite opened this issue 3 years ago • 6 comments

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

chipbite avatar Nov 19 '21 15:11 chipbite

What was the command you ran when project option failed?

bafolts avatar Nov 20 '21 15:11 bafolts

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

BillyBobFry avatar Feb 22 '22 15:02 BillyBobFry

@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

bafolts avatar Feb 22 '22 16:02 bafolts

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 avatar Feb 25 '22 11:02 BillyBobFry

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.

BillyBobFry avatar Feb 25 '22 11:02 BillyBobFry

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.

zinefer avatar Oct 31 '23 13:10 zinefer