asteasolutions / zod-to-openapi

A library that generates OpenAPI (Swagger) docs from Zod schemas
MIT License
997 stars 61 forks source link

Add multi package support #220

Closed danielkarso-pon closed 7 months ago

danielkarso-pon commented 8 months ago

Via: https://www.sensedeep.com/blog/posts/2021/how-to-create-single-source-npm-module.html

danielkarso-pon commented 8 months ago

PR force updated after it failed previously because of prettier lint issues

georgyangelov commented 8 months ago

Thank you for this! Let me know after you have a chance to test the package as a dependency of some project that uses ESM.

@AGalabov could you take a look as well, also do you have somewhere we can test the CJS importing before a release?

AGalabov commented 8 months ago

@danielkarso-pon did you manage to test this? I just tried setting up some test projects. From what I see the current setup would not fully work. One thing that I saw as a problem was that the compiled js files for ESM modules are lacking the file extension .js at the end => the internal imports that we use in our app are "wrong" and cannot be resolved :thinking:

AGalabov commented 8 months ago

@danielkarso-pon @georgyangelov - I opened an alternative PR using Rollup as a small module bundler to work around the inconveniences of transpiling the files and imports by combining them into a single file. I am open for reviews and comments. I managed to test in a small project + the project mentioned here

AGalabov commented 7 months ago

@danielkarso-pon thank you once again for the contribution, ideas and the review. I will go ahead with the other PR as we agreed