CLI: toggle JS/TS output
See original GitHub issueWe 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 containstypescript
, we output the TS code as-is. - If the
outputs
array containsjavascript
, an additional transpilation step is executed that takes the TS code and transpiles it down to JS, and saves that to a file
- If the
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:
- Created a year ago
- Comments:7 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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!
It could be simpler than I am anticipating! We will soon switch the Builder SDKs to the
ts
output, and then buildjs
+.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.