Executing any Node.js module or .js file via CLI without creating any command-line interface at all

7,030 reads

Recently I published MagiCLI, which is a module built to create automagically a CLI for any given module. It's just needed to include it as a dependency, require the module, and then a CLI is ready. However, even though this tool is there, to be used, if a developer (end user) wants to execute some existing module published on npm via CLI, there was still a dependency. The maintainer of a module have to include MagiCLI in order to provide the command-line interface. Well, not anymore 😉.

MagiCLI can now be used to execute any module or .js file (containing module.exports) via CLI. Just install it as a global module (or call it using npx) and pass the path to a module or file as an argument. Check the docs to know better about its Usage via CLI.

Tags