Command Line Interface

步骤

创建文件夹

lxl-cli-demo

执行命令

cd lxl-cli-demo

npm init -y

创建文件

./bin/index.js

1
2
#!/usr/bin/env node
console.log('hello cli')

修改文件

package.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"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

---------------
Enjoy it ? Donate me !
欣赏此文?求鼓励,求支持!