node开发命令行脚本 / commander

1. 脚本第一行添加 #!/usr/bin/env node

// index.js
#!/usr/bin/env node
console.log('hello world')

2. package.json 添加bin

{
  "name": "hello-test",
  "version": "1.0.0",
  "bin":{
   "hello-cli":"index.js"
  }
}

3. npm link

node开发命令行脚本
https://www.cnblogs.com/lcosima/p/11482428.html

---------------------------------------------
生活的意义并不是与他人争高下,而在于享受努力实现目标的过程,结果是对自己行动的嘉奖。
↑面的话,越看越不痛快,应该这么说:

生活的意义就是你自己知道你要做什么,明确目标。没有目标,后面都是瞎扯!
原文地址:https://www.cnblogs.com/pengchenggang/p/15088483.html