Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a config option for generate to write .ts instead of d.ts files (so that they're copied during build) #53

Closed
sahil87 opened this issue Dec 4, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@sahil87
Copy link

sahil87 commented Dec 4, 2020

When we build our projects, the zapatos/schema.d.ts file isn't being copied over into the "build" folder.
I am referring to the output of a command like: tsc -d --outDir lib/exports --project src/exports/. (lib is our build output folder)

  • In the repo containing the zapatos generated schema (Say db-schema-repo):
    👍 All good. I make the code understand the schema using /// <reference path="./zapatos/schema.d.ts" /> at the top of the main-entrypoint.ts file.

  • For the repos that use db-schema-repo as a dependency via some npm repository (Say api-layer-repo):
    👎 Until zapatos 2.x things were ok, as the outputs were .ts file. Now after 3.x however, because everything except d.ts files get copied over in the lib folder, typescript check fails with error like the following:
    Screenshot from 2020-12-04 17-33-11

Refer: https://stackoverflow.com/a/56440335/1233476

My current workaround is to rename the schema.d.ts file to schema.ts manually. (Maybe expose this as a config option in zg.generate() ?)

@jawj
Copy link
Owner

jawj commented Dec 17, 2020

Thanks for the helpful and complete report! I just tried renaming all the .d.ts files to .ts files in one of my projects, and nothing seems to break, so I agree this seems like a good candidate for a config option.

@jawj jawj changed the title d.ts files aren't copied over in build Add a config option for generate to write .ts instead of d.ts files (so that they're copied during build) Dec 17, 2020
@jawj jawj self-assigned this Dec 17, 2020
@jawj jawj added the enhancement New feature or request label Dec 17, 2020
@jawj
Copy link
Owner

jawj commented Jan 4, 2021

This is in master now, so should be in the next release.

@jawj
Copy link
Owner

jawj commented Jan 13, 2021

This is now released in 3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants