samchon / nestia

NestJS Helper Libraries + TypeScript OpenAPI generator
https://nestia.io/
MIT License
1.85k stars 95 forks source link

Configuration for @ORGANIZATION/PROJECT #432

Open jsbrain opened 1 year ago

jsbrain commented 1 year ago

I checked to docs and the code and if there is an option to configure the package name of the generated client sdk I didn't find it.

As every execution of yarn nestia sdk overwrites the file this makes it hard to generate a consistent package.

I kinda have the feeling I'm missing something here though, as I cannot imagine this is actually the intended behavior?

PhilippAlbrecht-KR commented 1 year ago

We also stumbled upon this while trying to build the client for a mono repo. I kinda have to set the name inside the package.json and than commit everything in order for the other projects to find it. Would be nice to just build it with a consistent name without checking it into git.

jsbrain commented 1 year ago

So meanwhile I actually figured out, that this is not the default behavior as usually, once you change the package name and version, they won't be overwritten on subsequent builds. The fact that it's overwritten is actually due to some kind of dependency lookup problem while using yarn workspaces.

I'm not entirely sure what's the actual problem but I believe nestia doesn't find the correct node_modules directory (where it stores some data?) which causes this behavior.

My temporary solution is to build the sdk into a temporary directory outside the directories of my workspaces: array and this leads to consistent builds. I then copy over the data to the actual workspaces directory I want it to be with a subsequent build step. Kind of an ugly workaround but it works for now.

Adding flags to pre-config the build step (even while not fixing the yarn workspaces issue) would mitigate the problem and would generally be a nice feature to add whatsoever.

samchon commented 1 year ago

https://github.com/samchon/nestia-template

Welcome your PR. Will wait until Sunday, and if no PR until that, then I will do it.