To customize your package.json file for a specific command, simply add a "bin" property with the desired command name and its associated JavaScript file. Once you have defined this in your package.json, running the designated command should execute properly after compiling from Typescript to Javascript. Check out an example here. The original command file is written in Typescript, using a shebang of #!/usr/bin/env node
to allow for Node.js as the script runner, then compiled into Javascript along with the rest of the library. To run the command, simply use ogma <file_name>
and let the script do the work.
If you're incorporating Nest into this setup, it will be an additional step but still manageable. Your entry file can utilize NestFactory
to create the application and then pass data to a handler, as explained here. Feel free to reach out if you need further clarification or assistance.