Closed Sheemap closed 1 month ago
Hey @Sheemap
Added outDir
to the catalog in version @eventcatalog/core@2.11.4
.
https://www.eventcatalog.dev/docs/api/config#outDir
Thanks for raising the issue!
Hey @boyney123 !
Thanks for addressing this! I appreciate it. However it doesn't look like this fully works. It does change the out directory, but it dumps it in .eventcatalog-core/{outDir}
.
Theres a line here that is supposed to copy from that .eventcatalog-core dir into the parent project dir. But its hardcoded to dist
https://github.com/event-catalog/eventcatalog/blob/cb828395b6db3c43821fd45de8e576cd891df446/bin/eventcatalog.ts#L114
I have a PR up for my attempt to solve this issue, which I haven't had time to wrap up. But there was some discussion about this problem here https://github.com/event-catalog/eventcatalog/pull/860#discussion_r1806937397
In summary though, quick solution could be to just change this line from this
outDir: config.outDir ? join(coreDirectory, config.outDir) : join(coreDirectory, 'dist'),
to this
outDir: config.outDir ? join(projectDirectory, config.outDir) : join(projectDirectory, 'dist'),
It would also be good to delete that copyFolder invocation.
What are your thoughts?
Thanks again!
Hey @Sheemap
Thanks for coming back, ahh yes makes sense. TBH I think this makes sense to me
outDir: config.outDir ? join(projectDirectory, config.outDir) : join(projectDirectory, 'dist'),
I can't see why the core would ever need it, and just write to the users catalog makes sense. I will raise a PR for this and clean up the scripts as you said :) thanks for feedback!
OK think I have a fix here #915 will test it out
Use Case
We use EventCatalog in a monorepo, where everything is packaged and stuck into a
dist/{project_path}
dir. This involves running a process and then copying over specific out files/dirs.Unfortunately, because we cannot customize the path of EventCatalog's dist, when we run our packaging tool, it ends up in
dist/dist
Proposed Solution
It would be awesome if we could just specify a custom
outDir
in eventcatalog.config.js. Similar to the other astro settings available, liketrailingSlash
Implementation Notes
Id imagine adding the
outDir
follows the same patterns as other astro settings. Accepting a value from eventcatalog.config.js, while having a default fordist
Community Notes