Skip to content

possibly stupid question #18

Answered by jmcdo29
astrograph asked this question in Q&A
May 10, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Best answer is "it depends".

If you're writing an npm package to be a script, you'll need to use the bin property of the package.json and point it to the dist/main. Then when it is installed, the <feature> will be a known shell command. This is how my @ogma/cli package works.

If you're making a script that will just be ran only in this repo/project, you can use ts-node to run the main from src if you don't want to compile, or you can compile and use node dist/main (or whatever the command file you have is). Then it's just passing the sub-command name (if no default) and the options and arguments.

Let me know if that helps or if I can clarify something more 😄

Replies: 1 comment 2 replies

Comment options

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

@jmcdo29
Comment options

Answer selected by astrograph
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