You can add a bin
property to your package.json
with the name of the command you want to give, and the js file associated with the command. From there, if you were to run "commandName", you should get the command to properly run (after building from Typescript to JavaScript of course). As an example, you can see this. The original command file is written in Typescript, given a shebang of #!/usr/bin/env node
to allow for node
to be used as the script runner, and then compiled into JavaScript with the rest of the library. From there, I just run ogma <file_name>
and let the script take care of the rest.
For you, adding in Nest will be a step on top of this, but still pretty easy to manage as you'll have the entry file use the NestFactory
to create the application and then pass the expected data into some sort of handler as described briefly here. Feel free to comment if you have any other questions.