1.0.0 • Published 7 years ago

weather-command v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

实战

  1. 用commander编写一个天气应用(commander+axios+easy-table)

    • 天气接口
    • 实现效果:tianqi --city=北京 打印出好看的当前城市天气
    • 转成命令行工具
      • package.json --> "bin": {"tianqi":"./index"}
        参考链接
      • index.js --> index
      • index文件最开头添加shell bang: #!/usr/bin/env node
      • chmod + x index //可执行权限
      • ./index //运行
        ./index city=海南 //运行
      • npm publish发布模块,然后 npm i ./ -g 使用(全局安装才能使用bin字段的命令)
      • npm uninstall . -g //全局删除.模块
  1. 定时抓彩票脚本,实现每天给自己发邮件,报告昨天开奖信息(cron+axios+cheerio+nodemailer)