CLI command line tools are very common applications. We have built some CLI tools in languages like Golang/Rust before, but this time we will build a CLI command line tool based on Node.js and publish it to npmjs.com for others to download and use.

Function is introduced

Use the CLI command line tool to send the message of the flying book group robot.

lark-notify https://open.feishu.cn/open-apis/bot/v2/hook/{key} "Hello World"
Copy the code

Initialize the project

Create a new project directory and initialize the project with NPM init

mkdir node-lark-notify
cd node-lark-notify
npm init -y
Copy the code

Basic CLI project configuration

{
  "bin": {
    "lark-notify": "bin/index.js"}}Copy the code