question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CLI: toggle JS/TS output

See original GitHub issue

We want to add some logic to toggle TS output on/off in the CLI commands, and select .ts/.js (or .jsx/.tsx) based on that. To do that:

  • have the core generators always emit TS, and add a MitosisConfig["outputs"]: ["typescript" | "javascript"] flag to the CLI.
    • If the outputs array contains typescript, we output the TS code as-is.
    • If the outputs array contains javascript, an additional transpilation step is executed that takes the TS code and transpiles it down to JS, and saves that to a file

The outputs array can contain 1 or both of those flags. If it’s empty, we default to typescript 🤔.

PS: We can probably reuse this function for transpilation: https://github.com/BuilderIO/mitosis/blob/ab0708fd2c07a06a7a52ab7490cd8e716759a48a/packages/cli/src/build/helpers/transpile.ts#L17

_Originally posted by @samijaber in https://github.com/BuilderIO/mitosis/issues/473#issuecomment-1154248996_

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
kylecordescommented, Jul 25, 2022

Yes, exactly. I definitely don’t urge growing scope too fast… but it would be perfect if eventually the config/flags included telling Mitosis what version of React/etc to use, then Mitosis would emit the package.json and all other needed files, ready to use with no further edits!

1reaction
samijabercommented, Jul 18, 2022

It could be simpler than I am anticipating! We will soon switch the Builder SDKs to the ts output, and then build js+.d.ts files from that so that the final result has types. If I see that the work needed there is easily portable, we can definitely bake it into the CLI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Capturing switch CLI output - IBM
The script command captures the standard output (stdout) from the Telnet or ssh session by using the switch and places it into a...
Read more >
Back Up Light Switch Clip - Advance Auto Parts
Save on Back Up Light Switch Clip at Advance Auto Parts. Buy online, pick up in-store in 30 minutes.
Read more >
JSTS - Journal of Semiconductor Technology and Science
Bond pull test results of frameworks with Cu clip and Al wire. ... a bridge rectifier, a controller with a voltage regulator, a...
Read more >
Jets continue to keep Christian Hackenberg on ice, even during OTAs
Since the New York Jets traded up in the second round a few years back to select Christian Hackenberg out of Penn State,...
Read more >
Setting the AWS CLI output format - AWS Documentation
Control the format of the output from the AWS Command Line Interface (AWS CLI).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found