Skip to content

How could I use the CLI in other project? #1671

Answered by msujew
negahama asked this question in Q&A
Discussion options

You must be logged in to vote

In theory, you could just run node <path/to/cli.js> to run the transpiler as a separate process. However I would recommend something different:

You can add a dependency from your app to the cli package and invoke the transpiler from code. This has a few benefits, mainly:

  • Allows to debug your transpiler (if you need to) from the other app
  • Better error handling - usually a CLI just exits with status 1 and tells the user relatively little what went wrong. A programming API could have better access to any internal error of the transpiler.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@negahama
Comment options

@msujew
Comment options

Answer selected by negahama
Comment options

You must be logged in to vote
1 reply
@msujew
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants