Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Publishing package with generated types #62

Open
Silverwolf90 opened this issue Nov 16, 2020 · 2 comments
Open

Publishing package with generated types #62

Silverwolf90 opened this issue Nov 16, 2020 · 2 comments

Comments

@Silverwolf90
Copy link
Contributor

Silverwolf90 commented Nov 16, 2020

How would one go about publishing a compiled machine w/ generated types to npm (ie: can be consumed by js or ts)?

I see that there's an --outDir parameter but not obvious how to me how to use this as part of a publish script. The consumer of the package might also have machines (w/ generated types) as well. Basically, curious what the workflow is if you've got your machines distributed across multiple packages.

@danielkcz
Copy link

I think this use case was never thought of. In theory, it could work if you set up postinstall script for your package and let it generate types there.

But it will be a problem in case of multiple packages generating this since all will be writing to @xstate/compiled. You would need to utilize --outDir to have a different output directory per package and import from that within the package instead of @xstate/compiled.

@Silverwolf90
Copy link
Contributor Author

Silverwolf90 commented Nov 17, 2020

Good to know, makes sense why I got nowhere with this 😅

Feels like this is a use-case that should be pretty streamlined-- I'd definitely be willing to help get it there!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants