I have written an NPM package which has its own CLI commands.
Let's name that package as xyz
and imagine it's now avaialable on npmjs.com
So, let's say a user installs this package in his project by running npm install xyz
.
And now he wants to run a CLI command provided by xyz
package on his terminal in his project.
xyz do_this
Can this be done without installing this package globally by user ? Or without any further configuration for the user ?
Here's some part of the package.json
of the xyz package.
{
"name": "xyz",
"version": "1.0.0",
"description": "Description",
"main": "index.js",
"preferGlobal": true,
"bin": "./index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
........
./node_modules/http-server/bin/http-server
? I hope I got it clear. – Flannery