步骤
创建文件夹
lxl-cli-demo
执行命令
cd lxl-cli-demo
npm init -y
创建文件
./bin/index.js12console.log('hello cli')
修改文件
package.json123456789101112131415{ "name": "lxl-cli-demo", "version": "1.0.0", "description": "", "main": "index.js", "bin":{ "lxl-cli": "./bin/index.js" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC"}
全局安装
npm install -g
使用
打开cmd,输入lxl-cli