framework
framework copied to clipboard
fix: convert output to default to the source root
Note that it is diverging a bit from the ideation in #838. Because, in the config file, output defaults to dist (it is where the built files go); in the case of the convert command, I don't think we want that, but rather default to the source root, aka the root option (which defaults to src).
If the --output command-line option is passed explicitly, it must be considered relative to the cwd, not relative to the root. But this means we're comfortable with running this command from anywhere in the project, so if it's not passed explicitly, we make sure to use the source root relative to the root. Otherwise you would end up creating a new "src" folder inside your cwd.
(I was surprised in my tests that the cwd is incorrect when calling yarn tsx ../src/bin/observable.ts convert; I ended up testing manually the built script.)
(I'm making this PR against cobus/convert-documentation but it could be merged afterwards.)
closes #838