BuilderIO / mitosis

Write components once, run everywhere. Compiles to React, Vue, Qwik, Solid, Angular, Svelte, and more.
https://mitosis.builder.io
MIT License
12.4k stars 549 forks source link

Mitosis output dir should accept any valid path #564

Open kylecordes opened 2 years ago

kylecordes commented 2 years ago

I am interested in helping provide a fix!

Yes

Which generators are impacted?

Reproduction case

dest: ['../anywhere']

Expected Behaviour

Mitosis should accept any valid path for the dest.

(Also, why is the dest an array?)

Actual Behaviour

Currently the output only accepts “forward” paths, i.e. it won’t write to “../../somewhere”.

Additional Information

I'm not sure how big an obstacle this is in real use cases, but it requires workarounds in the E2E.

This is exacerbated by the need for the current working directory to be where the input src is located, see #494. Once that problem is fixed it would it would be possible to run Mitosis from an arbitrary higher directory, making this bug less noticeable.

samijaber commented 2 years ago

(Also, why is the dest an array?)

It isn't! Providing an array of 1 item works by sheer JavaScript luck 😄

image

https://github.com/BuilderIO/mitosis/blob/801894b99aeefa12986185898cf310ed3376447e/packages/core/src/types/config.ts#L21-L24